These days you generally want to overload == rather than isequal. On Fri, Aug 21, 2015 at 9:24 AM, Sisyphuss <zhengwend...@gmail.com> wrote:
> They are two different operators. > import Base.== > > type inty > insideint :: Int > end > ==(a :: inty, b :: Int) = a.insideint == b > > inty(5) == 5 > > > > On Friday, August 21, 2015 at 3:10:01 PM UTC+2, Dawid Crivelli wrote: >> >> >> How do you define the `==` operator for a new type? >> >> If I try and define the `isequal` operator, that definition does not >> apply to '==': >> >> import Base.isequal >> >> type inty >> insideint :: Int >> end >> isequal(a :: inty, b :: Int) = a.insideint == b >> >> inty(5) == 5 # false on Julia Version 0.4.0-dev+6858, Commit >> dc2be6f (2015-08-20 16:45 UTC) >> isequal(inty(5), 5) # true >> >>