Luke Palmer wrote:
Of course, exactly how this "public interface" is declared is quite undefined.

Reading this thread, I find myself wondering how a resumable exception differs from a dynamically scropted function. Imagine this code:

sub FileNotWriteable( Str $filename ) {
  die "can't write file: $filename";
}

sub write_file (Str $filename)  {
  FileNotWriteable($filename) unless -w $filename;
  ...
}


sub my_program {

  temp sub FileNotWriteable( Str $filename ) {
    return if chmod "+w", $filename;
    OUTER::FileNotWriteable( $filename );
  }

  ...
  write_file("foo.txt");
  ...
}


Ignoring syntactic sugar, what semantics does exception handling have that a dynamically scoped function does not?

In the case of non-resumable exceptions, we see things like deferred handling -- the exception is passed as a property of an undef value. I assume such an exception cannot be resumed, so it does appear to me that there are fundamental differences between resumable things, and non-resumable, deferrable, exceptions. What is the benefit of unifying them under a common syntax (CATCH blocks)?

Larry suggested that the exception mechanism might be a way of unifying errors and warnings; but perhaps the opposite is true. Perhaps what we see is a needed to generalize the distinction between warnigns and errors.


Dave.

Reply via email to