Re: [Pharo-project] Compiler pedantic about ifNotNil: argument
personnally I do not like this form What does it do?
process ifNotNil: #terminate.
for me it means passes the symbol #terminate as argument to the method ifNotNil: If it has a more magical behavior then I do not know it. Stef
The compiler uselessly insist on #ifNotNil: argument being a zero/one arg block. Thus we cannot write this xtream sentence
process ifNotNil: #terminate.
When the argument is not a block, Compiler should avoid inlining and just send a normal message.
cheers
Nicolas
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On 10 October 2010 16:13, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
personnally I do not like this form What does it do?
  process ifNotNil: #terminate.
here the test case for it: | process answer | process := Object new. answer := process ifNotNil: #terminate. self assert: answer == #terminate.
for me it means passes the symbol #terminate as argument to the method ifNotNil: If it has a more magical behavior then I do not know it.
Stef
The compiler uselessly insist on #ifNotNil: argument being a zero/one arg block. Thus we cannot write this xtream sentence
  process ifNotNil: #terminate.
When the argument is not a block, Compiler should avoid inlining and just send a normal message.
cheers
Nicolas
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
2010/10/10 Igor Stasenko <siguctua@gmail.com>:
On 10 October 2010 16:13, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
personnally I do not like this form What does it do?
  process ifNotNil: #terminate.
here the test case for it:
| process answer |
process := Object new.
answer := process ifNotNil: #terminate.
self assert: answer == #terminate.
Ah, yes, I did not interpret it the same... I asked my son, which is not a Smalltalker, what he understood, and it was (process terminate) not (^#terminate). Nicolas
for me it means passes the symbol #terminate as argument to the method ifNotNil: If it has a more magical behavior then I do not know it.
Stef
The compiler uselessly insist on #ifNotNil: argument being a zero/one arg block. Thus we cannot write this xtream sentence
  process ifNotNil: #terminate.
When the argument is not a block, Compiler should avoid inlining and just send a normal message.
cheers
Nicolas
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Yes, this can be surprising at first. But I think this is because you read it with a preformated Smalltalk mind, rather than just english. it's just like: (1 to: 10) select: #even. Nicolas 2010/10/10 Stéphane Ducasse <stephane.ducasse@inria.fr>:
personnally I do not like this form What does it do?
  process ifNotNil: #terminate.
for me it means passes the symbol #terminate as argument to the method ifNotNil: If it has a more magical behavior then I do not know it.
Stef
The compiler uselessly insist on #ifNotNil: argument being a zero/one arg block. Thus we cannot write this xtream sentence
  process ifNotNil: #terminate.
When the argument is not a block, Compiler should avoid inlining and just send a normal message.
cheers
Nicolas
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On Oct 10, 2010, at 3:13 08PM, Stéphane Ducasse wrote:
personnally I do not like this form What does it do?
process ifNotNil: #terminate.
for me it means passes the symbol #terminate as argument to the method ifNotNil: If it has a more magical behavior then I do not know it.
Stef
It's exactly the same as using collection do: #something. FWIW, in 1.2 we already included the compiler changes Levente suggested to me to remove this restriction, so nil ifNotNil: #squared -> nil 4 ifNotNil: #squared -> 16. I.e. it already does what Nicolas suggested. (As per the Symbol>>#cull: thread) Cheers, Henry
The compiler uselessly insist on #ifNotNil: argument being a zero/one arg block. Thus we cannot write this xtream sentence
process ifNotNil: #terminate.
When the argument is not a block, Compiler should avoid inlining and just send a normal message.
cheers
Nicolas
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (4)
-
Henrik Johansen -
Igor Stasenko -
Nicolas Cellier -
Stéphane Ducasse