[squeak-dev] Compiler evaluate: '' | 'inner' argument in parser

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Mon Sep 14 12:17:36 UTC 2020


Hi all,


I just evaluated the following line and was surprised by the result:


Compiler evaluate: '' for: 42.


The answer was nil, whereas I rather would have expected the answer to life the universe and everything 42, as it is the case for full methods compiled on an object. What do you think about this, which should be the right output?


I was even more surprised after taking a look into the relevant Parser implementation, which is #statements:innerBlock:blockNode:. Actually, the 'inner' argument's sole purpose is to use 'nil' instead of 'self' as a return value if there are zero statements. If we would not like to have this extra rule for doIt snippets, we would only have to change #method:context:[encoder:] and pass 'false' instead of 'doit' to #statements:innerBlock:.


I'm probably missing some logical consequences of the syntactic concept of blocks, methods, and doits, so I would like to hear your thoughts on this.


Best,

Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200914/73aec3da/attachment-0001.html>


More information about the Squeak-dev mailing list