From: Eric B. <er...@go...> - 2008-02-07 14:07:40
|
CRISMER Paul-Georges wrote: > {MA_DECIMAL}.make_zero creates one object whose value is zero. > That way, 1 million of objects whose value is zero. > > {MA_DECIMAL_CONSTANTS}.zero refers to a single object whose value is > zero. > You can have as many references to {MA_DECIMAL}.zero or > {MA_DECIMAL_CONSTANTS}.zero, they refer all to a unique object whose > value is zero. > > In {MA_DECIMAL_CONSTANTS}.zero, you have to create a {MA_DECIMAL} > instance (line 1:) before being able to call the {MA_DECIMAL}.zero > feature (line 2:). > > Since this object is just a "proxy" to be able to call the > {MA_DECIMAL}.zero feature, I chose to write line 1: which creates a > decimal object with 1 significant digit. > > Does this make sense to you? It does not make sense to me. In your implementation you have a recursive call to the once function to define it. I think that what Berend meant was something like: zero: MA_DECIMAL is -- Neutral element for "+" and "-" once create Result.make_zero ensure zero_not_void: Result /= Void end As far as I can tell we don't create a million objects and the implementation of `zero' is not recursive anymore. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |