Custom infix operators via <infix> in spec, kill OP! #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 as the first
case of a function "attribute", which you put at the start of a spec:
The INFIX attribute is implemented as one of the value-specific
option bits in the Rebol value 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.