As part of Rebol's contention-for-short-names problem, there are many instances where refinements have names like :ALL where they conflict with common natives or lib functions.
When this happens, I tend to do something to name them out of the way and put the lib function back:
foo: function [
bar [block!]
:all "foo all the bars"
][
all_FOO: all
all: lib.all/
...
]
Clearly we need a better pattern.
Maybe there could be two features that work together on this. One would be the ability to ask that the function's frame be passed in as a variable, and another would be to suppress binding of an argument in the body.
foo: function [
bar [block!]
<hide> :all "foo all the bars"
<frame> f
][
all [...] ; would be the ALL from LIB
if f.all [print "Fooing all the bars"]
]
It's already kind of necessary to be able to get the FRAME! of a function into a variable (asking for binding of 'return is clunky, and you have no way of doing it with a lambda that has no parameters or locals). Then the dot could mark arguments as being "member-access-only" via the dot.
I think this is better than trying to name things out of the way. It could work for normal arguments too:
foo: function [
<hide> bar [block!]
<hide> :all "foo all the bars"
<frame> f
][
; use f.bar and f.all, with BAR and ALL left as-is
]
It might not be the most beautiful thing in the world, but this is a real problem that is very frustrating when it comes up. And when you encourage people to play with words, they shouldn't be afraid to reuse them in refinements if they make sense.
Objections? Better ideas?
![]()
Maybe we could use TUPLE! to do it?
foo: function [
.bar [block!]
:.all "foo all the bars"
<frame> f
][
; use f.bar and f.all, with BAR and ALL left as-is
]
It's a little hard to see on refinement args, but it would help hint "you are supposed to use dots".
We'd want it to be :.all and not .:all, because the latter has no TUPLE! in it... that's a 2-WORD! CHAIN! with a dot in the first position.