You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a stable method is invoked with a constant argument, a macro gives it the opportunity to be evaluated at compile time, producing a literal phrase in response. If the arguments have any non-singular enumeration types, the macro aborts.
Instead, at compile time we could invoke the method for each value, since it’s stable. If all runs succeed, we can then narrow the semantic restriction to be the enumeration of each of the produced values, substituting a literal phrase if all invocations produced the same value. We could also collect the inputs and outputs into a map, and produce a send phrase that simply looks up the answer.
Use case:
c : ¢[A-Z]ᵀ;
i ::= c’s code point;
The current Avail behavior is for i to be typed [0..1114111]. I’d like it to be [$A’s code point..$Z’s code point].
I guess a stronger semantic restriction in this one case would be enough.
We could make the above behavior be an implicit part of the compiler, as long as we tagged method signatures and raw functions as stable. Then even methods like map_through_ could be marked stable, but abort the macro if it detects the transformation function's raw function isn’t stable.
The text was updated successfully, but these errors were encountered:
When a stable method is invoked with a constant argument, a macro gives it the opportunity to be evaluated at compile time, producing a literal phrase in response. If the arguments have any non-singular enumeration types, the macro aborts.
Instead, at compile time we could invoke the method for each value, since it’s stable. If all runs succeed, we can then narrow the semantic restriction to be the enumeration of each of the produced values, substituting a literal phrase if all invocations produced the same value. We could also collect the inputs and outputs into a map, and produce a send phrase that simply looks up the answer.
Use case:
The current Avail behavior is for i to be typed
[0..1114111]
. I’d like it to be[$A’s code point..$Z’s code point]
.I guess a stronger semantic restriction in this one case would be enough.
We could make the above behavior be an implicit part of the compiler, as long as we tagged method signatures and raw functions as stable. Then even methods like
map_through_
could be marked stable, but abort the macro if it detects the transformation function's raw function isn’t stable.The text was updated successfully, but these errors were encountered: