Jeremy Evans wrote:
> Doing the following:
> 
>   DB << "create table t (a text, b text)" << "insert into t values
> ('a', 'b')"
> 
> Wouldn't be any different from:
> 
>   DB << "create table t (a text, b text)"
>   DB << "insert into t values ('a', 'b')"
> 
> In terms of what is sent to the database.

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.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

--~--~---------~--~----~------------~-------~--~----~
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