G
Gavin Sinclair
Hi,
So far as the search engine on this newsgroup is concerned, there's
been no discussion about including a Common Lisp-style condition
system in a future version of Ruby. For information about these, [1]
is a good readable resource.
For those who don't know what they offer above normal exception-
handling (as we know it in Ruby, Java, C++, ...), conditions need not
be errors and they need not unwind the stack. A low-level function
can signal that something is wrong, and provide multiple ways of
handling it (which is appropriate, because the handling code is low-
level). A high-level function can receive the signal and choose which
low-level handler to run, or can "handle" it itself or ignore it (the
latter two options being what's available in Ruby etc.). Another good
example is low-level code issuing a warning and higher-level code
deciding whether to print it. It's _very_ elegant.
For those who _do_ know about Common Lisp conditions, is there any
appetite for them in Ruby? I see great positives and no negatives.
They don't seem at all un-Ruby-like; in fact the relationship between
high- and low-level code reminds me of the elegance of blocks and
yield.
After a small amount of thought, I haven't come up with a suitable
syntax. That's probably because I haven't used the things, only read
about them.
Just curious about people's thoughts, and quietly hopeful for Ruby
2.0
Gavin
[1] http://gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html
So far as the search engine on this newsgroup is concerned, there's
been no discussion about including a Common Lisp-style condition
system in a future version of Ruby. For information about these, [1]
is a good readable resource.
For those who don't know what they offer above normal exception-
handling (as we know it in Ruby, Java, C++, ...), conditions need not
be errors and they need not unwind the stack. A low-level function
can signal that something is wrong, and provide multiple ways of
handling it (which is appropriate, because the handling code is low-
level). A high-level function can receive the signal and choose which
low-level handler to run, or can "handle" it itself or ignore it (the
latter two options being what's available in Ruby etc.). Another good
example is low-level code issuing a warning and higher-level code
deciding whether to print it. It's _very_ elegant.
For those who _do_ know about Common Lisp conditions, is there any
appetite for them in Ruby? I see great positives and no negatives.
They don't seem at all un-Ruby-like; in fact the relationship between
high- and low-level code reminds me of the elegance of blocks and
yield.
After a small amount of thought, I haven't come up with a suitable
syntax. That's probably because I haven't used the things, only read
about them.
Just curious about people's thoughts, and quietly hopeful for Ruby
2.0
Gavin
[1] http://gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html