[squeak-dev] The Inbox: Graphics-cmfcmf.407.mcz

cmfcmf cmfcmf.flach at gmail.com
Wed May 29 19:02:06 UTC 2019


Nicolas Cellier wrote
> Usage of primitiveFail is on purpose here because this is the source code
> of the (misc) primitive.
> So, it's an imperative style to make the primitive fail.
> 
> This is confusing if we run the primitive code as a fallback code
> (we will run exact same code as primitive which is duplicating the work,
> if
> the primitive really exist, and will fail for same reasons).

I see what you mean. It feels a bit like a chicken/egg problem.
I stumbled across this issue when I played around with decompressing Bitmaps
from ByteArrays and supplied data in the wrong format. Here's an example:

/Bitmap decompressFromByteArray: #[0 12]/

Currently, the primitive fails, then the Smalltalk code runs and calls the
non-existing (at least non-existing in the Smalltalk world)
/>>primitiveFail/ (like you described).

When I created the patch, I was not aware that the Smalltalk code is also
used to compile the primitive and that using />>primitiveFail/ is on
purpose.



--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list