The Inbox: Collections-JH.814.mcz

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

The Inbox: Collections-JH.814.mcz

commits-2
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-JH.814.mcz

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

Name: Collections-JH.814
Author: JH
Time: 24 January 2019, 10:32:33.157023 am
UUID: 2981cec1-a155-7840-bbff-827a8f3387bb
Ancestors: Collections-eem.806

Add check to FloatArray primitive fallback code to ensure that receiver and argument have the same size (argument was previously allowed to be larger than receiver, which does not make sense mathematically).

=============== Diff against Collections-eem.806 ===============

Item was changed:
  ----- Method: FloatArray>>primAddArray: (in category 'primitives-plugin') -----
  primAddArray: floatArray
 
  <primitive: 'primitiveAddFloatArray' module: 'FloatArrayPlugin'>
+ self size = floatArray size ifFalse:[^self error:'Must be equal size'].
  1 to: self size do:[:i| self at: i put: (self at: i) + (floatArray at: i)].!

Item was changed:
  ----- Method: FloatArray>>primDivArray: (in category 'primitives-plugin') -----
  primDivArray: floatArray
 
  <primitive: 'primitiveDivFloatArray' module: 'FloatArrayPlugin'>
+ self size = floatArray size ifFalse:[^self error:'Must be equal size'].
  1 to: self size do:[:i| self at: i put: (self at: i) / (floatArray at: i)].!

Item was changed:
  ----- Method: FloatArray>>primMulArray: (in category 'primitives-plugin') -----
  primMulArray: floatArray
 
  <primitive: 'primitiveMulFloatArray' module: 'FloatArrayPlugin'>
+ self size = floatArray size ifFalse:[^self error:'Must be equal size'].
  1 to: self size do:[:i| self at: i put: (self at: i) * (floatArray at: i)].!

Item was changed:
  ----- Method: FloatArray>>primSubArray: (in category 'primitives-plugin') -----
  primSubArray: floatArray
 
  <primitive: 'primitiveSubFloatArray' module: 'FloatArrayPlugin'>
+ self size = floatArray size ifFalse:[^self error:'Must be equal size'].
  1 to: self size do:[:i| self at: i put: (self at: i) - (floatArray at: i)].!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Collections-JH.814.mcz

Chris Muller-3
In the spirit of #emptyCheck, how about factoring that line into
#sizeCheck or something..?

On Thu, Jan 24, 2019 at 3:32 AM <[hidden email]> wrote:

>
> A new version of Collections was added to project The Inbox:
> http://source.squeak.org/inbox/Collections-JH.814.mcz
>
> ==================== Summary ====================
>
> Name: Collections-JH.814
> Author: JH
> Time: 24 January 2019, 10:32:33.157023 am
> UUID: 2981cec1-a155-7840-bbff-827a8f3387bb
> Ancestors: Collections-eem.806
>
> Add check to FloatArray primitive fallback code to ensure that receiver and argument have the same size (argument was previously allowed to be larger than receiver, which does not make sense mathematically).
>
> =============== Diff against Collections-eem.806 ===============
>
> Item was changed:
>   ----- Method: FloatArray>>primAddArray: (in category 'primitives-plugin') -----
>   primAddArray: floatArray
>
>         <primitive: 'primitiveAddFloatArray' module: 'FloatArrayPlugin'>
> +       self size = floatArray size ifFalse:[^self error:'Must be equal size'].
>         1 to: self size do:[:i| self at: i put: (self at: i) + (floatArray at: i)].!
>
> Item was changed:
>   ----- Method: FloatArray>>primDivArray: (in category 'primitives-plugin') -----
>   primDivArray: floatArray
>
>         <primitive: 'primitiveDivFloatArray' module: 'FloatArrayPlugin'>
> +       self size = floatArray size ifFalse:[^self error:'Must be equal size'].
>         1 to: self size do:[:i| self at: i put: (self at: i) / (floatArray at: i)].!
>
> Item was changed:
>   ----- Method: FloatArray>>primMulArray: (in category 'primitives-plugin') -----
>   primMulArray: floatArray
>
>         <primitive: 'primitiveMulFloatArray' module: 'FloatArrayPlugin'>
> +       self size = floatArray size ifFalse:[^self error:'Must be equal size'].
>         1 to: self size do:[:i| self at: i put: (self at: i) * (floatArray at: i)].!
>
> Item was changed:
>   ----- Method: FloatArray>>primSubArray: (in category 'primitives-plugin') -----
>   primSubArray: floatArray
>
>         <primitive: 'primitiveSubFloatArray' module: 'FloatArrayPlugin'>
> +       self size = floatArray size ifFalse:[^self error:'Must be equal size'].
>         1 to: self size do:[:i| self at: i put: (self at: i) - (floatArray at: i)].!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Collections-JH.814.mcz

marcel.taeumel
Yes, we might want to reduce the amound of duplicate error strings in the entire image. This explicit way, however, is consistent with SequenceableCollection >> #with:do:.

Am 25.01.2019 01:03:49 schrieb Chris Muller <[hidden email]>:

In the spirit of #emptyCheck, how about factoring that line into
#sizeCheck or something..?

