From: James Britt Date: 2004-10-16T00:58:38+09:00 Subject: Re: Eating sandwiches in the park Markus wrote: > On Fri, 2004-10-15 at 08:27, James Britt wrote: > > >>I spent a bit of time trying to create a good but short example of truly >>wack Ruby code. Given that you can override core classes and methods, >>it is fairly easy to create code that bears only a superficial >>resemblance to Ruby, requiring the user to think instead in a new, >>Bizarro world mini-language. It requires nothing that doesn't already >>exist in Ruby. Yet one does not often see this sort of code in the wild. > > > You see it (at least I do) but you don't recognize it as "a new, > Bizarro world mini-language." Why? Because it's almost always done in > the context of some problem domain that already supports it (sometimes > with a history far predating ruby, or even computers). Thus anyone who > knows the language easily switches gears without even noticing. Good point. I have some Ruby code that does XML transformations sing the REXML pullparser. I started out mapping input elements and context to new elements and context using Ruby hashes and arrays, but decided to (ironically, I suppose) use YAML, because it made it a bit easier to see that a) this was not really meant to be code as such (though of course it was), and b) the syntax a bit cleaner for expressing the associations. But there is likely an even more clear way to express the relationships, a transformation mini-language syntax, that would not be out of place in such a context. From what I gather, no one thinks it worth the effort to devise a new and arbitrary way to express common structures and behavior, but that for the unusual case, unusual syntax works quite well because you may want to explicitly encourage a mental context switch, a visual cue that tells the reader, Look, this is code, but it's special-purpose code. > > >>Truth is, the cat's out of the bag, the genie is out of the bottle, and >>the poop is out of the mouse. As new changes to the mallardability of >>Ruby are suggested, the question is not whether we want people to be >>able to do odd, weird, convoluted things; they already can. The >>question is will the changes enable or encourage odd, weird, convoluted >>things that are indeed appropriate for a given task. > > > Exactly. > > >>"Ruby: MPS-free for over 10 years!" > > > *laugh/gack* Not another TLA! Well, actually, it's YATLI (yet another three-letter initialism) James