On Oct 26, 2:16 pm, John Firebaugh <[email protected]> wrote:
> What's the downside to requiring each literalizing method to take the
> expression as the first and only argument?

It breaks backwards compatibility.  In this case, that is a concern,
but not a huge one.

The implementation of the literalization methods is probably slightly
nicer in the cases in which they currently accept multiple arguments,
but that's really a minor issue.

> We basically just want to mimic what we'd get in a language with
> multiple dispatch -- calling one of a family of member function based
> on the runtime type of the argument.

Doesn't the current polymorphic approach accomplish basically the same
thing?  It calls to_s on the SQL::Expression instance, which does
different things depending on which subclass of SQL::Expression the
instance is an instance of.

Your approach will not be handle the case if you want to subclass an
existing expression class and modify it to literalize differently,
which the current polymorphic approach will currently handle just
fine.

Honestly, I think it would be cleaner to use polymorphic approach for
all objects, not just SQL::Expression instances, but that breaks with
Sequel's ideals of making the fewest changes possible to the core
classes (and never requiring the changes it makes to the core classes
by default).

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to