Trying to override != or create a unary negation method

I’m trying to add Criteria-style query inference to Lafcadio, which so
far has involved making a class that overrides == . So far, so good.
Now I’d like to override != so that I can turn the block

{ |user| user.email != "test@test.com" }

into the sql

select * from users where !(email = ‘test@test.com’)

The trusty Pickaxe sez you can’t define != independently of ==, and
that once you’ve defined ==, any call to

a != b

is implicitly turned into

!(a == b)

So I figure, fine, I can make my query condition objects flip
themselves when they’re negated. Tried creating a unary negation
method:

def !@
# …
end

and just got a syntax error. Any ideas as to what I could try next?

So I figure, fine, I can make my query condition objects flip

themselves when they’re negated. Tried creating a unary negation

method:

···

On Tue, 16 Dec 2003, Francis Hwang wrote:

def !@

# …

end

and just got a syntax error. Any ideas as to what I could try next?

As far as I know, you’re just not going to be able to define your own
behavior for this syntax. It’s not a valid method name as per parse.y
(tNEG is not valid for the “op” production).

You could always define a method called “not()”, but it won’t have that
"magic" flavor to it (not necessarily a bad thing, IMO).

Chad