ProfStef, Lesson 25 - Unknown selector
Hi all, Reading ProfStef at lesson 25 (Reflections), when I try to run the last statement <code>ProfStef default executeMethod: (ProfStef lookupSelector:#next).</code>, the error pops up saying <error>Unknown selector executeMethod:</error>. Am I doing anything wrong? TIA, -- Bahman Movaqar (http://BahmanM.com) ERP Evaluation, Implementation & Deployment Consultant PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)
Hi, I am not sure whether Pharo implements or once implemented a special method like executeMethod: but in Smalltalk the selector for sending a message to an object is #perform: so you should probably try to replace #executeMethod with #perform: . But I am sure somebody more familiar with ProfStef and Pharo will comment on your issue more specifically. HTH, Joachim Am 05.11.13 07:36, schrieb Bahman Movaqar:
Hi all,
Reading ProfStef at lesson 25 (Reflections), when I try to run the last statement <code>ProfStef default executeMethod: (ProfStef lookupSelector:#next).</code>, the error pops up saying <error>Unknown selector executeMethod:</error>. Am I doing anything wrong?
TIA,
Hello, The method that exists is #withArgs:executeMethod: so replace "executeMethod: someCode" ==> by ==> "withArgs: #( ) executeMethod: someCode" or create the method: Object>>executeMethod: compiledMethod ^ self withArgs: #( ) executeMethod: compiledMethod Then it should work. You're the second one to ask that question I will make a fix. Are you in Pharo 2 or Pharo 3 ? #perform: is different. #perform: takes a selector as argument and the lookup will find out the method to execute, whereas executeMethod: directly run a method with no lookup (which can lead to a crash if the receiver cannot run properly this method). 2013/11/5 Joachim Tuchel <jtuchel@objektfabrik.de>
Hi,
I am not sure whether Pharo implements or once implemented a special method like executeMethod: but in Smalltalk the selector for sending a message to an object is #perform: so you should probably try to replace #executeMethod with #perform: . But I am sure somebody more familiar with ProfStef and Pharo will comment on your issue more specifically.
HTH,
Joachim
Am 05.11.13 07:36, schrieb Bahman Movaqar:
Hi all,
Reading ProfStef at lesson 25 (Reflections), when I try to run the last statement <code>ProfStef default executeMethod: (ProfStef lookupSelector:#next).</code>, the error pops up saying <error>Unknown selector executeMethod:</error>. Am I doing anything wrong?
TIA,
On 11/05/2013 12:48, Clément Bera wrote:
Hello,
The method that exists is #withArgs:executeMethod: so replace "executeMethod: someCode" ==> by ==> "withArgs: #( ) executeMethod: someCode" or create the method: Object>>executeMethod: compiledMethod ^ self withArgs: #( ) executeMethod: compiledMethod Then it should work.
You're the second one to ask that question I will make a fix. Are you in Pharo 2 or Pharo 3 ?
Pharo 2.0. It's certainly not a stopper as one can always do <code>ProfStef next.</code>. However since the lesson is about reflection, it somehow feels weird :-)
#perform: is different. #perform: takes a selector as argument and the lookup will find out the method to execute, whereas executeMethod: directly run a method with no lookup (which can lead to a crash if the receiver cannot run properly this method).
2013/11/5 Joachim Tuchel <jtuchel@objektfabrik.de <mailto:jtuchel@objektfabrik.de>>
Hi,
I am not sure whether Pharo implements or once implemented a special method like executeMethod: but in Smalltalk the selector for sending a message to an object is #perform: so you should probably try to replace #executeMethod with #perform: . But I am sure somebody more familiar with ProfStef and Pharo will comment on your issue more specifically.
HTH,
Joachim
Am 05.11.13 07:36, schrieb Bahman Movaqar:
Hi all,
Reading ProfStef at lesson 25 (Reflections), when I try to run the last statement <code>ProfStef default executeMethod: (ProfStef lookupSelector:#next).</code>, the error pops up saying <error>Unknown selector executeMethod:</error>. Am I doing anything wrong?
-- Bahman Movaqar (http://BahmanM.com) ERP Evaluation, Implementation & Deployment Consultant PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)
On 05 Nov 2013, at 10:19, Clément Bera <bera.clement@gmail.com> wrote:
Hello,
The method that exists is #withArgs:executeMethod: so replace "executeMethod: someCode" ==> by ==> "withArgs: #( ) executeMethod: someCode" or create the method: Object>>executeMethod: compiledMethod ^ self withArgs: #( ) executeMethod: compiledMethod Then it should work.
I think the easiest is to add back that methods⦠I really do not like to have an API on Object for executing methods (is should be in Methodâ¦), but as the primitive is there now, it is not easy to change. I all add issues for 2.0 and 3. Marcus
I added the issue with a slice in inbox. 2013/11/5 Marcus Denker <marcus.denker@inria.fr>
On 05 Nov 2013, at 10:19, Clément Bera <bera.clement@gmail.com> wrote:
Hello,
The method that exists is #withArgs:executeMethod: so replace "executeMethod: someCode" ==> by ==> "withArgs: #( ) executeMethod: someCode" or create the method: Object>>executeMethod: compiledMethod ^ self withArgs: #( ) executeMethod: compiledMethod Then it should work.
I think the easiest is to add back that methods⦠I really do not like to have an API on Object for executing methods (is should be in Methodâ¦), but as the primitive is there now, it is not easy to change.
I all add issues for 2.0 and 3.
Marcus
On 05 Nov 2013, at 07:36, Bahman Movaqar <Bahman@BahmanM.com> wrote:
executeMethod: (
Hello, we removed #executeMethod: on Object because it makes no sense as there is an API on the method for that already. (a good hint for that is that it had no users). When you want to execute a method directly (not via sending a method), what you have to do: 1) get the method object. 2) tell it to execute itself with #valueWithReceiver:arguments: so for example: (Object compiledMethodAt: #halt) valueWithReceiver: nil arguments: #() We should update ProfStef Marcus
On 05 Nov 2013, at 09:52, Marcus Denker <marcus.denker@inria.fr> wrote:
On 05 Nov 2013, at 07:36, Bahman Movaqar <Bahman@BahmanM.com> wrote:
executeMethod: (
Hello,
we removed #executeMethod: on Object because it makes no sense as there is an API on the method for that already. (a good hint for that is that it had no users).
When you want to execute a method directly (not via sending a method), what you have to do:
1) get the method object. 2) tell it to execute itself with #valueWithReceiver:arguments:
so for example:
(Object compiledMethodAt: #halt) valueWithReceiver: nil arguments: #()
and there still is withArgs: argArray executeMethod: compiledMethod For Object (which is a primitive) Marcus
On 09 Nov 2013, at 01:30, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
marcus
did you open an entry?
It is already fixed in 3.0 and 2.0 :-)
Stef
On Nov 5, 2013, at 9:51 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
(Object compiledMethodAt: #halt) valueWithReceiver: nil arguments: #()
We should update ProfStef
Marcus
I do not understand I got many old mails (may be just did not read during the sprint and after I was flying). Stef On Nov 9, 2013, at 8:28 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
On 09 Nov 2013, at 01:30, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
marcus
did you open an entry?
It is already fixed in 3.0 and 2.0 :-)
Stef
On Nov 5, 2013, at 9:51 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
(Object compiledMethodAt: #halt) valueWithReceiver: nil arguments: #()
We should update ProfStef
Marcus
This bug is fixed and integrated in Pharo 3. 2013/11/9 Stéphane Ducasse <stephane.ducasse@inria.fr>
marcus
did you open an entry?
Stef
On Nov 5, 2013, at 9:51 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
(Object compiledMethodAt: #halt) valueWithReceiver: nil arguments: #()
We should update ProfStef
Marcus
participants (5)
-
Bahman Movaqar -
Clément Bera -
Joachim Tuchel -
Marcus Denker -
Stéphane Ducasse