Re: Little Things

From: [email protected] [mailto:[email protected]]

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.

On Fri, 5 Jan 2007, Gavin K. wrote:

xml.taint{ ‘oops’ }
consistency would require code like: my_foo = Pervasives.new( Foo, :bar )
which is insane, in my mind.

two points, after noting that i quite agree with you.

  1. there are already a ton of dsl’s written in ruby. all of them have
    small
    unrepairable bugs caused by naming issues.

  2. Pervasives.send would ONLY be used when some was doing metahackery,
    designing dsls, a debugger, profiler, memory leak detector, etc. the
    alternatives are:

    a) you can’t write those things robustly

    b) you have and insance proliferation of names and can’t write those
    things
    robustly

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.

it is. for a reason: you can use it when you are doing backward things:
writing code that manages objects (debugger, etc) rather than code that
is
managed by objects (normal code). any answer that allows deep reliable
introspection must reside outside of objects. if not through
Pervasives, then
via some other external method - though syntax shortcuts might exist…

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

what’s your preferred solution?

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.

you can’t. if i undefine id, object_id, etc. and they are called: i
don’t
know why they were called: metahackery or ‘to the point’? that’s the
whole
issue.

regards.

-a