Archive for November, 2007

Code Poetry, it’s an Art

Wednesday, November 21st, 2007

Gopal VTo my left is a kickass compiler poet named Gopal Vijay(shortened). I worked with Gopal when I just started to learn compilers and frameworks on the DotGNU Project. He understands what hard work is, as does Rhys Weatherly, the original author of Portable.NET. Both of them had mentored me to become a better programmer all around and not only understand what it means to do it correctly, always. After a couple years of working on DotGNU I moved on to constructive network protocol development which pushed me straight back into webservices where I stand today repeating the circle.

The reality is that we like to speak, walk, run around, and play with code. It’s our paintbrush, tinker toy, classical instrument, and pen. It can do things that people can take for granite or widen peoples’ eyes.

We all need to respect the programmer and give him/her a pat on the back. A raise might be nice too ;)

Yes, it’s true, we develop for ourselves, some more than others. If we want to build a god damn game engine for a calculator, by damn we will. You can’t stop us!

A toast for the digital poets!

Dynamic Scalar Type Hinting on PHP6

Tuesday, November 20th, 2007

I was recently following a thread on the php-dev list that intrigued me enough to write about a new syntax feature for PHP.

Sam Barrow recently posted a patch about optional scalar value type hinting that got me thinking that it was a smart approach to making php even more structured, but using a dynamic approach, since PHP has given us flexibility, let’s keep moving forward with it.

I propose a Dynamic Scalar Type Hinting syntax where we can declare data-types and our boundary checking callbacks during runtime.

We always have to do boundary checking and type checking on our functions, even though we already know the type to be used in context.

[The requested file standard_type_checking.php could not be found]

Let’s propose the following syntax:

[The requested file dynamic_scalar_type_checking.php could not be found]

Here it appears that passing a scalar type reference via ‘<' + literal + '>‘ syntax just left adjacent from your parameter you can set an inline and possibly an internal type check.

Some might say why not use Java? This is what non-dynamic based languages such as C++, Java, C#, etc. platforms of that caliber would bring to the table.

They require that you declare your type ahead of time and don’t give you the option to define and adjust during runtime without an obscure mannerism. Dynamic Scalar Type’s do not have to be defined at all or during runtime. They can also be used as inline type hinting for runtime based performance optimizations in the execution engine. They can be used by documentation tools to better generate phpdoc’s.

When all is said and done, I think this could be a fine addition to the PHP6 or possibly future versions beyond the platform. Thanks for listening and feel free to share your comments. As I continue to work on this patch to PHP6 CVS, I’ll need a sounding board.