Make Function! Must Change

Carl Sassenrath, CTO
REBOL Technologies
8-Apr-2006 22:39 GMT

Article #0003
Main page || Index || Prior Article [0002] || Next Article [0004] || 1 Comments || Send feedback

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
    MAKE type spec

     Constructs and returns a new value.
     MAKE is an action value.

     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:

  1. 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).

  2. 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.


Updated 24-Jun-2024 - Edit - Copyright REBOL Technologies -