metaeducation / ren-c

Library for embedding a Rebol interpreter into C codebases
GNU Lesser General Public License v3.0
126 stars 27 forks source link

Quasi-Void Rendering Ambiguity in Paths #1157

Open hostilefork opened 7 months ago

hostilefork commented 7 months ago

Quasi-Voids were made legal in PATH! and TUPLE!, specifically to facilitate things like:

dir: first [~/projects/stuff]

But this creates an ambiguity with things like:

~/foo/~

... which could be a regular path with quasi-voids in the first and last positions... or a quasi-path with blanks in the first and last positions. :frowning:

I guess that quasi-paths which start or end with slashes need vertical bars around them.

~|/foo/|~  vs.   ~/foo/~
~|/foo|~   vs.   ~/foo
~|foo/|~   vs.   foo/~

~foo~ and ~foo/bar~ is unambiguous

Annoying, but, I think it's worth it. ~/projects/stuff is legal in Redbol and I'd rather not lose the ability to do that.

hostilefork commented 6 months ago

I guess that quasi-paths which start or end with slashes need vertical bars around them.

Vertical bars are now eliminated as an escaping mechanism, so this would not be an option.

But current thinking is that PATH! and TUPLE! do not come in quasiforms or antiforms. That simplifies this, so if you see:

~/foo/~

You know that's not a QUASI-PATH! because there are no QUASI-PATH!s.

A remaining problem is the special case of / being a WORD! (to make it assignable and customizable as a division operator). Then ~/~ would be an quasi-word. That may just be a consequence of the design, in which case we'd just have to disallow the creation of paths with ~ in the first and second slots.

hostilefork commented 1 week ago

A remaining problem is the special case of / being a WORD! (to make it assignable and customizable as a division operator). Then ~/~ would be an quasi-word.

I believe this is solved by only letting a fixed number of words become quasi/anti forms.

This also helps futureproof the system, so it can invent more antiwords for special meanings without worrying that users had done something else with them.