[E-Lang] ERTP-aware MintMaker
Jonathan S. Shapiro
Thu, 15 Feb 2001 09:43:47 -0500
Ben Laurie wrote:
> But that would mean repeating the type for complex conditions (e.g.
> :(integer >= 0 && integer < 23)), which strikes me as yukky.
Random thought, completely out of context because I haven't been
tracking this thread.
Is this something where a type predicate plus making builtin type names
be immutable identifiers would help? This would allow something like
:(x.isType(integer) && x >= 0)
Hmm. As I write that, I begin to think that the real problem we seem to
be tripping across is the fact that the qualifier expression doesn't
explicitly use the variable/parameter name, and if we could find a
simple way for it to do so we could avoid some amount of "extra" syntax.
Perhaps this might help: all primitive types have an implicit value()
operator known to the runtime. If (without changing the rest of the
syntax) we simply reify the name of this operator as a method, then we
can go back to writing something like:
: (isType(integer) && value() >= 0)
which is taken to occur within an implicit "using" block (pardon Pascal
syntax -- haven't learned E yet):
(isType(integer) && value() >- 0)
note I am assuming here that blocks return the value resulting from
their last statement.
While I'm at it, is there currently a "using" syntax in E and should
there be? I found it leant itself to confusion in Pascal, partly because
there was no scope breaking operator, but if we adopt this approach it
would certainly be nice not to need to account for it as a special-case
introduction of a semantic that wasn't elsewhere in the language.