If this is the wrong category, please shift it.
Hi (and apologies to bh and Jens for not posting here at all or really using the cool community site in their entire existence ). Congrats on Snap! 8. That's a big version number, and the new metaprogramming features that have finally arrived are too cool for me to ignore (though usually I can never think of anything worth programming).
I haven't found much discussion on them here yet (adamantpenguin implemented text-based Snap!) so here are some use case ideas, and please share any more...
Records: I don't know where I first heard of this kind of thing; probably because of the SRFIs (Scheme Requests for Implementation) about it.
It will be great if someone can think of a better example for this.
The way to use variadic inputs seems to be undocumented, so I assumed there was no way and made it nest a lot of CONSes instead of using LIST.
There doesn't seem to be a better way to deal with variables than this:
or using an undefined variable if it has a fixed name, but of course I should just have made a custom block for this purpose.
Backquote (can't think of a different name): This macro might make a lot of macros (and the record implementation) easier and clearer. Not sure if it works perfectly, or whether unevaluated inputs/C-slots or ordinary procedure inputs are better. THIS SCRIPT + OF (if the latter now means "this block/procedure as a procedure with the environment of another") doesn't seem to work very consistently:
works, but this should be equivalent and doesn't work:
(Also I seem to have broken something so the backquote block only works half the time, other times saying "Cannot convert a Symbol value to a string" or something.)
A library with blocks for metaprogramming/macros might be a good idea.
bh had thought of a metacircular evaluator well before these features weere added. I guess running primitives needn't feel like "cheating" because special forms would still be treated specially? Are there any interesting ways it could be modified? Would the "Variations on a Scheme" still be relevant even though Snap! can imitate them more directly? In any case, it'd be interesting. (I started one with Snap! XML long ago.)
I don't think pattern matching (or syntax-rules) would be really relevant to Snap! macros because they're blocks.
Dispatch procedure OOP: Now one could make a DEFINE CLASS block that puts a new constructor in the palette, rather than just letting one assign it to a variable.
Snap! is probably one of the most innovative programming languages today (OK, I know nothing about programming languages today or CS academia, but I have the suspicion) since you're willing to add natural, convenient features without feeling constrained to what's conventional (hyperblocks, representing procedures' names(?) as themselves for want of a better way to put it, and hopefully eventually hybrid lexical/dynamic scope).
Any thoughts/ideas?