[Borges-users] RenderNotification considered harmful

Eric Hodel drbrain at segment7.net
Fri Apr 30 11:16:15 EDT 2004


??????? ???????? (slepnev_v at rambler.ru) 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.

No, I really prefer that you offer suggestions and patches here, more
eyes looking at them can really help.

> 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:

Yep!  Smalltalk doesn't have catch/throw, but it was easiest to simply
implement things as Exceptions.

If anything looks odd in Borges, the reason is because it was the
simplest way of implementing things at the time, and I then moved onto a
more critical issue than making things pretty.

> (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.)

To get around this, you should be able to subclass ControllerSession and
override #start.  There may be a way to have the DBI initiated per
Application, but I'm not sure how to hook it in.

-- 
Eric Hodel - drbrain at segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/borges-users/attachments/20040430/3ef22cb8/attachment.bin


More information about the Borges-users mailing list