putting away HashWithIndifferentAccess
MenTaLguY
mental at rydia.net
Tue Sep 25 20:05:04 EDT 2007
On Wed, 26 Sep 2007 01:30:34 +0200, Julian 'Julik' Tarkhanov <julian.tarkhanov at gmail.com> wrote:
>> you're going to have to be really
>> paranoid about key names (e.g. imagine a query with a variable named
>> new_ostruct_member).
>
>>> @table[k.to_sym]=v;new_ostruct_member(k)
>
> this might already be a server crasher. you know how many unique
> to_syms you can do before the table is full?
Ah, yeah, good catch. Actually any approach which let you access
query parameters as methods would have that problem -- behind the
scenes, every uniquely named method introduces a symbol. This is
even a potential issue for approaches using method_missing, since
in MRI, rb_call wants an ID (normally obtained via rb_to_id).
-mental
More information about the Camping-list
mailing list