On Friday, October 4, 2013 1:20:40 PM UTC-7, John Anderson wrote:
>
> Hey 
>
> I've been doing some work with ASTTransformer which is really useful. It 
> would be even more useful if it had something like this in the v method: 
>
>     when Sequel::Dataset 
>       opts = v( obj.send(:opts) ) 
>
>       # preserve row_proc and other stuff 
>       dataset = obj.clone 
>
>       # reset opts after clone, because clone does a merge, so 
>       # opts which were removed by the transform process will 
>       # still be there in the new dataset. 
>       dataset.instance_variable_set '@opts', opts 
>       dataset 
>
> Reason being you can then pass a dataset instance into an ASTTransformer 
> subclass and get back another dataset. It will then also handle nested 
> datasets, ie datasets with a dataset as the value of the :from opt. I 
> beat my head on those two for a while... ;-) 
>

Isn't the above equivalent to:

  when Sequel::Dataset
    obj.clone(v(obj.opts))

I'm not sure this is a wise default for ASTTransformer itself, though.  I 
can see at least Dataset#qualify not doing the correct thing in this case.

Note that handling Sequel::Dataset in a subclass of ASTTransformer may be 
fine, but you'll probably want transformer specific behavior in those cases.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to