tag:blogger.com,1999:blog-19626531.post761836699948007714..comments2023-11-02T08:32:39.646+01:00Comments on Ola Bini: Programming Language Synchronicity: A very small Ruby methodOla Binihttp://www.blogger.com/profile/15793488672952593953noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-19626531.post-75223687347028175332007-03-23T03:37:00.000+01:002007-03-23T03:37:00.000+01:00Of course it does. As he said, it's an alias to i...Of course it does. As he said, it's an alias to instance_eval, in effect. That's why I'd prefer not to make the alias, since 'with' implies a slightly different funcitonality.Bughttps://www.blogger.com/profile/13357464368588908875noreply@blogger.comtag:blogger.com,1999:blog-19626531.post-72964073821431637962007-03-08T23:14:00.000+01:002007-03-08T23:14:00.000+01:00I love this. Very cool. My only concern is this al...I love this. Very cool. <BR/><BR/>My only concern is this allows blocks to access member variables directly [due to the use of instance_eval]<BR/><BR/>so if class A has a member @a...<BR/><BR/>with (A.new) do<BR/> @a = 'something else'<BR/>end<BR/><BR/>executes fine. This worries me.Nigel Thornehttps://www.blogger.com/profile/07280667421574609074noreply@blogger.comtag:blogger.com,1999:blog-19626531.post-22529392973921748602007-01-03T00:38:00.000+01:002007-01-03T00:38:00.000+01:00This is somewhat like the #returning method in Rai...This is somewhat like the #returning method in Rails' ActiveSupport library:<br /><br /> def returning(value)<br /> yield(value)<br /> value<br /> end<br /><br />You use it like:<br />returning obj { |obj| obj.mutate! }<br /><br />It's essentially the K combinator for Ruby. I like the #returning approach better as it avoids using #instance_eval.Anonymoushttps://www.blogger.com/profile/08008708529127054655noreply@blogger.comtag:blogger.com,1999:blog-19626531.post-47989872127874451452006-12-14T16:21:00.000+01:002006-12-14T16:21:00.000+01:00Neat trick! It's not really fancy Ruby or anythin...Neat trick! It's not really fancy Ruby or anything, but it's a cool application of the syntax that's been there all this time. Props.Daniel Spiewakhttps://www.blogger.com/profile/17323566514229790079noreply@blogger.com