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

== and === #42

Open
hakunin opened this Issue Jan 17, 2011 · 3 comments

Comments

Projects
None yet
3 participants
@hakunin

hakunin commented Jan 17, 2011

Looks like another step towards more Ruby-like and expressive syntax would be:

`==`  -> `a.equals(b)`
String.new("a") == String.new("a")
Integer.new(1) == Integer.new(1)

This is helpful when comparing values, which we are in most common cases

`===` -> `a == b`
String.new("a") !== String.new("a")
Integer.new(1) !==Integer.new(1)

Thiw would map Java's standard behaviour it to Mirah's, without changing how it works.

@baroquebobcat

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Aug 25, 2011

Member

We could do it Ruby style--where == usually delegates to equals, eql? and equal? are used for object identity and === does the sensible thing for a case statement.

We don't have case statements currently, but we should try to figure out whether we want them to act like Ruby's case or like Java's switch.

Member

baroquebobcat commented Aug 25, 2011

We could do it Ruby style--where == usually delegates to equals, eql? and equal? are used for object identity and === does the sensible thing for a case statement.

We don't have case statements currently, but we should try to figure out whether we want them to act like Ruby's case or like Java's switch.

@consiliens

This comment has been minimized.

Show comment
Hide comment
@consiliens

consiliens Aug 26, 2011

Contributor

"Comment 3 by ndh.000...@gmail.com, May 22, 2011
Ruby uses '===' as the case operator, ie how comparisons happen in a when of a case statement. In Ruby object identity is handled using 'eql?'

do we want to follow Ruby or introduce a different thing?
What languages use '===' for object identity?

Comment 4 by michal.h...@gmail.com, May 22, 2011

do we want to follow Ruby or introduce a different thing?

I'd go with == and === for comparisons.

What languages use '===' for object identity?

JavaScript and PHP"
http://code.google.com/p/mirah/issues/detail?id=20

Contributor

consiliens commented Aug 26, 2011

"Comment 3 by ndh.000...@gmail.com, May 22, 2011
Ruby uses '===' as the case operator, ie how comparisons happen in a when of a case statement. In Ruby object identity is handled using 'eql?'

do we want to follow Ruby or introduce a different thing?
What languages use '===' for object identity?

Comment 4 by michal.h...@gmail.com, May 22, 2011

do we want to follow Ruby or introduce a different thing?

I'd go with == and === for comparisons.

What languages use '===' for object identity?

JavaScript and PHP"
http://code.google.com/p/mirah/issues/detail?id=20

@baroquebobcat

This comment has been minimized.

Show comment
Hide comment
@baroquebobcat

baroquebobcat Jan 8, 2012

Member

The == to equals bit is covered by #127

Member

baroquebobcat commented Jan 8, 2012

The == to equals bit is covered by #127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment