[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Little Things

Gavin Kistner

1/4/2007 4:52:00 PM

From: ara.t.howard@noaa.gov [mailto:ara.t.howard@noaa.gov]
> i think you guys underestimate the difficulties requiring
> certain methods imposes. let's just say you wrote, oh,
> an xml generator using ruby's cool method_missing feature.
> now, you cannot easily have any xml tags that look like
> this
>
> xml.ancestors{ 'oops' }
> xml.class{ 'oops' }
> xml.display{ 'oops' }
> xml.extend{ 'oops' }
> xml.freeze{ 'oops' }
> xml.id{ 'oops' }
> xml.method{ 'oops' }
> xml.new{ 'oops' }
> xml.send{ 'oops' }
> xml.taint{ 'oops' }
> xml.type{ 'oops' }

Thank you for this; despite following this thread (including reading all
of Trans' posts) I had no idea what this 'keyword' bit was that he was
talking about.

My personal opinion:
DSLs are nice and all, but Ruby the language *also* needs to be designed
for...Ruby code. I find the Pervasives concept terrible. If we have
"Pervasives.send", and 'send' and 'new' are in the same boat, then
consistency would require code like:
my_foo = Pervasives.new( Foo, :bar )
which is insane, in my mind.

You're basically saying, "Anything that is unique to a class you call as
a method using dot notation. But the most common methods...stuff that
glues all objects in the same pool...well, that's not a method of the
object anymore." That's backwards, IMO.

I don't like the idea of __method names, either. It's a pain to type,
and I find it ugly.

If you want a DSL with method_missing, make a truly BlankSlate base
class. Go grab the methods you need and re-bind them under other names
if you must, for your (fun, awesome) crazy metahackery.

1 Answer

Ara.T.Howard

1/4/2007 5:38:00 PM

0