From: Jeff Wood Date: 2005-10-21T01:03:02+09:00 Subject: Re: Method annotation and anonymous functions ------=_Part_5377_16232210.1129824179155 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I agree with you that it is nice and clean, and to me punctuation, methods, keywords ... all the same ... so, yeah if somebody wants ann or attrib or whatever, that's fine ... but, having to pass a symbol for the wrapping function is bogus. You are inside the declaration of the function, that should be enough. ... There are methods in Kernel to tell what method you are inside ... Use those inside your attrb or whatever function so that people don't have to deal with that ... It's just another source of confusion when somebody forgets to update a symbol on their attributes. anyways. I agree, I absolutely love ruby's syntax ... I wouldn't trade it ... and if there's a method that'll do the attributes cleanly, then I'm all for it ... I don't *want* the punctuation, I just figured it was cleaner ( but cleaner doesn't mean clearer ) ... but, matz is *almost* ;) always righ= t in his decisions ( all respect intended ). j. On 10/20/05, Bob Hutchison wrote: > > > On Oct 20, 2005, at 7:47 AM, David A. Black wrote: > > > Hi -- > > > > On Thu, 20 Oct 2005, Jeff Wood wrote: > > > > > >> It's really a VERY cool idea. I really hope it makes it in. I know > >> most people seem to hate adding a little punctuation ... but > >> sometimes > >> it can be a good thing. > > What punctuation has to be added? I like the way it is done in the > example. > > >> > > > > The thing is, I've spent literally years watching literally dozens and > > dozens of things being suggested, *all* of which involve new > > punctuation and all of which someone thinks are good ideas. If even a > > tenth of them were adopted, Ruby would be about 90% of the way to > > being in the Perl bracket of punctuation intensity. > > > > I know it sounds strange, but I actually consider the clean line of > > Ruby a "feature" (albeit an optional one, as to its use :-) which > > counts for more than almost every RCR imaginable to me. > > I agree about the syntax. The example that Tran provided doesn't > require new syntax, it works, and it does something that I think is > *very* useful. I'll reproduce his example here: > > >> class X > >> def foo ; "foo" ; end > >> ann :foo, :returns =3D> String > >> end > >> > >> X.ann :foo, :log =3D> true > >> > >> X.ann.foo.returns #=3D> String > > This is simple and so unexpected, to me at least, that it seems > brilliant (forget the :returns bit, it is irrelevant). I think I'm > still not used to what can be done with the mixing of compilation and > runtime in ruby. > > I tried writing a toy implementation of this last night to see if > it'll solve a problem that I'm going to have to deal with soon. I'm > working on a system that automatically augments class definitions and > this is a great way for a programmer to provide additional hints and > fine-tuning control -- in fact, this opens up a lot of possibilities. > The implementation I came up with requires that include/extend trick > that Robert Klemme mentioned in the "class method aliasing" thread > the other day, but still. I'll soon cheat and look at what nitro and > facets did. > > Cheers, > Bob > > > > > > > David > > > > -- > > David A. Black > > dblack@wobblini.net > > > > > > ---- > Bob Hutchison -- blogs at > Recursive Design Inc. -- > Raconteur -- > > > > -- "http://ruby-lang.org -- do you ruby?" Jeff Wood ------=_Part_5377_16232210.1129824179155--