So I apologize to @giuliolunati for making him have to put up with the / is a 2-element path containing BLANK!s debacle back in 2018. ![]()
On the positive side of me being mired in the implementation, I can see when something creates dissonance and edge cases...and know that things need to be avoided before someone in userspace would even know they needed to worry. The compiler gives me type checking errors when things don't line up, and I try my best to leverage whatever tools to catch inconsistencies I can (as far as C building as C++ can do, anyway).
But on the negative side it means I might pick the wrong form of regularity to solve the problem. This was such a case. We simply needed rules at PATH! creation time that prohibit you from putting special-slash-words into a path... and that's that.
So Now / And . Are Words Again
It's still going to be slippery. There will be problems:
math-context: make object! [
/+: infix add/
/-: infix subtract/
/.: infix multiply/
/: infix divide/ ; ooops
]
You won't be able to say (/: infix divide.) to assign your division operator to a slash word!, because that will execute the function in the colon word!. So if whatever the colon word does takes an action as an argument, you're going to take infixed divide as a parameter to that function... not perform an assignment. The PATH! is above the WORD!.
But things like (.:) and (...:) should work as expected. The WORD! is below the CHAIN!.
Is /: Too Misleading to Execute?
It stands out a little as a mistake in the MATH-CONTEXT above next to the other assignments, when narrowly packed like that. Of course, it wouldn't be narrowly packed. And you could just be trying to assign an inert value and not a function:
What you wanted:
>> /: 10
== 10
>> /
== 10
What you'll likely get:
>> /: 10
** Error: Colon doesn't accept INTEGER! as its whatever argument
The evaluator could just refuse, and make you say run get $: or set get $/
I'm tempted to say that's the right answer, because it seems like this will just lead to too much confusion otherwise.
That Won't Help You In "SET-WORD!" Gathering
If you can't get a "SET-WORD!" form of the slash word, the object won't collect the member.
This suggests we need to collect things inside SET-BLOCK!s for the object.
math-context: make object! [
+: infix add/
-: infix subtract/
.: infix multiply/
[/]: infix divide/
]
If you wanted to say "This has to be an action assignment" for some reason, the slash could distribute across the block's multi-return assign elements.
math-context: make object! [
/+: infix add/
/-: infix subtract/
/.: infix multiply/
/[/]: infix divide/
]