I'm about to yank all the type dependent code out of the
compiler. Some changes include:
(a) eliminating pattern matching for integers, floats, and strings,
including singles and ranges.
This is no loss. For example
match x with
| 1 => ..
can be replaced by
match x with
| ?a when ?a == 1 => ...
In fact you can write:
match x with
| $(expr) => ...
for that where expr = 1. This works for any value.
Ranges are obviously handled the same way.
So now, matches can be done on a literal of any kind:
match x with
| literal => ...
now means
| $(literal) =>
which means
| ?a when a = literal =>
So this fully generalises pattern matching on value literals.
Hardcoded support for literals like "integers" will be removed.
This MAY lead to some run time errors or C++ compiler errors
that Felix might have caught previously.
The only hassle is constant folding. We really don't care much
about 1 + 2 = 3. We need "x" "y" = "xy" though (doing that at
run time is slow).
But the BIG one is constant expressions of boolean type used
to fold away constructions: Felix guarantees
if true then x else y endif
will reduce to just x *before* type checking. And so
if x - x == 0 then ..
MUST reduce properly. So we do need constant folding.
The way I shall do this is .. user defined Scheme code.
For a literal, the user must now define:
1. a regdef/literal construction in the grammar
2. A function to convert the lexeme to a convenient internal value,
which must be a string
3. A function to convert the internal value to a C representation
4. A felix type name (which the use must define in the library).
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language