Forthon
Forthon copied to clipboard
Master setobject
add setpyobject method in Forthon to be able to alias a Forthon object into a class (ease the dumping/loading of data)
Example with 'face' as Forthon oject:
class test(): def init(self): for v in face.varlist(): setattr(self.class,v,property(self.getter(v), self.setter(v), face.getvardoc(v))) @staticmethod def getter(varname): def getfaceobj(self): return face.getpyobject(varname) return getfaceobj @staticmethod def setter(varname): def setfaceobj(self,vv): return face.setpyobject(varname,vv) return setfaceobj
I don't think that this routine is needed. You can do
def setfaceobj(self,vv):
return setattr(face, varname, vv)
This ends up calling the same routine Forthon_setattro
.
Yes right
On Mon 6 Dec 2021 at 16:56 David Grote @.***> wrote:
I don't think that this routine is needed. You can do
def setfaceobj(self,vv): return setattr(face, varname, vv)
This ends up calling the same routine Forthon_setattro.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dpgrote/Forthon/pull/30#issuecomment-987454776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEESMZCFGYZGQFJTI3IM67DUPVLTRANCNFSM5JLEBWCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.