Dropping the ANY-XXX! from (Some) Type Constraints?

There was a slightly confusing aspect of historical Rebol where some typesets were named so that they looked just like a datatype:

red>> help append
USAGE:
    APPEND series value

DESCRIPTION: 
    Inserts value(s) at series tail; returns series head. 
    APPEND is an action! value.

ARGUMENTS:
    series       [series! bitset! port!] 
    value        [any-type!] 
...

Here, we see SERIES! which is not named in a way that makes it obvious that it's not a fundamental type. It's named the same as BLOCK! or WORD!.

@earl and I agreed that this was a stumbling block, so we thought that ANY-SERIES! was a better name. That way you wouldn't make the mistake of saying:

if series! = type? x [...]

...and have it always fail. You'd be cued by that ANY- to know that it was a set of many types. (You still might think that you could use the equals operator to see if something was in a typeset and be wrong, but that's a different level).

But Ren-C has done away with typesets. They were too limited, and we now use arbitrary functions to do typechecking via predicates (with some various supporting optimizations so the common cases aren't horrifically slow).

So ANY-SERIES! is pretty much going away. Most of the time you just use ANY-SERIES? (e.g. in a function spec or regular code), and then &ANY-SERIES? if you're in something like a parse rule.

Do We Still Need The ANY-?

I'm a little torn on the question of whether we need the ANY-.

Sometimes it's required (e.g. with ANY-WORD?) because WORD? means specifically "plain word". (Note you'd use WORD! generally in type specs, though technically you can use either...performance should be identical).

But on ANY-SERIES? it's now a bit superfluous. And SERIES? is certainly shorter.

:thinking:

It's not a slam dunk to take the ANY- off. I kind of like the realization it gives you as a reader... "hey, we're talking about multiple things here"... and it makes you stop and consider "just how many series are there? is ANY-SERIES? really what I mean?"

I kind of lean to keeping it. And I prefer ANY-VALUE? to just VALUE? as well.

But it's definitely less important than it was.

1 Like

In my proposal for a constraints-only world, I suggested keeping ANY-* for constraints which ‘look under’ sigils to match a specific type. So ANY-WORD? would match WORD!, GET-WORD!, QUOTED! of WORD!, ISOTOPE! of WORD!, etc., and similarly for the other ANY-* constraints. The idea would be that these are looking for ‘any’ occurrence of the specified type name. By contrast, a constraint like SERIES? wouldn’t get an ANY in its name, because it’s not looking for any occurrence of a SERIES! type. I think this is a reasonable compromise.