Alexandre Bergel bergel@iam.unibe.ch wrote: | Hello, | | I am wondering why the following expression is false. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | nil class compile: 'foobar Object new asMorph'. | (nil class >> #foobar) literals includesAllOf: #(new asMorph) | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If you browse UndefinedObject>>foobar and view the bytecodes, you will see:
13 <41> pushLit: Object 14 <CC> send: new 15 <D0> send: asMorph 16 <87> pop 17 <78> returnSelf
If you then look at Interpreter class >> initializeBytecodeTable, you will find that 16rCC (204) is the bytecode for:
(204 bytecodePrimNew)
sending "new" is common enough that it has its own bytecode, so there is no need for a literal reference. If you decode the "asMorph" send, though, you will see 16rD0 (208) translates to
(208 255 sendLiteralSelectorBytecode)
-- tim
Thanks to Bob and you for your accurate answer.
Cheers, Alexandre
On Mon, Mar 03, 2003 at 07:31:03PM -0600, Tim Olson wrote:
Alexandre Bergel bergel@iam.unibe.ch wrote: | Hello, | | I am wondering why the following expression is false. | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | nil class compile: 'foobar Object new asMorph'. | (nil class >> #foobar) literals includesAllOf: #(new asMorph) | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If you browse UndefinedObject>>foobar and view the bytecodes, you will see:
13 <41> pushLit: Object 14 <CC> send: new 15 <D0> send: asMorph 16 <87> pop 17 <78> returnSelf
If you then look at Interpreter class >> initializeBytecodeTable, you will find that 16rCC (204) is the bytecode for:
(204 bytecodePrimNew)
sending "new" is common enough that it has its own bytecode, so there is no need for a literal reference. If you decode the "asMorph" send, though, you will see 16rD0 (208) translates to
(208 255 sendLiteralSelectorBytecode)
-- tim
squeak-dev@lists.squeakfoundation.org