forked from rebolsource/r3
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom infix operators via <infix> in spec, kill OP!
This provides the ability to make arbitrary infix functions. This is for both user code and to simplify the creation of Rebol's default infix operators as mezzanines. It introduces <infix> as the first case of a function "attribute", which you put at the start of a spec: +: func [<infix> value1 value2] [add value1 value2] The INFIX attribute is implemented as one of the value-specific option bits in the Rebol header, which previously is where OP! would store its "actual type" of the function it was wrapping. The OP! datatype has been killed, and a new infix? test replacing OP?. (Note: an OP? implementation is temporarily provided, with the traditional behavior of tolerating any type whether function or not.) The infix mezzanines will perform slightly slower than their old OP! counterparts would, as they are functions with Rebol code bodies that execute vs. just a trampoline to the C code. However by being "just a bit" on the spec, it means infixness would be able to be applied to any speedy mode of specialization or function aliasing that gets implemented...which is a general need and will have to be written to turn :append/only into a "refined" function (for instance). In the meantime, the mezzanines are at least partially "compiled" with the literal NATIVE! value they wrap.
- Loading branch information
1 parent
367ac2d
commit cfae703
Showing
22 changed files
with
293 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.