A Proposal To Magically Remove 'params'
ry dahl
ry at tinyclouds.org
Mon Sep 3 07:39:59 EDT 2007
> I don't like the idea of my code having to be *parsed* to add magic
'parsed' isn't the right verb here. ParseTree isn't opening up the
file, reading in a string, and parsing it. It just traverses the
internal node structure that Ruby has already built up.
ParseTree tree does not have a method to simply return the parameters
of a method (a constant time operation) - it traverses the structure
of the entire method (linear in the size of the method - I guess). A
custom extension to return the parameters would take a method object,
and follow two node pointers before coming to a linked list of the
parameter symbols (more or less - I think - I haven't done it yet).
> and I
> wouldn't be confident that it would work in all cases (e.g. what about if I
> put controller actions in a module and mix them in? What if I define
> controller actions dynamically at runtime, e.g. based on reflecting the
> database?)
All of these cases can be handled correctly. It's not as complex as
you're thinking :)
I will write the extension this week and then you can evaluate it.
ry
More information about the Merb-devel
mailing list