From: CRISMER Paul-G. <Pau...@gr...> - 2008-02-07 13:00:08
|
Hello Berend, {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? Best regards, Paul G. Crismer zero: MA_DECIMAL is -- Neutral element for "+" and "-" once 1: create Result.make (1) 2: Result := Result.zero ensure zero_not_void: Result /= Void end ***** Disclaimer ***** http://www.groupes.be/1_mail-disclaimer.htm |
From: CRISMER Paul-G. <Pau...@gr...> - 2008-02-07 13:03:44
|
Typo. Instead of "That way, 1 million of objects whose value is zero." Please read "That way, you could create 1 million of objects whose value is zero." -----Original Message----- From: gob...@li... [mailto:gob...@li...] On Behalf Of CRISMER Paul-Georges Sent: jeudi 7 février 2008 14:01 To: gob...@li... Subject: Re: [gobo-eiffel-develop] MA_DECIMAL_CONSTANTS.zero Hello Berend, {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? Best regards, Paul G. Crismer zero: MA_DECIMAL is -- Neutral element for "+" and "-" once 1: create Result.make (1) 2: Result := Result.zero ensure zero_not_void: Result /= Void end ***** Disclaimer ***** http://www.groupes.be/1_mail-disclaimer.htm ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gobo-eiffel-develop mailing list gob...@li... https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop ***** Disclaimer ***** http://www.groupes.be/1_mail-disclaimer.htm |
From: Colin A. <col...@go...> - 2008-02-07 13:18:05
|
On 07/02/2008, CRISMER Paul-Georges <Pau...@gr...> wrote: > {MA_DECIMAL_CONSTANTS}.zero refers to a single object whose value is > zero. To be more accurate, it refers to a single object whose initial value is zero. I presume this is what Berend is concerned about. |
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 |
From: Berend de B. <be...@po...> - 2008-02-11 02:04:23
Attachments:
smime.p7s
|
>>>>> "Eric" == Eric Bezault <er...@go...> writes: Eric> It does not make sense to me. In your implementation you have Eric> a recursive call to the once function to define it. Eric> 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 Eric> As far as I can tell we don't create a million objects and the Eric> implementation of `zero' is not recursive anymore. Exactly. -- Cheers, Berend de Boer |
From: Eric B. <er...@go...> - 2008-02-07 14:40:57
|
CRISMER Paul-Georges wrote: > Recursive? Oops, indeed. I didn't realize that we were talking about `zero' from MA_DECIMAL_CONSTANTS and not from MA_DECIMAL. This implementation looks twisted to me though. I would have written in class MA_DECIMAL_CONSTANTS: zero: MA_DECIMAL is -- Neutral element for "+" and "-" once create Result.make_zero ensure zero_not_void: Result /= Void is_zero: Result.is_zero end and in MA_DECIMAL: zero: like Current is -- Neutral element for "+" and "-" do Result := decimal.zero ensure then is_zero: Result.is_zero end and no need for `once_zero'. Or did I miss something again? -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |
From: Eric B. <er...@go...> - 2008-02-07 14:54:41
|
CRISMER Paul-Georges wrote: > In fact, I remember I've been forced to do that for assertion violation reason. > > The initial implementation follows your proposal. > > The problem is I did not log the rationale for doing that. > And for the moment I do not have energy to chase why. > > Best regards, > > Paul G. Crismer > > -----Original Message----- > From: Eric Bezault [mailto:er...@go...] > > Sent: jeudi 7 février 2008 15:40 > To: CRISMER Paul-Georges > Cc: Gobo Developers Mailing List > Subject: Re: [gobo-eiffel-develop] MA_DECIMAL_CONSTANTS.zero > > CRISMER Paul-Georges wrote: >> Recursive? > > Oops, indeed. I didn't realize that we were talking about `zero' from MA_DECIMAL_CONSTANTS and not from MA_DECIMAL. > > This implementation looks twisted to me though. I would have written in class MA_DECIMAL_CONSTANTS: > > zero: MA_DECIMAL is > -- Neutral element for "+" and "-" > once > create Result.make_zero > ensure > zero_not_void: Result /= Void > is_zero: Result.is_zero > end > > and in MA_DECIMAL: > > zero: like Current is > -- Neutral element for "+" and "-" > do > Result := decimal.zero > ensure then > is_zero: Result.is_zero > end > > and no need for `once_zero'. Or did I miss something again? > > -- > Eric Bezault > mailto:er...@go... > http://www.gobosoft.com > > ***** Disclaimer ***** > http://www.groupes.be/1_mail-disclaimer.htm > > > |