[squeak-dev] The Trunk: Collections-ar.123.mcz

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

[squeak-dev] The Trunk: Collections-ar.123.mcz

commits-2
Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ar.123.mcz

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

Name: Collections-ar.123
Author: ar
Time: 1 September 2009, 12:38:06 pm
UUID: e7432274-e18a-1e43-a002-f3ab261bd465
Ancestors: Collections-tfel.122

Some fixes for RWBinaryOrTextStream which was too agressive optimizing some paths. Also fixes Character>>codePoint: which has no reason to raise an exception for values > 256.

=============== Diff against Collections-tfel.122 ===============

Item was added:
+ ----- Method: RWBinaryOrTextStream>>upTo: (in category 'accessing') -----
+ upTo: anObject
+ "Answer a subcollection from the current access position to the
+ occurrence (if any, but not inclusive) of anObject in the receiver. If
+ anObject is not in the collection, answer the entire rest of the receiver."
+ | newStream element species |
+ species := isBinary ifTrue:[ByteArray] ifFalse:[String].
+ newStream := WriteStream on: (species new: 100).
+ [self atEnd or: [(element := self next) = anObject]]
+ whileFalse: [newStream nextPut: element].
+ ^newStream contents!

Item was changed:
  ----- Method: RWBinaryOrTextStream>>next:putAll:startingAt: (in category 'writing') -----
  next: anInteger putAll: aCollection startingAt: startIndex
+ "Optimized for ByteArrays"
+ aCollection class == ByteArray
+ ifTrue:[^super next: anInteger putAll: aCollection asString startingAt: startIndex].
+ ^super next: anInteger putAll: aCollection startingAt: startIndex!
- ^super next: anInteger putAll: aCollection asString startingAt: startIndex!

Item was changed:
  ----- Method: RWBinaryOrTextStream>>nextPutAll: (in category 'writing') -----
  nextPutAll: aCollection
+ "Optimized for ByteArrays"
+ aCollection class == ByteArray
+ ifTrue:[^super nextPutAll: aCollection asString].
+ ^super nextPutAll: aCollection!
- ^super nextPutAll: aCollection asString!

Item was changed:
  ----- Method: Character class>>codePoint: (in category 'instance creation') -----
  codePoint: integer
+ "Return a character whose encoding value is integer.
+ For ansi compability."
+ ^self value: integer!
- "Return a character whose encoding value is integer."
- #Fundmntl.
- (0 > integer or: [255 < integer])
- ifTrue: [self error: 'parameter out of range 0..255'].
- ^ CharacterTable at: integer + 1!


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The Trunk: Collections-ar.123.mcz

Nicolas Cellier
2009/9/1  <[hidden email]>:

> Andreas Raab uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-ar.123.mcz
>
> ==================== Summary ====================
>
> Name: Collections-ar.123
> Author: ar
> Time: 1 September 2009, 12:38:06 pm
> UUID: e7432274-e18a-1e43-a002-f3ab261bd465
> Ancestors: Collections-tfel.122
>
> Some fixes for RWBinaryOrTextStream which was too agressive optimizing some paths. Also fixes Character>>codePoint: which has no reason to raise an exception for values > 256.
>

Don't know about the reason for such a limitation by just reading the diff...
However, there was some insurance that a Character of value < 256
would be unique.
Doesn't this matter?

Nicolas

> =============== Diff against Collections-tfel.122 ===============
>
> Item was added:
> + ----- Method: RWBinaryOrTextStream>>upTo: (in category 'accessing') -----
> + upTo: anObject
> +       "Answer a subcollection from the current access position to the
> +       occurrence (if any, but not inclusive) of anObject in the receiver. If
> +       anObject is not in the collection, answer the entire rest of the receiver."
> +       | newStream element species |
> +       species := isBinary ifTrue:[ByteArray] ifFalse:[String].
> +       newStream := WriteStream on: (species new: 100).
> +       [self atEnd or: [(element := self next) = anObject]]
> +               whileFalse: [newStream nextPut: element].
> +       ^newStream contents!
>
> Item was changed:
>  ----- Method: RWBinaryOrTextStream>>next:putAll:startingAt: (in category 'writing') -----
>  next: anInteger putAll: aCollection startingAt: startIndex
> +       "Optimized for ByteArrays"
> +       aCollection class == ByteArray
> +               ifTrue:[^super next: anInteger putAll: aCollection asString startingAt: startIndex].
> +       ^super next: anInteger putAll: aCollection startingAt: startIndex!
> -       ^super next: anInteger putAll: aCollection asString startingAt: startIndex!
>
> Item was changed:
>  ----- Method: RWBinaryOrTextStream>>nextPutAll: (in category 'writing') -----
>  nextPutAll: aCollection
> +       "Optimized for ByteArrays"
> +       aCollection class == ByteArray
> +               ifTrue:[^super nextPutAll: aCollection asString].
> +       ^super nextPutAll: aCollection!
> -       ^super nextPutAll: aCollection asString!
>
> Item was changed:
>  ----- Method: Character class>>codePoint: (in category 'instance creation') -----
>  codePoint: integer
> +       "Return a character whose encoding value is integer.
> +       For ansi compability."
> +       ^self value: integer!
> -       "Return a character whose encoding value is integer."
> -       #Fundmntl.
> -       (0 > integer or: [255 < integer])
> -               ifTrue: [self error: 'parameter out of range 0..255'].
> -       ^ CharacterTable at: integer + 1!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The Trunk: Collections-ar.123.mcz

