From: Ben Giddings Date: 2003-08-07T07:56:26+09:00 Subject: Re: What's New and Shiny in Ruby 1.8.0? On Wed August 6 2003 6:29 pm, why the lucky stiff wrote: > Ruby/DL is now covered. Prototyping functions, casting into structs, and > pointer math! Everything you never wanted to do in Ruby but can! :) That's a really great page you have, some things that might help clarify: Regarding LocalJumpError, my understanding is that the problem with return ( x > 25 && y > 25 ) is that because it's a block and not a proc, it is trying to return to the context at the end of add_click_handler, which may be defined somewhere really far away from where you use simulate_click. What you want instead is for it to go here: "return false unless h.call( x, y )". If instead of using "return" you just go to the end of the block, that's what will happen, and the return value will be the value of the last expression evaluated. If my understanding is correct, that might be some good text to put on there to make it clear what Ruby is trying to do, compared to what you want it to do. Another suggestion for initialize_copy is to use a value that would be bad to copy using .dup, for instance a "password" field. If it weren't cleared, then by default the new Person would have the same password as the previous person. Using initialize_copy would allow you to make sure that .dup doesn't dup someone's password too. I think it would also be a good idea to note that this breaks the convention of what .dup does, in that it no longer provides a true duplicate of the other object, so that it should be used carefully. My suggestion would be that it might decide not to copy over certain details, but that it never creates new details "out of thin air". Using Time.now like this kind-of breaks this exception, but it seems like an acceptable deviation from the rule... so long as this odd behaviour is documented. :) Ben