REBOL 3.0

Relaxed Alias for Symbolic Equivalence

Carl Sassenrath, CTO
REBOL Technologies
28-Apr-2006 23:33 GMT

Article #0013
Main page || Index || Prior Article [0012] || Next Article [0014] || Post Comments || Send feedback

In REBOL 3.0, we're going to relax the alias requirements.

Background: An alias is a symbolic equivalent for a word. Normally, aliases are used to make uppercase and lowercase words equivalent (which is done internally and automatically in REBOL).

For example, you can write:

if time > now [...]

or

IF Time > now [...]

Those expressions are identical. This comparison is true:

'if = 'IF
true

In prior versions, if you wanted to define an alias for a word, you had to be careful about it. The word could not already be used (in any way at all). You would create a word alias with a line such as:

alias 'if "fi"

After that, fi means the same thing as if. This expression is true:

'if = 'fi
true

and you could write:

fi time > now [...]

Beginners should note that the use of alias is not the same as sharing the value of the words. The above is not the same as:

fi: :if

See the manual for more on that.

As you experts know, alias equivalence is rarely needed, but it is important in some cases when words are used symbolically, such as:

'if = first [fi]

or within a path:

path/fi

REBOL 2.0 had restrictions on how aliases could be defined. An alias would be rejected if a word had already been used (in any way at all).

In 3.0, we will relax that requirement and you can write:

alias 'if 'fi

even if fi has appeared earlier.

Note, however, that you still must use alias with great care. If you defined contexts (modules, objects, functions) that use the aliased word before you defined the alias, well... then, you're going to have some problems because you've changed something very fundamental: the most basic meaning of the symbol.

This 3.0 change is by no means final. We'll have to see how it goes, and we may need to revert to the 2.0 method. But, I wanted to mention it to you. Let's give it a try.

Post Comments

REBOL 3.0
Updated 24-May-2017 - Edit - Copyright REBOL Technologies - REBOL.net