Closed smarr closed 1 year ago
What I'll do is give you the permission to bors try
to your heart's content (you can also do bors r+
but please don't, at least not yet!).
bors delegate=smarr
:v: smarr can now approve this pull request. To approve and merge a pull request, simply reply with bors r+
. More detailed instructions are available here.
So you can now type:
bors try
and watch bors do its thing!
Here's the current job (it'll take a while!):
Here's the relevant bits:
Failures: 1
IntegerTest>>#testRaisedTo
Expected 1267650600228229401496703205376 but was -1267650600228229401496703205376.
Test Suite: #StringTest
Tests passed: 16
------------------------------
Failures: 2
StringTest>>#testEquality
Assertion failed
StringTest>>#testEquality
Assertion failed
Test Suite: #SystemTest
Tests passed: 2
-----------------------
[I haven't investigated -- these could be yksom bugs!]
Thanks.
IntegerTest>>#testRaisedTo
Expected 1267650600228229401496703205376 but was -1267650600228229401496703205376.
This looks like an integer overflow check is missing for multiplication.
Integer>>#raisedTo:
is implemented with a simple loop:
https://github.com/SOM-st/SOM/blob/master/Smalltalk/Integer.som#L51
StringTest>>#testEquality
Assertion failed
StringTest>>#testEquality
Assertion failed
This is very likely the new tests here:
Smalltalk equality is not necessarily symmetric, and in the case of Strings and Symbols that becomes visible in these tests.
So, a string is equal to a symbol when using =
, because it only considers the string's content, but not the Symbol's identity.
This looks like an integer overflow check is missing for multiplication.
Correct (and culprit found!). But isn't the test wrong in the sense that the number should scale up to a big int? 2**100
(according to Python) is 1267650600228229401496703205376. Shouldn't SOMs be transparently moving from small to big ints with multiplication?
This looks like an integer overflow check is missing for multiplication.
Correct (and culprit found!). But isn't the test wrong in the sense that the number should scale up to a big int?
2**100
(according to Python) is 1267650600228229401496703205376. Shouldn't SOMs be transparently moving from small to big ints with multiplication?
What exactly do you mean with the "test being wrong"? SOM doesn't expose the representation. So, on the code level, we don't see a distinction between small and big int.
Assuming that there's nothing wrong with the actual number in the test, I am not sure what you would expect to be different.
In SOM-java, I do for instance the following:
https://github.com/SOM-st/som-java/blob/master/src/som/vmobjects/SInteger.java#L155-L162 On multiplication, I catch the overflow, and indeed change the representation to be based on Java's BigInteger.
I'm an idiot and misread the tests. Sorry!
Re the other bit, the equality, I actually just checked this in Squeak, and Squeak seems to only consider string equality even when #symbol = 'string'
is compared, not just the other way around 'string' = #symbol
. So, I think the test in SOM currently merely documents the status quo, and not necessarily what one would actually want.
So, that's just to say, I might change my mind on "what the right thing" is for the equality test of strings and symbols.
It looks like the string equality tests work now I've fixed multiply! If/when https://github.com/softdevteam/yksom/pull/218 is merged, we can retry this PR -- I think it will "just work".
bors try
OK, so I do need to fix the stringy thingies.
It looks like the string equality tests work now I've fixed multiply! If/when #218 is merged, we can retry this PR -- I think it will "just work".
Doh, I was running SOMSOM before. You can tell it's a while since I've looked at this repository...
@smarr The test suite has string = symbol
but not symbol = string
. Are both 'a' = #a
and #a = 'a'
true?
Ah, I see them now in SymbolTest.som
.
OK this is a bit baffling since all these tests succeed:
StringTest = TestCase (
testEquality = (
self assert: ('f' + 'o' + 'o') = #foo.
)
testEqualEqual = (
| str1 |
str1 := 'foo'.
self assert: str1 == str1.
self deny: str1 == str1 asSymbol.
self deny: str1 == #foo.
)
)
So somehow other SOMs are treating foo asSymbol
as different than #foo
? I feel like I'm missing out on something (I have made many SOM mistakes today!).
The tests use deny
instead of assert, is that it?
I also added a todo to make up my mind about whether the current semantics are actually desirable: https://github.com/SOM-st/SOM/issues/105
Thoughts welcome.
Possibly! I think I might have misread your "symmetric" comment. It seems that really =
treats strings and symbols as totally interchangeable? FWIW, yksom currently says strings and symbols are not interchangeable. I don't feel strongly about that: to be honest, the differentiation of the two concepts feels fairly unimportant to me, but perhaps that's just my non-Smalltalk background.
I think in classic Smalltalk, the most important bit is that one can rely on ==
for symbols. Java did away with the distinction and instead introduced the concept of interned strings. I'll see what breaks when I make =
symmetric... and get back to you then.
I'll see what breaks when I make = symmetric... and get back to you then.
Any luck with that?
Oops, I should have tagged @smarr on that last comment.
No, sorry, I got the notification, I just ignored you. Haven't managed to do anything on it yet...
I won't take it personally :p
Seems like the change to make #=
symmetric doesn't cause any issues.
So, I'll probably go with it.
Relevant changes:
I now have a change to yksom that works with the new definition of =
. I'll close this PR, as I'll need to open a fresh one, with a (small) change to yksom + the new SOM commit (when you've pushed it to your master branch -- please let me know!).
This update the core library with various changes.
I am mostly curious whether things "just work", since you got a completely separate implementation. And, well, I don't think I can run yksom myself at the moment, since it seems to depend on custom Rust things.
Most notable:
#-
https://github.com/SOM-st/SOM/pull/104Full list of commits: https://github.com/SOM-st/SOM/compare/26fa6abc4dba0d6406ae37aed1b11007c631b309...51d42a5e6606894d57c51f960e9bd57c1e274132