On Thu, Jan 24, 2019 at 3:32 AM wrote:
>
> A new version of Collections was added to project The Inbox:
> http://source.squeak.org/inbox/Collections-JH.814.mcz
>
> ==================== Summary ====================
>
> Name: Collections-JH.814
> Author: JH
> Time: 24 January 2019, 10:32:33.157023 am
> UUID: 2981cec1-a155-7840-bbff-827a8f3387bb
> Ancestors: Collections-eem.806
>
> Add check to FloatArray primitive fallback code to ensure that receiver and argument have the same size (argument was previously allowed to be larger than receiver, which does not make sense mathematically).
>
> =============== Diff against Collections-eem.806 ===============
>
> Item was changed:
> ----- Method: FloatArray>>primAddArray: (in category 'primitives-plugin') -----
> primAddArray: floatArray
>
>
> + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> 1 to: self size do:[:i| self at: i put: (self at: i) + (floatArray at: i)].!
>
> Item was changed:
> ----- Method: FloatArray>>primDivArray: (in category 'primitives-plugin') -----
> primDivArray: floatArray
>
>
> + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> 1 to: self size do:[:i| self at: i put: (self at: i) / (floatArray at: i)].!
>
> Item was changed:
> ----- Method: FloatArray>>primMulArray: (in category 'primitives-plugin') -----
> primMulArray: floatArray
>
>
> + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> 1 to: self size do:[:i| self at: i put: (self at: i) * (floatArray at: i)].!
>
> Item was changed:
> ----- Method: FloatArray>>primSubArray: (in category 'primitives-plugin') -----
> primSubArray: floatArray
>
>
> + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> 1 to: self size do:[:i| self at: i put: (self at: i) - (floatArray at: i)].!
>
>



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Collections-JH.814.mcz

Chris Muller-4
> Yes, we might want to reduce the amound of duplicate error strings in the entire image.

Yes!

> This explicit way, however, is consistent with SequenceableCollection >> #with:do:.

If consistency is a goal, making SequenceableCollection >> #with:do:
call #sizeCheck too would provide more consistency, since what's there
is a different String literal message...

 - Chris

> Am 25.01.2019 01:03:49 schrieb Chris Muller <[hidden email]>:
>
> In the spirit of #emptyCheck, how about factoring that line into
> #sizeCheck or something..?
>
> On Thu, Jan 24, 2019 at 3:32 AM wrote:
> >
> > A new version of Collections was added to project The Inbox:
> > http://source.squeak.org/inbox/Collections-JH.814.mcz
> >
> > ==================== Summary ====================
> >
> > Name: Collections-JH.814
> > Author: JH
> > Time: 24 January 2019, 10:32:33.157023 am
> > UUID: 2981cec1-a155-7840-bbff-827a8f3387bb
> > Ancestors: Collections-eem.806
> >
> > Add check to FloatArray primitive fallback code to ensure that receiver and argument have the same size (argument was previously allowed to be larger than receiver, which does not make sense mathematically).
> >
> > =============== Diff against Collections-eem.806 ===============
> >
> > Item was changed:
> > ----- Method: FloatArray>>primAddArray: (in category 'primitives-plugin') -----
> > primAddArray: floatArray
> >
> >
> > + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> > 1 to: self size do:[:i| self at: i put: (self at: i) + (floatArray at: i)].!
> >
> > Item was changed:
> > ----- Method: FloatArray>>primDivArray: (in category 'primitives-plugin') -----
> > primDivArray: floatArray
> >
> >
> > + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> > 1 to: self size do:[:i| self at: i put: (self at: i) / (floatArray at: i)].!
> >
> > Item was changed:
> > ----- Method: FloatArray>>primMulArray: (in category 'primitives-plugin') -----
> > primMulArray: floatArray
> >
> >
> > + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> > 1 to: self size do:[:i| self at: i put: (self at: i) * (floatArray at: i)].!
> >
> > Item was changed:
> > ----- Method: FloatArray>>primSubArray: (in category 'primitives-plugin') -----
> > primSubArray: floatArray
> >
> >
> > + self size = floatArray size ifFalse:[^self error:'Must be equal size'].
> > 1 to: self size do:[:i| self at: i put: (self at: i) - (floatArray at: i)].!
> >
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Collections-JH.814.mcz

timrowledge


> On 2019-01-25, at 1:25 PM, Chris Muller <[hidden email]> wrote:
>
>> Yes, we might want to reduce the amound of duplicate error strings in the entire image.
>
> Yes!

Absolutely. Maybe a new exception with a suitable default message -
primAddArray: floatArray


+ self size = floatArray size ifFalse:[^ArraysMustBeEqualSizeError signal].
1 to: self size do:[:i| self at: i put: (self at: i) + (floatArray at: i)].!

Or something like that.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
"!" The strange little noise you make when you can't scream...



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Collections-JH.814.mcz

patrick.rein
Just a heads up, that I have already implemented the check. The implementation currently parallels the emptyCheck (see Collections-pre.818).

Bests
Patrick

>
>
>> On 2019-01-25, at 1:25 PM, Chris Muller <[hidden email]> wrote:
>>
>>> Yes, we might want to reduce the amound of duplicate error strings in the entire image.
>>
>> Yes!
>
>Absolutely. Maybe a new exception with a suitable default message -
>primAddArray: floatArray
>
>
>+ self size = floatArray size ifFalse:[^ArraysMustBeEqualSizeError signal].
>1 to: self size do:[:i| self at: i put: (self at: i) + (floatArray at: i)].!
>
>Or something like that.
>
>tim
>--
>tim Rowledge; [hidden email]; http://www.rowledge.org/tim
>"!" The strange little noise you make when you can't scream...
>
>
>