[Grace-core] Summer Plans

Andrew P. Black black at cs.pdx.edu
Mon Jun 18 11:04:08 PDT 2012


On 18 Jun 2012, at 10:51 , Andrew P. Black wrote:

> One workaround is to write out the nested objects as I have done above.  Another is to make diagonal and semiDiagonal methods rather than fields; this is quite reasonable in this example, since a client might want them anyway.   Note, however, that if a method refers to w and h, then w and h will be captured in the environment of the object, and thus the object might take up more storage than is obvious from the fields in the class construct.
> 

A third solution is to change the rule that every def automatically generates a method.  If un-annotated defs don't create methods, but those annotated <readable> do, then there is no problem using 

	def diagonal = w at h
	def semiDiagonal = diagonal / 2

etc.   Any defined name that is referenced in a method with become part of the object closure, and thus consume storage, but defined names that are referenced only in other name definitions don't consume storage. 

	Andrew





More information about the Grace-core mailing list