Case-Insensitivity And Dialecting

Today's Ren-C uses case-sensitive binding. The topic has been discussed a lot:

Case Insensitivity vs. Case-Preservation (can't have both?)

As a discipline, we still are trying to keep the language lowercase, in the standard library at least.

But one thing that hasn't been discussed much is how case could be used creatively in dialects, when you know the case doesn't matter. I think that in certain domains, use of case in dialects could be an interesting tool.

Using Casing To Imply Uppercase, Lowercase, As-Is Case

I've written a little about how the CScape interpolation tool does casing. That's strings and not ordinary code.

The case logic would work in ordinary code something like this:

>> strings: ["aBc" "dEf" "gHi]

>> cased-print ["For instance:" STRINGS.1 strings.2 Strings.3]
For instance: ABC def gHi

It might seem silly, but in CScape it turns out to be pretty useful to do that.

Non-Case-Related Example: "Hardening" Bindings

We have an issue now that sometimes when you are composing material you want bindings to "stick". Here we want LET and PASSTHRU to be bound to the same environment as the block given to the COMPOSE (which propagates to the GROUP!s, and then to the blocks evaluated in the groups). But we want RETURN to be unbound, and pick up its binding from the site where it is composed:

 compose [
     (in [] 'let) (name): (in [] 'passthru) :return
 ]

There could be some dialect options for this... a special signal, maybe something you pass:

compose/harden [
    <hard> let (name): <hard> passthru :return
] <hard>

compose/harden [
    %h let (name): %h passthru :return
] %h

compose/harden [
    $ let (name): $ passthru :return
] $

Since you have groups available, you could get the literal of the thing you're hardening with, e.g. with (<hard>) or (%h) or ($)

And of course, you could have an operation that reverses this...so that things were hardened by default but you escaped to leave them unbound.

But... a weirder idea... what if you used something like the case?

 weird-compose [
     LET (unbind name): PASSTHRU :return
 ]

Important to remember is that symbols don't have case. So you can't use the trick for everything.

But I present this in juxtaposition to using even the most minimal signal (like $) just to show how much the comprehensibility can benefit.

2 Likes