[Vm-dev] Translation weirdness

Igor Stasenko siguctua at gmail.com
Fri Mar 15 12:50:30 UTC 2013


On 15 March 2013 13:43, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
>
> On 2013-03-14, at 21:18, Igor Stasenko <siguctua at gmail.com> wrote:
>
>>
>> On 14 March 2013 19:27, Bert Freudenberg <bert at freudenbergs.de> wrote:
>>>
>>> Slang:  foo isIntegerOop
>>> C:      interpreterProxy->isIntegerObject(foo)
>>>
>>> Slang:  interpreterProxy isIntegerObject: foo
>>> C:      (foo & 1)
>>>
>>> SmartSyntaxInterpreterPlugin: y u no smart?
>>>
>> i'd say completely opposite.
>
>
> You mean, "foo isIntegerOop" should generate "(foo & 1)", and "interpreterProxy isIntegerObject: foo" should generate "interpreterProxy->isIntegerObject(foo)", yes?
>

no i meant, both should generate

foo isIntegerOop => isIntegerOop(foo)
interpreterProxy isIntegerObject: foo  => interpreterProxy->isIntegerObject(foo)

and internally isIntegerOop() can be just a macro where it does (foo&1)..

what important to me is that C sources should as close as possible
reflect an original expression written in slang.

if developer wrote 'foo & 1' in slang code, then, and only then it
should generate C code which uses same.

> That would at least make sense, agreed.
>
> I'd have expected both constructs to result in the same generated code, so they could be used interchangeably.
>
> - Bert -
>
>> when you looking at C source it is important to not lose track of what
>> was written in slang.
>> and in this regard, expression
>>
>>  interpreterProxy->isIntegerObject(foo)
>>
>> is preferable because you know exactly what's going on, in contrast to:
>>
>>     (foo & 1)
>>
>> where you can wonder, whether same expression is written in slang.. or
>> it is translation artefact.
>> We should avoid ambiguous stuff.. especially since you can always use macros
>> so it won't affect any speed whatsoever.
>>
>>> - Bert -
>>>
>>
>> --
>> Best regards,
>> Igor Stasenko.
>



-- 
Best regards,
Igor Stasenko.


More information about the Vm-dev mailing list