Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make != and > and >= fallbacks work for all types #200

Closed
StefanKarpinski opened this issue Sep 21, 2011 · 3 comments
Closed

make != and > and >= fallbacks work for all types #200

StefanKarpinski opened this issue Sep 21, 2011 · 3 comments
Assignees

Comments

@StefanKarpinski
Copy link
Member

This seems simple, but there's some complication that made the obvious change fail.

@ghost ghost assigned StefanKarpinski Sep 21, 2011
@StefanKarpinski
Copy link
Member Author

This allows dropping a few definitions in string.j and a few other places.

@JeffBezanson
Copy link
Member

!= is there already.

The problem with > is that number types rely on fallbacks for both converting > to < and for promotion, but only one of those can be the most specific. The definition

>(x,y)=(y<x)

is shadowed by

>(x::Real, y::Real) = (>)(promote(x,y)...)

for all Real types, so the promotion definition calls itself in a loop. To fix this we might have to change it to

>(x::Real, y::Real) = (<)(promote(y,x)...)

@StefanKarpinski
Copy link
Member Author

How about we just get rid of the

>(x::Real, y::Real) = (>)(promote(x,y)...)

rule since its redundant given

>(x::Real, y::Real) = (>)(promote(x,y)...)

and the more general

>(x,y) = y < x

? And similarly for >=, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants