New Names for ^FOO, @FOO, and $FOO

I Think METAFORM! Is The Best Choice For ^FOO

This takes over the META and UNMETA verbs:

>> meta [a b c]
== ^[a b c]

>> unmeta first [^[a b c]]
== [a b c]

(The historical operation of adding quote levels that also promotes antiforms to quasiforms is now known as LIFT, with a corresponding UNLIFT.)

PINNED! => @foo, @[foo bar] etc

Verb form PIN:

>> pin first [a]
== @a

I like it because it's like you've stuck a pin on it, that won't come off in evaluation.

TIED! => $foo, $[foo bar] etc.

Verb form TIE:

>> tie first [(a b c)]
== $(a b c)

It's a little bit odd, but its evaluative purpose is ultimately "tie" its attachment to a context.

As the emoji shows (:knot:) the dollar sign kind of looks like a knot!

We Can Call $ a "tie", @ a "pin", and ^ a "meta" !

That's neat.

It seems that type checking can be sensitive to these, so if you say you take an @word! it will check to see if it's an @ form, and then do the typecheck against it without the Sigil.

But now there has to be generalized type destructuring. How do you ask if something is an @word! ...? Well, there's MATCH:

if match [@word!] value [...]

It's not horrible, compare it to:

if the-word? value [...]

It's better in several ways I'd say. Though you can't optimize it to omit the block, e.g.

if match '@word! value [...]  ; word! will be unbound

But that's probably for the best, because '@word! is too easy to confuse with quoted @word!, which will be typechecked by the quote levels in the new model. It might be worth it to have intrinsics for PINNED-WORD?, PINNED-BLOCK?, etc. ... just because they're not fundamental types doesn't mean the most useful forms can't have accelerated type checks.

Anyhow, this looks good... I'm especially pleased that it gives us short and effective modifier verbs for adding the Sigil.

Credit to ChatGPT for PINNED! and TIED! Names :robot:

Good work, ChatGPT!

1 Like