Here’s a tedious loop pattern I find myself typing all the time:
control-code
while (condition)
body
control-code
endWhile
Here’s a tedious loop pattern I find myself typing all the time:
control-code
while (condition)
body
control-code
endWhile
I’m probably going to cut “repeat..until” from gen2 Slag.
I guess it’s just one of those things that sounded cool but never proved itself.
Murphy mentioned the other day that every feature proposal in C# starts out with negative 100 points. People then try to come up useful cases for the feature, each rated with some number of points to offset the initial score. Only features that end up with a net positive score are actually implemented.
It’s a neat idea, although thankfully since Slag is just a little fish (but growing!) I can afford to just put things in & rip ‘em out later. Anyways, “repeat..until” is currently at (-99), so I’m gonna ditch it.
Oh wait – let’s look at the MadStone source code! Here we go. Hmm…. zero uses. Yep.
Up until now, the call-related speed issue I’ve been most worried about in the Slag VM has been aspect call dispatch (e.g. interface call dispatch). Ironically, while thinking about multimethods (previous post) I just figured out a way to turn aspect calls into standard dynamic calls!
This semester I gave my nooblet CS 110 students a tile-based game framework and had them add some additional actor classes and behaviors. It worked out pretty well, but the big thing I noticed was that the majority of my students were trying to override methods in a way that was intuitively but not technically correct for Java.
For example, the bump( TileActor actor, int dir ) method is called whenever you bump into someone while moving in a certain direction. To have Snake actors kill any other “Being” actors you’d give them this bump method:
public void bump( TileActor actor, int dir )
{
if (actor instanceOf Being) actor.die();
}
However, most of my students were defining this method instead:
public void bump( Being actor, int dir )
{
actor.die();
}
Of course in Java you have to override a method using the exact same parameter types as the original definition. But their code would have worked in a language that uses double dispatch.
In classic fantasy stories, knowing the true name of a demon or a faerie gives you power over it. Taken as a metaphor, I think this leads to a profound truth: you do not truly understand a thing until you can accurately describe it.
I’ve seen this in practice many times. Some examples:
Until recently, Slag’s motto was “The Language of Games”. I’ll admit to taking a cue from Matlab’s “The Language of Technical Computing.” But as time wore on I grew increasingly dissatisfied: what makes Slag the language of games? How do I really sum up the language in a short phrase to someone who’s never heard of it? In short, I had picked an arbitrary description that did not really fit. I did not really understand the nature of my own language.