Comment of BlockClosure>>sourceNode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Comment of BlockClosure>>sourceNode

Damien Cassou-2
The comment of the following method seems to be more an explanation of
the implementation than of the expected behavior. Should we change that
to something like: "Return an instance of RBBlockNode representing the
receiver's AST."

BlockClosure>>sourceNode
  "the bytecode just before the first bytecode of the block is a bytecode that creates the complete block"
  ^ self method sourceNodeForPC: self startpc - 1.


--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Comment of BlockClosure>>sourceNode

Thierry Goubier


2015-10-05 14:53 GMT+02:00 Damien Cassou <[hidden email]>:
The comment of the following method seems to be more an explanation of
the implementation than of the expected behavior. Should we change that
to something like: "Return an instance of RBBlockNode representing the
receiver's AST."

Which would completely hide the reason for going backward one step in the bytecode.

I'd vote for adding to the current comment.

Thierry

 
BlockClosure>>sourceNode
  "the bytecode just before the first bytecode of the block is a bytecode that creates the complete block"
  ^ self method sourceNodeForPC: self startpc - 1.


--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill


Reply | Threaded
Open this post in threaded view
|

Re: Comment of BlockClosure>>sourceNode

Marcus Denker-4

On 05 Oct 2015, at 14:58, Thierry Goubier <[hidden email]> wrote:



2015-10-05 14:53 GMT+02:00 Damien Cassou <[hidden email]>:
The comment of the following method seems to be more an explanation of
the implementation than of the expected behavior. Should we change that
to something like: "Return an instance of RBBlockNode representing the
receiver's AST."

Which would completely hide the reason for going backward one step in the bytecode.

I'd vote for adding to the current comment.


Yes, add to it. the implementation comment is important: “Why the heck -1”...

Marcus

Reply | Threaded
Open this post in threaded view
|

Re: Comment of BlockClosure>>sourceNode

Damien Cassou-2
In reply to this post by Thierry Goubier

Thierry Goubier <[hidden email]> writes:

> 2015-10-05 14:53 GMT+02:00 Damien Cassou <[hidden email]>:
>
>> The comment of the following method seems to be more an explanation of
>> the implementation than of the expected behavior. Should we change that
>> to something like: "Return an instance of RBBlockNode representing the
>> receiver's AST."
>>
>> Which would completely hide the reason for going backward one step in the
> bytecode.
>
> I'd vote for adding to the current comment.


the existing comment is useful, I agree.

https://pharo.fogbugz.com/f/cases/16721/Comment-of-BlockClosure-sourceNode-is-unclear

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill