At one point I wrote up a thought experiment about something called NewPath. Executive summary: I thought it might be more flexible if things like %foo/bar were actually a PATH! with a FILE! in its first slot and a WORD! in its second slot. Then when it was evaluated, it would produce the singular FILE! value
This made it seem like you could do interesting path compositions, with GROUP!s and such, and have it look like a file. @rgchris (rightly) complained that this took away some of the simplicity for those dealing in regular FILE!s or URLs.
NewerPath is built on a long-running pet idea of mine to change
/ from simply meaning “divide” to being expanded to a generic pathing operator. Just as a proof of concept…check this demo out (to actually try it, you have to say
set/enfix quote / func ... because /: is not a legal SET-WORD! at the moment)
>> /: enfix func [#left #right] [ as file! unspaced [left "/" right] ] >> subdir: func [x] [ as file! unspaced ["subdir-" x * 10] ] >> (subdir 10) / %foo / (subdir 20) / %myfile.txt == %subdir-100/foo/subdir-200/myfile.txt
The result is pretty cool. If it’s a tight infix operator following the same rules as old dividing /, then you need the parenthesization, else it would be greedy and try “10 / %foo” and such. Though that was part of the Old NewPath proposal too, since you had to parenthesize to get code executed in paths.
But…if we were willing to take a little bit of a hit on pure compatibility with DIVIDE, it could be a left normal, right tight op.
>> /: enfix func [left #right] [ as file! unspaced [left "/" right] ] >> subdir 10 / %foo / subdir 20 / %myfile.txt == %subdir-100/foo/subdir-200/myfile.txt
The left normality means you can avoid some amount of parenthesization (as long as it’s one complete expression). The right tightness stops greedy infixing if it winds up with an opportunity for that while one of its arguments is gathering its arguments. It would change the behavior of / when mixed up with non-infix functions, while leaving pure infix “precedence” the same. Maybe too freaky, the but interesting to point out the parentheses could be avoided.
While it might seem a little weird to say that “picking” one integer out of another integer somehow means to “divide” them, it doesn’t seem like the end of the world if 1/2 comes out as 0.5.
The bigger conceptual issue is what happens when people see a / b and can’t trust that’s mathematical division. Generally speaking the experiment of Rebol has a lot to do with allowing that rug to be pulled out from under you a bit, in order to expand your expressivity. And I do a lot more FILE! or URL! construction from parts than I do math in Rebol.
So I dunno. If your variables have meaningful names and your code is laid out contextually right, it shouldn’t be much of a problem. I guess that’s why I think it would be good to try it and find out.