One of the features in UserTalk that I enjoy the most is the feature that I thought was the most useless when I first read about it.
It's the 'bundle' keyword. All it does is the equivalent of introducing a block of code.
That didn't make sense to me at first. UserTalk is customarily programmed in an outliner, and a block is introduced merely by making it a child of the 'if', 'while', 'case' or other keyword that requires a block. So all it really does is add a level of indentation to the code.
Which, as it turns out, was the key to why it's such a useful feature.
When you start mucking about in Frontier or Radio, you really don't get very far until you get comfortable with the programming environment that's been set up, since it is educational to poke around in the current code base. One of the things you start seeing is a lot of code that looks like this:
on whatever(s)
bundle // what this phrase does
bundle // what the next phrase does
bundle // clean up the mess
return (true)
...where the bundles have code in them, they're just collapsed in the outline.
When you use an outline, you can collapse bits of code so they don't get in the way of your thought. You can tag the bundle with a comment that summarizes what is going on, which makes it much easier to deal with the code. It's easy to take on big projects if you split them up into tiny pieces, and getting them out of your way visually really helps in keeping focused on the bigger picture. If you didn't have a 'bundle', you wouldn't have a way to break code into phrases that can be hidden. You're left with just adding whitespace to make some breathing room, but that soaks up vertical space that always seems to be in short supply. In an outliner, to make something hideable, it must be made a child.
It's a nuance you really don't get until you start using it.
Now that I'm programming Python in a browser, I've been missing being able to use bundles. Then it occurs to me -- I'm already rendering Python code from a browser, there's nothing keeping me from allowing someone to use a bundle keyword in the browser, and then just do the right thing when it's written out. I could have a 'bundle' in Python.
I think that little feature will slip into my Python Tool in the next minor release.
12:31:36 PM
|