Looks Like FILE! Immutability Is A Good Idea

Another thing to consider here is what to do when the variable is not literal.

>> varname: "my_var"

>> read env://???

Schemes might do some kind of auto-composition, so the ENV scheme could interpret env://(varname), but since not all schemes do that it would be up to the scheme to do it. At least with modern binding in Revolt it's possible.

>> varname: "my_var"
== "my_var"

>> compose env://(varname)
== env://my_var

(not possible in Rebol2, R3-Alpha, Red, or the other variants...)

Although I should say it's possible with caveats. Currently string types don't carry their own bindings, so a function like COMPOSE is using the binding of the callsite. This means that if you passed just env://(varname) as an argument to a function it couldn't be evaluated by the callee.

Anyway, we could say that URL! has evaluator behavior...but then you'd have to evaluate it, vs. just pick it out of a location:

>> url: second [<something> env://(varname)]
== env://(varname)

>> get url
** PANIC: URL! doesn't have binding

We could get into binding URL!s which would start looking like:

>> url: pick [<something> env://(varname)] '$2  ; alias as SECOND$ ?
== env://(varname)  ; bound

>> get url
== "MY-VARIABLE-CONTENTS"

But there's a lot of speculation in that. Up until now I've said strings should not carry bindings, but... :man_shrugging:

1 Like