[Borges-users] RenderNotification considered harmful
Kaspar Schiess
eule at space.ch
Fri Apr 30 05:46:05 EDT 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Слепнев Владимир wrote:
| Maybe I'm wrong in posting patch suggestions here? Maybe there should be
| some mechanism of Eric approving patches or rejecting them? I just don't
| know.
|
| I have removed the RenderNotification class from my Borges copy.
| Rationale: Ruby's raise/rescue mechanism is intended for error handling,
| not control flow. (What if someone does 'rescue Exception'?) For control
| flow, Ruby has throw/catch (which isn't subject to 'rescue', but honors
| 'ensure'). Also, throw/catch is used with a string or symbol, while
| raise/rescue uses an exception class; having a dummy exception class
| smells of Java to me. Also, the syntax for catch is in our case simpler
| than the syntax for rescue, execution just continues from the end of the
| catch block:
|
| def render
| catch :RenderNotification do
| [snip]
| end
| end
|
I agree with you. Good suggestion, nice idea. Can you formulate a patch ?
| (Actually, this mechanism is a little flawed too. I stumbled upon this
| when trying to use DBI. It has a connect method which takes a block, and
| disconnects after the block finishes; wrapping a Borges::Controller#call
| in this doesn't work, apparently because DBI uses rescue/ensure to
| disconnect, and Borges uses exceptions for control flow.)
The old one had that flaw also. I currently get the result list and then
~ disconnect. There will have to be some work on this.
- --
kaspar
semantics & semiotics
code manufacture
www.tua.ch/ruby
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFAkiBdFifl4CA0ImQRAncTAJ9MBYythThl0KzDdRtjVMgkVKIHzgCbBK5C
SUhIQ2GwAidMiWquap/1Tsc=
=yla0
-----END PGP SIGNATURE-----
More information about the Borges-users
mailing list