-
Notifications
You must be signed in to change notification settings - Fork 6
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
More comparisons #55
More comparisons #55
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
" | ||
VM: | ||
status: success | ||
stdout: | ||
false | ||
true | ||
true | ||
true | ||
false | ||
true | ||
false | ||
false | ||
false | ||
true | ||
true | ||
false | ||
true | ||
true | ||
true | ||
false | ||
" | ||
|
||
double10 = ( | ||
run = ( | ||
(1.0 = 0) println. | ||
(1.0 = 1) println. | ||
(1.0 ~= 0) println. | ||
(1.0 ~= 1) println. | ||
|
||
(1.0 < 1) println. | ||
(1.0 < 2) println. | ||
(2.0 < 0) println. | ||
|
||
(1.0 > 1) println. | ||
(1.0 > 2) println. | ||
(2.0 > 0) println. | ||
|
||
(1.0 >= 1) println. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, so in SOM, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
And There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah thanks! With this comment and @ltratt's comment above, this makes a lot more sense now. |
||
(1.0 >= 2) println. | ||
(2.0 >= 0) println. | ||
|
||
(1.0 <= 1) println. | ||
(1.0 <= 2) println. | ||
(2.0 <= 0) println. | ||
) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
" | ||
VM: | ||
status: success | ||
stdout: | ||
true | ||
false | ||
false | ||
true | ||
true | ||
true | ||
false | ||
false | ||
true | ||
" | ||
|
||
obj1 = ( | ||
run = ( | ||
(1 == 1) println. | ||
(1 <> 1) println. | ||
(1 ~= 1) println. | ||
(1 <> 2) println. | ||
(1 ~= 2) println. | ||
|
||
(self == self) println. | ||
(self <> self) println. | ||
(self == 'a') println. | ||
(self <> 'a') println. | ||
) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
" | ||
VM: | ||
status: success | ||
stdout: | ||
true | ||
true | ||
true | ||
true | ||
false | ||
false | ||
" | ||
|
||
obj2 = ( | ||
run = ( | ||
(1 == 1) println. | ||
(100 == 100) println. | ||
((1 << 200) == (1 << 200)) println. | ||
(1.0 == 1.0) println. | ||
(1.0 == 1) println. | ||
(1 == 1.0) println. | ||
) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
False = Boolean ( | ||
asString = ( ^'false' ) | ||
not = ( ^true ) | ||
or: block = ( ^block value ) | ||
and: block = ( ^false ) | ||
ifTrue: block = ( ^nil ) | ||
ifFalse: block = ( ^block value ) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
True = Boolean ( | ||
asString = ( ^'true' ) | ||
not = ( ^false ) | ||
or: block = ( ^true ) | ||
and: block = ( ^block value ) | ||
ifTrue: block = ( ^block value ) | ||
ifFalse: block = ( ^nil ) | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ pub enum Primitive { | |
New, | ||
PrintNewline, | ||
PrintString, | ||
RefEquals, | ||
Restart, | ||
Shl, | ||
Sub, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
==
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SOM is a little unusual (to our eyes) in this regadr.
=
means "check the values for equality".==
means (roughly) "check the data pointer for equality" (though for integers this is overridden -- Python effectively does something similar).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks for the explanation.