The Return of ALIAS?

Rebol2 had a strange concept of the ability to create aliases for words:

rebol2>> alias 'append "foo"
== foo

rebol2>> foo [a b c] <d>
== [a b c <d>]

rebol2>> foo: 10
== 10

rebol2>> append
== 10

(You might wonder why it takes a string, vs. being alias 'append 'foo. The problem is that if you tried that, the fact that merely mentioning words creates variables for them in historical Rebol would mean that FOO appeared to already exist as an unset variable. The alias wouldn't override it.)

So I've actually been wondering about a more modern version of ALIAS. Because right now we have a sort of pain point on the idea that you can only create bound references to something when the names match up exactly. If you have the thing under a different name, then you have to create a proxy variable to hold the value with the right name... but then you disconnect seeing updates of the original thing.

This could be particularly useful in module imports, where currently you don't see updates if something you import changes in the module you imported from. EXPORT should likely default to providing declarations as read-only, and you should have to do something special if the importers can write a variable. But it's come up frequently (both the desire to see updates, and to be able to write and have the changes seen by the module and other importers, without going through a level of indirection like an object)

2 Likes