Make Function! Must Change
There is a long-time inconsistency in REBOL's implementation of make that will be changed in REBOL 3.0. (But, it will have very little affect on most programs.)
If you ask REBOL about the make function, it responds like this:
>> ? make
USAGE:
MAKE type spec
DESCRIPTION:
Constructs and returns a new value.
MAKE is an action value.
ARGUMENTS:
type -- The datatype or example value. (Type: any-type)
spec -- The attributes of the new value. (Type: any-type)
So if that is true, then how can the line below be valid?
f: make function! [a] [print a]
In this example make is given three arguments, but the function's
interface specification only describes two arguments, type and
spec.
This will change in REBOL 3.0. Here's why it must
be done:
- A program must be able to precisely rely on function interface
specifications. This is important not only for things like debugging
tools, but also for proper reflection (code to data back to code).
- The older approach required a nasty hack in the implementation of REBOL
evaluation to "spoof up" the extra argument. Removing it will simplify
the code and increase the speed of REBOL.
The new form of make function will be:
f: make function! [[a] [print a]]
This is consistent with the interface specification.
How will this change affect compatibilty? Very little. Most programs do
not use this form of function creation; they use the helper functions
func, function, does, or has.
1 Comments
|