Ugly Types: Less Ugly Than History, Can We Do Better?

Nothing's too long for me to read here! :slight_smile:

Feel free to write long things and edit them down later for clarity, or if you just decide parts of it were distractions and aren't relevant anymore (and it doesn't break the continuity of the thread).

The reason for that is that most uses of TYPE OF had been SWITCH TYPE OF. Many of those would no longer work, because e.g. TYPE OF TRUE was an antiform and not LOGIC!, etc.

So all the switch type of instances (except for two, apparently) were robotically changed to switch/type where the values you're switching on are constraints (or types).

switch/type x [
    &logic? [...]
    integer! [...]
    &splice? [...]
]

But given the choice, people would prefer switch type of and being able to think of type as being a value instead of a constraint. And with the TYPE-BLOCK! answer, there's some inkling of a direction of going that way:

switch type of x [
    logic! [...]  ; wouldn't be locked in a 1:1 heart:type ratio
    integer! [...]
    splice! [...]
]

With more complex types, you'd have to use something like DESTRUCTURE to get at what you were looking for. And maybe that would be interesting. But of course that's a lot of hand-waving right now.

In the end, a good "realistic" choice might well need to be about coming to terms with something kind of simple. That may just be how it is.

64 types wasn't going to cut it for me, so I had to break that barrier for starters.

Now that the barrier is broken, it's a good time to let it simmer a bit. It's not going to resolve overnight--but I'm quite glad that you're thinking about it, and that you are able to take initiative and grok these problems well.

On the plus side, there's a lot of other fun things to work on right now while this sorts out...empowered by the new types (and some other realizations that are falling into place)...

I'm pleased and terrified that you're reading the source, but... there are some files that have decent organizations and comments to them, which can give you your bearings faster than reading something like a R3-Alpha or a Red.

This is motivating me to start pushing through some changes that had been on the back burner for a while, e.g. the death of REBVAL:

REBVAL => Value renaming · metaeducation/ren-c@71459d6 · GitHub

If you do have questions about things you see, feel free to ask them (or send PRs of things that are clearly just wrong or outdated).

2 Likes