New block: run in caller

this block is for custom blocks. it would have the effect of running a script in the script where the custom block is used. it may seem like you don't need this block, but there are catch, throw, and script variable blocks.

Yes, there's a name for that feature: it's a macro. I'm supposed to be working on it.

oh :slight_smile: i've been wondering what a macro is

Technically there are two parts to being a macro. One is what you wanted, the ability to inject code into the caller. The other, which we already have, is the ability to prevent the evaluation of inputs prior to calling the macro. (We do that with the Unevaluated input types; in real Lisp the entire expression is passed to the macro as a single unevaluated expression, so that the macro can define its own syntax.)

That's what "macro" means in the Lisp community. Lesser languages, in which expressions aren't first class, think about macros at the level of text strings. That has the virtue that a macro doesn't have to be syntactically complete -- you can make a macro whose text is "(((" -- but that virtue is also a problem, because it's really easy to have macro bugs. And of course that whole idea doesn't really work in a block language, whereas the Lisp version is doable.

By the way, did you actually need macros for something, or did you just like the idea?

no, I need it for one of my c-blocks, because of the script vars block.

Are you sure you can't solve your problem using upvars?

no, I can't.

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