by andybak · 14y ago · 0 comments
ellipse(65,50,60,60)
Wouldn't using something like Python's keyword arguments better than some external labelling? ellipse(radius_x=65, radius_y=50, center_x=60, center_y=60)
More characters but these are just training wheels. Once the learner understands the basics you can do away with them.API's and libraries should be designed to allow both forms. Everyone is a beginner with some aspects of their craft. I'm a beginner when I use a library I'm not familiar with...
My point was though that allowing keyword and non-keyword forms is good for everyone. If you can't remember the parameter order you can just use the keywords (assuming the naming is memorable enough - which might actually be a can of worms in itself)
ellipse({axes: {horiz:65, vert:50}, center: {x:60, y:60}})
The function takes a specifiable object, and It's All JSON^tm. It also nests objects in objects in a satisfying, somewhat intuitive way.Argument keywords are not reified and don't require special forms. Instead, they just happen to be the labels of an object.
I can see why you might not want to start with this concept for pedagogical reasons (you have to know a little about defining a Javascript object). But I would think you would want to move to this soon, so you can also get the programmer's special feeling of creating abstractions that make code disappear.
However his examples do strike me as amazingly ambitious. How would one go around implementing a custom way to tell the application "Hey I'm width! And I'm height! Calculate us from this and that point!". I'd pay good money for someone to truly deliver on Victors ideas. LightTable might be a good start, but it's nowhere near even completeing 30% of ideas presented.