On Wed, 2007-10-03 at 11:52 +0200, kirillkh wrote:
> 2007/10/3, skaller <[EMAIL PROTECTED]>:
>         On Wed, 2007-10-03 at 10:37 +0200, kirillkh wrote:
>         > That's interesting. Why didn't you use the version with the
>         second
>         > exception? The whole point is that it allows to avoid
>         variant
>         > allocations on the common code path. Do you have the same
>         problem with 
>         > polymorphism in exceptions in Felix?
>         
>         There's no problem of any kind with exceptions in Felix...
>         Felix has no dynamic exception handling at all.
> 
> What do you do with division-by-zero or out-of-memory errors, then? 

I think division by zero creates + or - inf for floats.
For integers, it  does whatever the underlying compiler
does, probably abort the program in C++.

Out of memory depends on how you obtain the memory.
If you use the system allocator, it aborts the program.
If you call malloc() directly, you get a NULL pointer
as usual.


>         [It does have 'non-local goto', which is a delimited
>         continuation]
> 
> Can you show the same code with a delimited continuation in Felix?
> (analogous to oleg's take of it)

What do you mean 'the same code'? :)

Below is a tutorial example:

/////////////////////////////////////
var x = 1;
proc run()
{
  proc check()
  {
    if(x!=1) goto bad_x;
  }
  check();
  print "good x"; endl;
  x = 2;
  check();
  print "good x"; endl;
  goto finished;

bad_x:>
  print "bad_x"; endl;

finished:>
  print "finished"; endl;
}
run();
//////////////////////////////////////

You can pass 'check' to any procedure and call it.
The point is, there is no way to fail to 'catch'
the 'exception'.


> Umm, well, unfortunately, I'm not entirely clear on the whole
> delimitation thing 

Neither am I :)

> (read: I have no idea what it is, despite attempts to read oleg's
> papers). But I agree that undeclared exceptions that just get thrown
> out of nowhere are frequently not most pleasant (though they do save a
> lot of typing in some cases). My attempt to use an exception for
> fold_file wasn't constrained by having general-purpose exception
> polymorphism. The way oleg restated it in the list is just great if it
> works - especially since it avoids global declaration of the exception
> that is only used inside a single func.

I will read it .. haven't got to it yet.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to