Rebol has no keywords. It's a concept that forms a part of what makes the language so versatile—any word can be reassigned, any word can be assigned the value of a 'built-in' function—and one that in the general flow of the language holds true*. However there are notable exceptions within two of Rebol's basic structural datatypes that break that rule:
- return within a function, and
- self within an object.
There has been some discussion in the Rebol and Red chat room as to possible ways to build functions and objects where these words are not predetermined, my question alludes to my best understanding of that discussion: Is there an approach to removing the special qualities of these words that'd work while retaining the characteristics of each type? Take for instance:
document: make object! [
title: none
rename: function [title][self/title: title]
]
essay: make document []
essay/rename "My Document"
In the above example, we might wish to replace self
with this-document
:
document: object/self [
title: none
rename: function [title][this-document/title: title]
] 'this-document
How would this propagate to derivative objects without requiring a special word to keep tabs?
essay: make document [probe this-document]
essay/rename "My Document"
What would be the best way to express this word? The above, or something like:
document: object [self: 'this-document][
title: "Untitled"
rename: function [title][this-document/title: title]
]
Using a two-argument approach to creating objects opens the possibility that we could add more qualities to an object: type-checking certain fields, hidden or protected fields—but all of this would somehow have to be tracked within the base object structure as well.
* Dialects within Rebol—such as parse
—do contain keywords, but the parse dialect is not processed by the Rebol evaluator, it's its own sub-language.