On Sep 3, 10:45 am, Joel VanderWerf <[email protected]> wrote:
> I was thinking in terms of ruby style rather than how queries are sent
> to the database, but I can't really come up with any strong sylistic
> reasons, other that "that's how most[1] other #<< methods work", which
> is pretty weak!
>
> Maybe that argument, weak as it is, would be best stated in terms of
> duck typing. If you write code like this:
>
> def send_command_to_destination(dst, cmd)
>    # log cmd and dst
>    # do some other generic stuff
>    # ...
>    dst << cmd
> end
>
> Then wouldn't you want the return value to be dst, whether dst was a
> pipe or a database or simply an array used to accumulate commands? Just
> in case someone's code was written for pipes, and someone else wanted to
> use a database instead...
>
> [1] Fixnum#<< is an exception, of course. But IO, String, Array are not.

Doesn't << server a different purpose for those classes (to store more
items as opposed to executing code)?  I just don't see this happening
in the real world.  If you really need it, it's not hard to add:

  def DB.<<(sql)
    super
    self
  end

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