At times it seems like Rebol can't decide if it's an extremely high-level language, or some kind of assembly language. It's subject to interpretation (pun possibly intended).
Certain unchecked assumptions seem like disasters ready to happen. For instance, if GET of a PATH! allows evaluation:
>> o: make object! [x: 10 y: 20]
>> value: 'o/(print "Boo!" | either condition 'x 'y | elide condition: false)
>> condition: true
>> get value
Boo!
== 10
>> get value
Boo!
== 20
The word GET does not really seem like it would have side-effects. You may not think to check that value is a PATH!. You may expect two GETs in a row to return the same thing. Etc. etc.
But if you put code as a GET-PATH! in source, it wouldn't seem so uncomfortable:
>> :o/(print "Boo!" 'x)
Boo! ; Well, I told it to say that at this exact callsite, must have meant it...
== 10
For this case Ren-C tried to straddle the line, by allowing it in the GET-PATH! and SET-PATH! cases of the evaluator but not in the GET and SET native operations. But this starts creating a drift to where GET of a PATH is not the same as a GET-PATH!. That gets tangled up pretty fast...refinements here don't line up with choices there, it feels asymmetrical and unkempt.
Is it worth the tangle? Isn't everyone just one step away from assuming that do compose [(value): ...] will work the same as if you said SET VALUE? Is there really such a difference between the "English" get 'foo and the shorthand :foo in the first place?
Rebol is for customization, should people build their own safety?
One hates to pass the buck and say "well, the user can do it". But if you're making a system that's small enough to Put The Personal Back Into Personal Computing, maybe you don't want to second guess things like what everyone would want from SET. You might guess wrong.
Ren-C's pursuit is Power to the People to address the pain points that specifically peeve them. They don't have to wait for any language implementer to do it. e.g.
set: adapt 'set [
if any-path? target [
for-each x target [if group? x [fail "GROUP! in ANY-PATH!"]]
]
; fall through to normal SET behavior
]
The SET as used by the mezzanine will keep on working. The goal is that this definition applies in whatever place you were doing your work.
They didn't have to redefine the function interface, or rewrite the HELP unless they want to. This is the essence of what we're going for. And there are ways to make it more efficient, you can implement that check as native code against the internal API if you wanted.
So is the main value consistent behavior between GET-XXX! and GET (actually GET/ANY)? Then have a GET/HARD which doesn't evaluate groups and uses them as data (e.g. set/hard 'my-map/(1 + 2): <sum>
would actually consider the GROUP! (1 + 2)
to be the key. There are other reasons this ability is important besides maps, like avoiding double-evaluations in constructs like DEFAULT that have to both GET a left hand path and SET it, and don't want to run groups twice.)
...Maybe? But not everything should be laissez-faire...
The argument above about GET works because if you don't like it, you can change it. But what happens when the very tools by which you might change things fall down on you at a basic level?
We know how quickly things go to hell if you put functions in blocks and try to enumerate them.
>> block: reduce [:print]
>> for-each i block [if group? i [print "Found a group!"]]
Found a group!
#[void]
** Script Error: if is missing its branch argument
I don't want to belabor the implications of security, here. That's another thread.
But it seems to me that if the bias on a few things were tweaked a little, it would be a big help. One thing I've written about before is the idea that GET-WORD! not mean soft quote, but mean "I can accept ACTION!s". If you leave it off, you don't...and the FOR-EACH errors. Seeing the notation for-each :i block [...] would be a visual reminder that you're dealing with an iteration that might have an i
that's an action, so you should be sensitive to it.
These are places that have to be looked at, and looked at soon. The web demo is going pretty well so far and even a bit ahead of schedule for Beta/One. But topics like this are weighty and monstrous, and there's so many of them that we would be looking at decades if they all were to be known-to-the-extent-we'll-know-them.
So in the end, what should SET do on PATH!s with GROUP!s?
I actually was going to go ahead and bias it so that SET goes ahead and runs GROUP!s in the path. Looking at the reality of the code is giving me some cold feet. As is often the case, the process of trying to reverse a change that was put in for a reason is a reminder of the motivations.
I'm going to keep thinking about it. But still, the point I raise here is a valid one. There may be a general principle that we be very selective about where we make our safety pushes--being mindful of the question of how difficult it would be for a user to customize the feature for themselves. The harder it would be, the more attention that issue should get.