I think this will work so I'm going to try it.
Objective
=======
We want to get rid of ?name in patterns, but I don't want to break anything.
Yet. Well actually I love breaking stuff .. :)
Transitional
==========
So I am going to try this: match .. with
| Some x => ....
The pattern here is called an applicative pattern, because it looks
like a function application. If you write an applicative pattern
and the argument is a name, it will be interpreted as a pattern variable.
If the argument was meant to be a constructor instead, you must
write this:
| Some #Empty =>
This WILL break some code, but hopefully not much. In a non-applicative pattern,
you must still write
| None => // a constructor
| ?v => // a variable
however you can write
| #None =>
and you should transition to that everywhere because eventually it will be
mandatory,
and plain "v" will mean "pattern variable".
Note: you can also write this:
| Some (Empty) => ...
instead of
| Some #Empty
However that will only work in the transitional period.
[There is a caveat. It is clear that
| Some List::Empty
should be allowed but it isn't. You have to write
| Some #List::Empty
even though there is no possibility of List::Empty being considered a variable.
This is because a simple identifier is a qualified name, and I cannot
distinguish
them (at the moment). I think I can fix that but I won't try until after testing
the above transitional code.]
--
john skaller
[email protected]
http://felix-lang.org
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language