Currently the 3 concrete concepts prec, default and > are used to declare relative precedence and parse syntax.
prec a is default if no relative precedence is defined for a. Relative precedence if defined like
let (prec a) > prec b
or the precedence can be greater or less than the default precedence
let (prec a) > default
or
let default > prec b
Problems with this approach
Requires 3 new concrete concepts just for this one feature
Syntax slightly verbose
The idea of a default value that a concept implicitly reduces to if it is not known to be greater than or less than anything else is logically difficult to deal with and has led to an awkward implementation
Alternative 1
Replace the use of let (prec a) > prec b with let a preceed b. Instead of requiring prec and > as concrete concepts, only one, preceed is needed
Can define concepts with minimum precedence:
let ((_x_ exists_such_that) let preceed _x_) -> false
Without the default concept it will be tedious to write any syntax because a sufficient number of precedence relations will be needed to be defined for each concept by the user.
Alternative 2
a preceed b can be syntactic sugar for (prec a) > prec b with
let (_x_ preceed _y_) -> (prec _x_) > prec _y_
so preceed doesn't need to be a concrete concept.
Whenever a new concept is referenced in a let command, if there is ambiguity in the grouping of the syntax and explicitly, in the sense that it will be stored in the snapshot, setting the new concept's precedence as default will resolve this ambiguity then the new concept's precedence will be set as default
This should not make the user's experience more tedious like Alternative 1 and will maintain a useful property of the interpreter that no decision based on something not being known or not (this will help an advanced cache invalidation and the future module system)
How it works now
Currently the 3 concrete concepts
prec
,default
and>
are used to declare relative precedence and parse syntax.prec a
isdefault
if no relative precedence is defined fora
. Relative precedence if defined likeor the precedence can be greater or less than the default precedence
or
Problems with this approach
Alternative 1
let (prec a) > prec b
withlet a preceed b
. Instead of requiringprec
and>
as concrete concepts, only one,preceed
is neededWithout the
default
concept it will be tedious to write any syntax because a sufficient number of precedence relations will be needed to be defined for each concept by the user.Alternative 2
a preceed b
can be syntactic sugar for(prec a) > prec b
withso
preceed
doesn't need to be a concrete concept.Whenever a new concept is referenced in a
let
command, if there is ambiguity in the grouping of the syntax and explicitly, in the sense that it will be stored in the snapshot, setting the new concept's precedence asdefault
will resolve this ambiguity then the new concept's precedence will be set asdefault
This should not make the user's experience more tedious like Alternative 1 and will maintain a useful property of the interpreter that no decision based on something not being known or not (this will help an advanced cache invalidation and the future module system)