Bert Freudenberg

On 01.09.2009, at 11:37, Nicolas Cellier wrote:

> 2009/9/1  <[hidden email]>:
>> Andreas Raab uploaded a new version of Collections to project The  
>> Trunk:
>> http://source.squeak.org/trunk/Collections-ar.123.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Collections-ar.123
>> Author: ar
>> Time: 1 September 2009, 12:38:06 pm
>> UUID: e7432274-e18a-1e43-a002-f3ab261bd465
>> Ancestors: Collections-tfel.122
>>
>> Some fixes for RWBinaryOrTextStream which was too agressive  
>> optimizing some paths. Also fixes Character>>codePoint: which has  
>> no reason to raise an exception for values > 256.
>>
>
> Don't know about the reason for such a limitation by just reading  
> the diff...
> However, there was some insurance that a Character of value < 256
> would be unique.
> Doesn't this matter?

#value: does this.

- Bert -

>
>>  ----- Method: Character class>>codePoint: (in category 'instance  
>> creation') -----
>>  codePoint: integer
>> +       "Return a character whose encoding value is integer.
>> +       For ansi compability."
>> +       ^self value: integer!
>> -       "Return a character whose encoding value is integer."
>> -       #Fundmntl.
>> -       (0 > integer or: [255 < integer])
>> -               ifTrue: [self error: 'parameter out of range  
>> 0..255'].
>> -       ^ CharacterTable at: integer + 1!
>>
>>
>>
>




Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The Trunk: Collections-ar.123.mcz

Nicolas Cellier
2009/9/1 Bert Freudenberg <[hidden email]>:

>
> On 01.09.2009, at 11:37, Nicolas Cellier wrote:
>
>> 2009/9/1  <[hidden email]>:
>>>
>>> Andreas Raab uploaded a new version of Collections to project The Trunk:
>>> http://source.squeak.org/trunk/Collections-ar.123.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: Collections-ar.123
>>> Author: ar
>>> Time: 1 September 2009, 12:38:06 pm
>>> UUID: e7432274-e18a-1e43-a002-f3ab261bd465
>>> Ancestors: Collections-tfel.122
>>>
>>> Some fixes for RWBinaryOrTextStream which was too agressive optimizing
>>> some paths. Also fixes Character>>codePoint: which has no reason to raise an
>>> exception for values > 256.
>>>
>>
>> Don't know about the reason for such a limitation by just reading the
>> diff...
>> However, there was some insurance that a Character of value < 256
>> would be unique.
>> Doesn't this matter?
>
> #value: does this.
>
> - Bert -
>

Does it mean #codePoint: is a low level (basic) creation message,
private and not to be used except in special circumstances like
creating the CharacterTable, while #value is the public API?

Or does it mean any code using the ANSI protocol #codePoint: wont'
share the uniqueness property of #value:?

The category and comment made me think it was the latter, thus my question.

Nicolas

>>
>>>  ----- Method: Character class>>codePoint: (in category 'instance
>>> creation') -----
>>>  codePoint: integer
>>> +       "Return a character whose encoding value is integer.
>>> +       For ansi compability."
>>> +       ^self value: integer!
>>> -       "Return a character whose encoding value is integer."
>>> -       #Fundmntl.
>>> -       (0 > integer or: [255 < integer])
>>> -               ifTrue: [self error: 'parameter out of range 0..255'].
>>> -       ^ CharacterTable at: integer + 1!
>>>
>>>
>>>
>>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The Trunk: Collections-ar.123.mcz

Bert Freudenberg

On 01.09.2009, at 13:51, Nicolas Cellier wrote:

> 2009/9/1 Bert Freudenberg <[hidden email]>:
>>
>> On 01.09.2009, at 11:37, Nicolas Cellier wrote:
>>
>>> 2009/9/1  <[hidden email]>:
>>>>
>>>> Andreas Raab uploaded a new version of Collections to project The  
>>>> Trunk:
>>>> http://source.squeak.org/trunk/Collections-ar.123.mcz
>>>>
>>>> ==================== Summary ====================
>>>>
>>>> Name: Collections-ar.123
>>>> Author: ar
>>>> Time: 1 September 2009, 12:38:06 pm
>>>> UUID: e7432274-e18a-1e43-a002-f3ab261bd465
>>>> Ancestors: Collections-tfel.122
>>>>
>>>> Some fixes for RWBinaryOrTextStream which was too agressive  
>>>> optimizing
>>>> some paths. Also fixes Character>>codePoint: which has no reason  
>>>> to raise an
>>>> exception for values > 256.
>>>>
>>>
>>> Don't know about the reason for such a limitation by just reading  
>>> the
>>> diff...
>>> However, there was some insurance that a Character of value < 256
>>> would be unique.
>>> Doesn't this matter?
>>
>> #value: does this.
>>
>> - Bert -
>>
>
> Does it mean #codePoint: is a low level (basic) creation message,
> private and not to be used except in special circumstances like
> creating the CharacterTable, while #value is the public API?
>
> Or does it mean any code using the ANSI protocol #codePoint: wont'
> share the uniqueness property of #value:?
>
> The category and comment made me think it was the latter, thus my  
> question.
>
> Nicolas

I don't understand. #codePoint: uses #value: so there is no difference.

- Bert -

>
>>>
>>>>  ----- Method: Character class>>codePoint: (in category 'instance
>>>> creation') -----
>>>>  codePoint: integer
>>>> +       "Return a character whose encoding value is integer.
>>>> +       For ansi compability."
>>>> +       ^self value: integer!
>>>> -       "Return a character whose encoding value is integer."
>>>> -       #Fundmntl.
>>>> -       (0 > integer or: [255 < integer])
>>>> -               ifTrue: [self error: 'parameter out of range  
>>>> 0..255'].
>>>> -       ^ CharacterTable at: integer + 1!
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>>
>>
>




Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: The Trunk: Collections-ar.123.mcz

Andreas.Raab
In reply to this post by Nicolas Cellier
Nicolas Cellier wrote:
> Does it mean #codePoint: is a low level (basic) creation message,
> private and not to be used except in special circumstances like
> creating the CharacterTable, while #value is the public API?
>
> Or does it mean any code using the ANSI protocol #codePoint: wont'
> share the uniqueness property of #value:?

Neither. #codePoint: is simply the ansi name for #value:. It shares all
the properties and just hadn't been updated with our switch to  Unicode.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] The Trunk: Collections-ar.123.mcz

Nicolas Cellier
In reply to this post by Bert Freudenberg
2009/9/1 Bert Freudenberg <[hidden email]>:

>
> On 01.09.2009, at 13:51, Nicolas Cellier wrote:
>
>> 2009/9/1 Bert Freudenberg <[hidden email]>:
>>>
>>> On 01.09.2009, at 11:37, Nicolas Cellier wrote:
>>>
>>>> 2009/9/1  <[hidden email]>:
>>>>>
>>>>> Andreas Raab uploaded a new version of Collections to project The
>>>>> Trunk:
>>>>> http://source.squeak.org/trunk/Collections-ar.123.mcz
>>>>>
>>>>> ==================== Summary ====================
>>>>>
>>>>> Name: Collections-ar.123
>>>>> Author: ar
>>>>> Time: 1 September 2009, 12:38:06 pm
>>>>> UUID: e7432274-e18a-1e43-a002-f3ab261bd465
>>>>> Ancestors: Collections-tfel.122
>>>>>
>>>>> Some fixes for RWBinaryOrTextStream which was too agressive optimizing
>>>>> some paths. Also fixes Character>>codePoint: which has no reason to
>>>>> raise an
>>>>> exception for values > 256.
>>>>>
>>>>
>>>> Don't know about the reason for such a limitation by just reading the
>>>> diff...
>>>> However, there was some insurance that a Character of value < 256
>>>> would be unique.
>>>> Doesn't this matter?
>>>
>>> #value: does this.
>>>
>>> - Bert -
>>>
>>
>> Does it mean #codePoint: is a low level (basic) creation message,
>> private and not to be used except in special circumstances like
>> creating the CharacterTable, while #value is the public API?
>>
>> Or does it mean any code using the ANSI protocol #codePoint: wont'
>> share the uniqueness property of #value:?
>>
>> The category and comment made me think it was the latter, thus my
>> question.
>>
>> Nicolas
>
> I don't understand. #codePoint: uses #value: so there is no difference.
>
> - Bert -
>

Thanks for your patience, I just realized it...

Nicoals

>>
>>>>
>>>>>  ----- Method: Character class>>codePoint: (in category 'instance
>>>>> creation') -----
>>>>>  codePoint: integer
>>>>> +       "Return a character whose encoding value is integer.
>>>>> +       For ansi compability."
>>>>> +       ^self value: integer!
>>>>> -       "Return a character whose encoding value is integer."
>>>>> -       #Fundmntl.
>>>>> -       (0 > integer or: [255 < integer])
>>>>> -               ifTrue: [self error: 'parameter out of range 0..255'].
>>>>> -       ^ CharacterTable at: integer + 1!
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>
>
>
>
>