You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@br4ch1st0chr0n3 Hello. Thank you for describing your expectations. What steps do you follow to generate EO? You should have recieved this output (it is even more complicated than what you got above): simplest-derived-class.txt
The following text applies to the output that you should have actually received as mentioned above.
TLDR: My generator must be able to support different general python features, which do not happen in this particular example. I try to explain them below. I could elaborate more on the explanation. Please tell me, which of the generalizations hurt you most, so that I reflected on how to simplify them.
Some explanations:
value is mutable, so we cannot generate 11 > value, we must generate cage > value and then assign 11 to value somewhere else during dataization. "Somewhere else" is called initFields in my code. It is called before calling a constructor
getValue is also mutable! One can define a function getValue and then assign an integer to getValue. This is allowed in python, so getValue must also be a cage, which stores an object with the function. Currently it is implemented with an anonymous object with a single field called apply. More fields should be added later because each function in python has fields (!), for example, the __class__ field
python has return. This means that I must support quitting a function at any place inside the function's code. This is implemented with the help of the goto object in EO, which has a kind of "calling convention". So, each function, including getValue must be wrapped in an object to be called with the goto
in addition to return, python has exceptions and break/continue. They are supported through the same mechanism as the return, which forces me to analyze each returned value to check if it is actually a returned value or an exception or a break/return. This part is described here Memo: implementation of break and exceptions in python with goto in EO objectionary/eo#618 . This is why getValue() is called like
A class in python acts like a function. Basically, calling a class is like calling a constructor, which returns an object. A function is called with the help of goto, so a class is also called the same way: (goto ((((xd)).apply).@)) creates an object of the class d.
EO has lazy evaluation by default, python is eager by default and the evaluation order is documented, so I have to force it. I do this by splitting each expression in parts, generating them in the right order, forcing them in that order by dataizing their .< field
Hi! Thank you for your comprehensive feedback. We need some time to discuss it with the odin team.
Regarding the output, I got it by following the instructions from README. However, it refers to an old version of the transpiler. Please, update the link (also suggested here).
Activity
dours commentedon May 31, 2022
@br4ch1st0chr0n3 Hello. Thank you for describing your expectations. What steps do you follow to generate EO? You should have recieved this output (it is even more complicated than what you got above): simplest-derived-class.txt
The following text applies to the output that you should have actually received as mentioned above.
TLDR: My generator must be able to support different general python features, which do not happen in this particular example. I try to explain them below. I could elaborate more on the explanation. Please tell me, which of the generalizations hurt you most, so that I reflected on how to simplify them.
Some explanations:
valueis mutable, so we cannot generate11 > value, we must generatecage > valueand then assign 11 tovaluesomewhere else during dataization. "Somewhere else" is calledinitFieldsin my code. It is called before calling a constructorgetValueis also mutable! One can define a functiongetValueand then assign an integer togetValue. This is allowed in python, sogetValuemust also be acage, which stores an object with the function. Currently it is implemented with an anonymous object with a single field calledapply. More fields should be added later because each function in python has fields (!), for example, the__class__fieldreturn. This means that I must support quitting a function at any place inside the function's code. This is implemented with the help of thegotoobject in EO, which has a kind of "calling convention". So, each function, includinggetValuemust be wrapped in an object to be called with thegotoreturn, python has exceptions and break/continue. They are supported through the same mechanism as thereturn, which forces me to analyze each returned value to check if it is actually a returned value or an exception or a break/return. This part is described here Memo: implementation of break and exceptions in python with goto in EO objectionary/eo#618 . This is whygetValue()is called likegoto, so a class is also called the same way:(goto ((((xd)).apply).@))creates an object of the classd..<fielddeemp commentedon Jun 2, 2022
Hi! Thank you for your comprehensive feedback. We need some time to discuss it with the odin team.
Regarding the output, I got it by following the instructions from README. However, it refers to an old version of the transpiler. Please, update the link (also suggested here).