Are hat blocks first class in Snap!

sorry i have been making a lot of topics recently–i'm just very curious.
I want to know if hat blocks are first class, and I don't think so since they cannot be the value of a variable, an input to a procedure, or the value returned by a procedure. since It seems like they aren't first class, can there be a "hat and/or command" input?

This idea comes up a lot, because it's an obvious "hole" in the first classness of everything. But we've talked about it and really don't see a use for it. Scripts are first class because that lets us build HOFs that delay or repeat the evaluation of a block. But it doesn't make sense to say to run a hat block at a particular time, or repeat it; hat blocks are sort of running all the time. You can do the equivalent by reifying a FOREVER IF script.

When eventually we get to the point of letting you add a script to the scripting area programmatically, then of course it'll make sense to be able to include a hat block in that script. But you can't do that yet, or any time soon.

[scratchblocks] (blockspec of ({ when [space v] key pressed :: control hat} :: grey ring) :: sensing)
// is not the same as
(blockspec of ({forever
if < key [space v] pressed?> :: control} :: grey ring) :: sensing)

Yeah. "Reify" means, literally, "thingify" -- make it a thing, something you can use as data. For scripts and blocks that means ringifying, but, for example, to reify a costume you use NEW COSTUME or MY COSTUME.

And of course the blockspecs are different, but they do more or less the same thing.

not any time soon

If I knew, I woulda said!

oh, okay.

you cannot achieve "when I receive [any message v]" or "when ⚑ clicked" with a forever if, and without a variable.

Yeah, I did say "more or less." But again, unless and until we have a way to add a script to the scripting area of a sprite programmatically, first class hat blocks wouldn't help.

You could always do something like
Edit: Just realized broadcasting the same message twice doesn't work. Nevermind.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.