[squeak-dev] The Trunk: Compiler-ul.191.mcz

Levente Uzonyi leves at elte.hu
Sun Feb 20 16:13:46 UTC 2011


On Sun, 20 Feb 2011, Nicolas Cellier wrote:

> Most probably my mistake because I played with simplifying handling of
> #caseOf:, allowing arbitrary arguments. Apologizes.
>
> See http://lists.squeakfoundation.org/pipermail/squeak-dev/2011-February/157222.html
>
> Current Compiler only accepts a BraceNode and a VariableNode but not a
> MessageNode, an AssignmentNode or any other ValueNode.
> IMO, this limitation is arbitrary. Compiler shall accept any form,
> send the message without inlining if not a Block and let execution
> raise an Error in caseOf: invalid argument
>
> Anyway, testing for code < LdNil is somehow deficient (try 'false
> caseOf: true'), the comment is a bit misleading.
> Would #caseOf: be simplified that  canBeSpecialArgument could be
> eliminated and replaced by isBlockNode + numArg check.

I don't see why the check for BlockNode is necessary. Wouldn't it be 
better to remove the whole check and return false if caseNode is not a 
BraceNode (in MessageNode >> #transformCase:)? An optional warning may be 
useful.


Levente

>
> I guess that complexifying the Compiler was intended to help the user
> guessing correct usage of #caseOf:...
> Then one probably did need to pass a VariableNode one day and put a
> Compiler hack.
>
> Maybe another guru needing to pass the result of concatenating two
> arrays, will put another one
> MessageNode>>canBeSpecialArgument
>    ^selector == #','
>
> Unless the next best thing to do would be to remove some intentions
> from Compiler and just let it compile dumbly.
> I think I'll finish the work.
>
> Nicolas
>
> 2011/2/19  <commits at source.squeak.org>:
>> Levente Uzonyi uploaded a new version of Compiler to project The Trunk:
>> http://source.squeak.org/trunk/Compiler-ul.191.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Compiler-ul.191
>> Author: ul
>> Time: 19 February 2011, 10:02:37.736 pm
>> UUID: a7628e80-ae41-e348-b9b0-6b5f475cd90b
>> Ancestors: Compiler-ul.190
>>
>> Restored VariableNode >> #canBeSpecialArgument, which got lost with Compiler-nice.188 for some unknown reason. It is required to compile #caseOf: with non-brace array arguments.
>>
>> =============== Diff against Compiler-ul.190 ===============
>>
>> Item was added:
>> + ----- Method: VariableNode>>canBeSpecialArgument (in category 'testing') -----
>> + canBeSpecialArgument
>> +       "Can I be an argument of (e.g.) ifTrue:?"
>> +
>> +       ^code < LdNil!
>>
>>
>>
>
>


More information about the Squeak-dev mailing list