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

TruffleSOM does not accept writes to method arguments #17

Open
gpummer opened this issue Nov 1, 2018 · 4 comments
Open

TruffleSOM does not accept writes to method arguments #17

gpummer opened this issue Nov 1, 2018 · 4 comments

Comments

@gpummer
Copy link

gpummer commented Nov 1, 2018

SOM accepts writes to method arguments. TruffleSOM throws a runtime exception at compile time. Is this the expected behaviour?

I have written the following attached TestCase ArgumentReadonlyTest.som.txt. The runtime exception is found in the attached file
exception.txt.
('mysom' is 'som' with the change from 'som.vm.Universe' to 'trufflesom.vm.Universe'.)

Maybe the root cause has something to do with the setting von JAVA_HOME and GRAAL_HOME? I'm only able to run the provided samples in truffleSOM if JAVA_HOME is identical to GRAAL_HOME and points to the 'normal' Java VM. If GRAAL_HOME points to '... graalvm-ce-1.0.0-rc8/Contents/Home' I get the exception, that 'Caused by: java.lang.AssertionError: Only one implementation Engine.Impl allowed.'.

@smarr
Copy link
Member

smarr commented Nov 1, 2018

Hm, this is indeed a departure from SOM.

Though, it is the standard semantics in various Smalltalks, I believe.
So, I would tend to consider it a bug in SOM.

Beside GCBench.som, is there any other reason why writing to arguments would be desirable?

@gpummer
Copy link
Author

gpummer commented Nov 2, 2018

I have tested this now with Pharo (6.1) which does not allow a write to an argument. I'm really fine with the readonly behaviour.

Just wondering, why this went so long (24 Oct 2013) unnoticed ;) I was surprised, because SOM accepted it. I write most source code in Java - where the write to an argument is fine, so the argument write didn't trigger anything.

@smarr
Copy link
Member

smarr commented Nov 2, 2018

Yeah, I don't remember any specific reason of disallowing the writes.
I think, I was just used to it from other Smalltalks, and didn't pay too much attention to SOM when implementing TruffleSOM.

But, I think, it's not a bad idea to stick more strictly to the common Smalltalks.

So, I'll close this issue, and mark it as a bug for SOM to have writable arguments.

Thanks for pointing it out :)
SOM isn't a huge project, and we haven't had a chance recently to expose it to larger number of students. So, such inconsistencies aren't necessarily noticed easily.

Thanks!

@smarr smarr closed this as completed Nov 2, 2018
@smarr
Copy link
Member

smarr commented Nov 2, 2018

Hmm, needs another careful thought as per discussion on SOM-st/SOM#7

@smarr smarr reopened this Nov 2, 2018
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