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
rollynoel edited this page Jun 13, 2013
·
2 revisions
Added by Bill Wood
Sometimes its useful to allow a self reference (to an object being created) in a callable constructor argument. If you try this you will get an "Unknown identifier" error; so declare the object before instantiating it:
classX:
publicf as callable() asstring// f must be public to be called from a passed-in closurepublics="hello"defconstructor(f as callable() asstring):
self.f=fa as X// declare it first!a= X({ returna.s })
printa.f()