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

It's beginning to look inevitable that all "sequencable" types will have versions with "SIGIL!s". At the moment it's looking like there are 3 of these: [^ $ @]

So $"dollar strings" are coming, as are decorated integers like ^1020

Like QUASIFORM! and QUOTED!, we need a generic name to cover each Sigil.

Following historical naming, METAFORM! for ^XXX is all right, I guess (?).

But I don't want to follow that pattern with historical "THE" and "VAR", calling @XXX a THEFORM! and $XXX a VARFORM! :nauseated_face:

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

What deserves to be a datatype?

:up_arrow: There's the generalization you were looking for, @bradrn. :slight_smile:

1 Like

A post was split to a new topic: Should SIGIL! Be A Type, Or Just Decorated BLANK!

While I'm still debating what exactly ^ will do, @ has always been a useful operator...and I'm now fairly confident that $ should mean basically "bind this here (if not already bound)"

So you can use it to do things like this:

>> x: 10
>> y: 20

>> code: $ collect [
       keep 'x
       keep '+
       keep 'y
   ]
== [x + y]  ; bound

>> eval code
== 30

The block produced by COLLECT doesn't have any binding by default, but the $ will bind it. This fits very naturally along with what $word does and makes sense.

But calling $ when used as an operator "TIE" competes a bit with TIE the verb, which adds the sigil to its argument:

>> tie [a b c]
== $[a b c]

Conversationally, it's important to distinguish these two things:

construct $ collect [...]

construct tie collect [...]

When a distinction needs to be drawn:

  • $ is the TIE OPERATOR, a.k.a. a TIED SPACE (RUNE!)

  • @ is the PIN OPERATOR, a.k.a. a PINNED SPACE (RUNE!)

  • ^ is the META OPERATOR, a.k.a. a METAFORM SPACE (RUNE!)

Colloquially, you'd probably read it as the symbol to make the distinction:

construct $ collect [...]  ; "construct dollar collect..."

construct tie collect [...]  ; "construct tie collect..."

But reading things out loud is kind of intrinsically going to have some ambiguities:

construct $collect [...]  ; "construct dollar collect..." :-/

construct at block 5  ; "construct at block 5..." :-/

Anyway, the code makes sense even if the words have their confusions. What do you expect when in English TIE and PIN are both verbs and nouns. :-/

2 Likes