The Inbox: Kernel-wiz.591.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Kernel-wiz.591.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-wiz.591.mcz

==================== Summary ====================

Name: Kernel-wiz.591
Author: wiz
Time: 29 May 2011, 4:11:53.048 pm
UUID: 53586ad8-595c-477a-ac55-19471c286e26
Ancestors: Kernel-eem.590

This is asNonFraction defined only for Number and Fraction but not Object. Fractions are converted to Floats other numbers are left alone. Non numbers including nil  will raise a DNU.

=============== Diff against Kernel-eem.590 ===============

Item was added:
+ ----- Method: Fraction>>asNonFraction (in category 'converting') -----
+ asNonFraction
+ "Answer the receiver asFloat. This is here for the benifit of the copyBits primitive which can handle floats but not fractions. It has to be stated this way so we don't turn integers into floats.  See inheritance for backstop"
+
+ ^self asFloat!

Item was added:
+ ----- Method: Number>>asNonFraction (in category 'converting') -----
+ asNonFraction
+ "Answer the receiver. This is here for the benifit of the copyBits primitive which can handle floats but not fractions. It has to be stated this way so we don't turn integers into floats.  See Fraction for active method"
+
+ ^self !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-wiz.591.mcz

Bert Freudenberg
Hi Jerome,

could you change the method comments to something more generic like "Answer a number equivalent to the receiver that is not a fraction"?

Rationale: If this method was for the sole benefit of copyBits as stated in the comment, it should not live in the Kernel package, but but be an extension method of the Graphics package. However, it seems useful enough in general, so the comment should reflect that generality.

- Bert -

On 29.05.2011, at 20:03, [hidden email] wrote:

> A new version of Kernel was added to project The Inbox:
> http://source.squeak.org/inbox/Kernel-wiz.591.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-wiz.591
> Author: wiz
> Time: 29 May 2011, 4:11:53.048 pm
> UUID: 53586ad8-595c-477a-ac55-19471c286e26
> Ancestors: Kernel-eem.590
>
> This is asNonFraction defined only for Number and Fraction but not Object. Fractions are converted to Floats other numbers are left alone. Non numbers including nil  will raise a DNU.
>
> =============== Diff against Kernel-eem.590 ===============
>
> Item was added:
> + ----- Method: Fraction>>asNonFraction (in category 'converting') -----
> + asNonFraction
> + "Answer the receiver asFloat. This is here for the benifit of the copyBits primitive which can handle floats but not fractions. It has to be stated this way so we don't turn integers into floats.  See inheritance for backstop"
> +
> + ^self asFloat!
>
> Item was added:
> + ----- Method: Number>>asNonFraction (in category 'converting') -----
> + asNonFraction
> + "Answer the receiver. This is here for the benifit of the copyBits primitive which can handle floats but not fractions. It has to be stated this way so we don't turn integers into floats.  See Fraction for active method"
> +
> + ^self !
>
>