With the new reachability algorithm, it's necessary to find non-returning
procedures such as "exit()".
I propose to do with with a type:
t -> any
Normally a procedure has type
t -> void
meaning "returns no value". The type "any" is defined by:
typedef any = any;
Since any type, eg "int" satisfies this equation, even "void",
a function returning any could return any value at all.
Since this is nonsense, we conclude that such a function
cannot return at all.
A function returning any should be usable both as a procedure:
fun exit : int -> any= "exit($1)";
f();
or as a function:
match x with
| 1 => exit 1
| 2 => 42
endmatch
The idea is that "any" unifies with "int" (or any other type).
You probably shouldn't do this:
val a = exit 1;
This is only an experiment. Note that "exit($1)" doesn't have
a semicolon in the quotes, so it's modelled as a function;
if used as a procedure the compiler has to add the ";" for you.
We'll see if this works out.
--
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