Crash on send to or from mixin

31 views
Skip to first unread message

Stefan Marr

unread,
Oct 18, 2017, 6:06:10 PM10/18/17
to newspeak...@googlegroups.com, Richard Roberts
Hi:

Richard found the following code to be problematic in SOMns.

As it turns out, it also crashes on Newspeak:
https://bitbucket.org/newspeaklanguage/newspeak/downloads/ns-2017-09-05.64.zip
https://bintray.com/opensmalltalk/vm/download_file?file_path=cog_macos64x64_newspeak.cog.spur_201703272314.tar.gz

class MixinAppTest = ()(

 public class A = ()(
   public foo = ( ^ bar )
 )

 public class B = Object <: A ()()
 public bar = ( ^ 1 )

)

MixinAppTest new B new foo.

I’d expect the code to return 1.

Anything we might be missing?

The relevant SOMns issue is here: https://github.com/smarr/SOMns/pull/189

Thanks
Stefan


--
Stefan Marr
School of Computing, University of Kent
http://stefan-marr.de/research/


Ryan Macnak

unread,
Oct 18, 2017, 10:22:39 PM10/18/17
to newspeak...@googlegroups.com, Richard Roberts
Hi Stefan,

I agree with your expected behavior. In the Squeak implementation, it looks like (Object <: A) ends up with a nil enclosing object when it should have the same enclosing object as A.

You can evaluate `simulate: [MixinAppTest new B new foo]` in a Hopscotch workspace to observe the lookup failing without crashing.

Ryan

Gilad Bracha

unread,
Oct 18, 2017, 11:03:07 PM10/18/17
to newspeak...@googlegroups.com, Richard Roberts
What Ryan said (as usual, he's just a few steps ahead of me - I was just checking this out). The class B should be entirely equivalent to 

public class B = A()().

Stefan Marr

unread,
Oct 20, 2017, 8:14:42 AM10/20/17
to newspeak...@googlegroups.com, Richard Roberts
Great, thanks.

And thanks for the hint with the #simulate:

Best regards
Stefan


> On 19 Oct 2017, at 04:02, Gilad Bracha <gbr...@gmail.com> wrote:
>
> What Ryan said (as usual, he's just a few steps ahead of me - I was just checking this out). The class B should be entirely equivalent to
>
> public class B = A()().
>
>
> On Wed, Oct 18, 2017 at 7:22 PM Ryan Macnak <rma...@gmail.com> wrote:
> Hi Stefan,
>
> I agree with your expected behavior. In the Squeak implementation, it looks like (Object <: A) ends up with a nil enclosing object when it should have the same enclosing object as A.
>
> You can evaluate `simulate: [MixinAppTest new B new foo]` in a Hopscotch workspace to observe the lookup failing without crashing.
>
> Ryan

Gilad Bracha

unread,
Oct 20, 2017, 10:31:52 PM10/20/17
to newspeak...@googlegroups.com, Richard Roberts
And the bug is fixed in https://bitbucket.org/newspeaklanguage/newspeak/commits/9708ae19fe625b34ecca3a173bd7fc7dd81d0947

Thanks for uncovering this. Support for these was never really completed or tested properly, but this is a step forward.
Reply all
Reply to author
Forward
0 new messages