Abstract Database Interface

Jacob Carlborg doob at me.com
Tue Oct 30 07:44:45 PDT 2012


On 2012-10-30 10:59, Philippe Sigaud wrote:

> && and || can be replaced by & and |, so there is a workaround.
> I feel much more limited by != and, even more problematic, !.  Maybe
> unary - could be used in lieu of !.

How does that work with operator precedence? There's a plugin for 
ActiveRecord, called Squeel,  that allows you to do something like this:

Person.where do |q|
   (q.name == "asd") &
   (q.address == "foo")
end

But because of the operator precedence in Ruby you need to wrap every 
comparison in parentheses, not very pretty.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list