Should WORD! Allow Sigils at non-HEAD Positions?

Rebol2, R3-Alpha, and Red have always let you put apostrophes in WORD! if they're not at the head.

  • That gives you weird WORD!s like didn't and isn't.

  • It also lets us and words with apostrophes to indicate "prime" and "double-prime" derivitave things, like f' or f''

So Ren-C has allowed this as well.

But now, we're in the era of Sigils. What reasoning would there be to allow [$ ^ @] in WORD!s at non-head positions?

Well... it would give slightly more compatibility with WebAssembly Text Format. They have identifiers with $ in the name...

But given some recent applications of using $ to do bound PICKs, I came to wonder if we could shorthand:

b: 10

block: [a b c]

assert [10 = get pick:bind block 2]

A plain PICK could be shorthanded as second. So you could say second:bind, since SECOND is a specialization of PICK.

But I thought that maybe second$ could make an okay shorthand for second:bind

assert [10 = get second$ block]

And in turn, that made me think pick$ would be a generically useful shorthand for pick:bind

It's certainly more communicative than pick*.

Whether these shorthands go in the box or not, I don't really know what the benefit is to prohibiting them.

I agree — I think they should be allowed as a normal component of WORD!s.

(Note that Haskell also allows apostrophes in identifiers, and I get plenty use out of that. Similarly, Lispers like to name things with question marks and asterisks, since those are allowed in Lisps.)

2 Likes

They seem ugly until you consider the convenience.

Ending in $ is not not a bad name for "this thing, but bound":

foo: func [var [word!] ...] [
    var$: bind context var
    ...
]
1 Like