So here's the new code:

////
proc mythrow[T] : T  = "throw $1;";
const fred: int = "fred";

try 
  var x = 1;
  mythrow 20;
  x = 10;
catch fred : int =>
  x = 2;
  println$ "Exception " + str fred;
endtry

println$ x;
////

The reason you still have to type the variable name is ...
I don't know how else to do it at the moment.

An obvious implementation is to convert the catch code into a procedure:

proc x73735 (fred:int) { 
  x = 2;
  print$ ..
}

and then:

catch (int &exn) { x73735 exn; }

The problem with this .. and in many other similar cases is that

        return

won't work.  Felix has no frontend block concept.
This issue also impacts yield. It also changes the kind
of gotos, but Felix can handle non-local gotos.

Which suggests .. non-local returns.

Actually a block would be nice, which allowed local variables
without interfering with returns and perhaps supervisor calls,
as well as goto's into the block: the variables would be lifted out,
eliminating the block, and renamed to prevent a conflict.

Felix already has (AST level) identifier renaming routines,
the main problem with them is it makes diagnostics "down the track"
hard to understand (since you get told about identifiers whose names
were invented by the compiler .. :)

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to