3 ms·
https://people.eecs.berkeley.edu/~bh/hiding.pdf https://people.eecs.berkeley.edu/~bh/hiding.pdf 7. On the other hand, we are about to unveil a radical unhiding
by DonHopkins 3y ago
https://people.eecs.berkeley.edu/~bh/hiding.pdf https://people.eecs.berkeley.edu/~bh/hiding.pdf
7. On the other hand, we are about to unveil a radical unhiding: showing users the innards of
expressions and procedure bodies via macros and metaprogramming. The central feature making this
possible is the ability to convert back and forth between executable code (the blocks and scripts
that we've always had) and syntax trees: lists of lists of the individual blocks and constant values
(such as text and numbers), the building blocks of expressions and scripts. That conversion
overcomes the only weakness of block languages, namely, that programs aren't data, which makes
them harder to manipulate programmatically.
7½. Pedagogically, this is an extension of the self-reflection by means of non-hidden
continuations, which call attention to the sequence of events in executing a script, and which we
inherited from Scheme. Continuations are conceptually simple for the implementor, since they
already exist in any interpreter for any language, and it's just a matter of making them visible to
users. But they're not conceptually simple for users! The fact that they can be called repeatedly,
and from outside of the script in which they were created, feels like magic. And it is; it's the
magic of "everything first class." But the point here is that we didn't add this feature in response
to a specific pedagogic need. Rather, explicit continuations help advanced programmers write
advanced programs, and a few library blocks. And they're a way to plant the flag of Scheme in
Snap!, which was a big part of our motivation.