Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

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:

No Format
class X:
	public f as callable() as string	// f must be public to be called from a passed-in closure
	public s = "hello"
	def constructor(f as callable() as string):
		self.f = f

a as X		// declare it first!
a = X({ return a.s })
print a.f()