The Trunk: EToys-topa.123.mcz

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

The Trunk: EToys-topa.123.mcz

commits-2
Tobias Pape uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-topa.123.mcz

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

Name: EToys-topa.123
Author: topa
Time: 7 April 2015, 2:37:32.593 pm
UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
Ancestors: EToys-topa.122

the ifPresent: part needs a block argument

=============== Diff against EToys-topa.122 ===============

Item was changed:
  ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
  expectedFailures
 
  ^ super expectedFailures,
  (self class environment
  at: #BaseSoundSystem
+ ifPresent: [:e| #()]
- ifPresent: [#()]
  ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Levente Uzonyi-2
What's wrong with #hasClassNamed:?

Levente

On Tue, 7 Apr 2015, [hidden email] wrote:

> Tobias Pape uploaded a new version of EToys to project The Trunk:
> http://source.squeak.org/trunk/EToys-topa.123.mcz
>
> ==================== Summary ====================
>
> Name: EToys-topa.123
> Author: topa
> Time: 7 April 2015, 2:37:32.593 pm
> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
> Ancestors: EToys-topa.122
>
> the ifPresent: part needs a block argument
>
> =============== Diff against EToys-topa.122 ===============
>
> Item was changed:
>  ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>  expectedFailures
>
>   ^ super expectedFailures,
>   (self class environment
>   at: #BaseSoundSystem
> + ifPresent: [:e| #()]
> - ifPresent: [#()]
>   ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Tobias Pape

On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:

> What's wrong with #hasClassNamed:?

From my POV, it takes a String, and we wanted a symbol here ;)
Also, I wanted t be conisten with #setUP

>
> Levente
>
> On Tue, 7 Apr 2015, [hidden email] wrote:
>
>> Tobias Pape uploaded a new version of EToys to project The Trunk:
>> http://source.squeak.org/trunk/EToys-topa.123.mcz
>>
>> ==================== Summary ====================
>>
>> Name: EToys-topa.123
>> Author: topa
>> Time: 7 April 2015, 2:37:32.593 pm
>> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
>> Ancestors: EToys-topa.122
>>
>> the ifPresent: part needs a block argument
>>
>> =============== Diff against EToys-topa.122 ===============
>>
>> Item was changed:
>> ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>> expectedFailures
>>
>> ^ super expectedFailures,
>> (self class environment
>> at: #BaseSoundSystem
>> + ifPresent: [:e| #()]
>> - ifPresent: [#()]
>> ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Levente Uzonyi-2
But at the same time we want to minimize the usage of the dictionary API
of the Environments.
And Symbols are still Strings. :)

Levente

On Tue, 7 Apr 2015, Tobias Pape wrote:

>
> On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:
>
>> What's wrong with #hasClassNamed:?
>
> From my POV, it takes a String, and we wanted a symbol here ;)
> Also, I wanted t be conisten with #setUP
>
>>
>> Levente
>>
>> On Tue, 7 Apr 2015, [hidden email] wrote:
>>
>>> Tobias Pape uploaded a new version of EToys to project The Trunk:
>>> http://source.squeak.org/trunk/EToys-topa.123.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: EToys-topa.123
>>> Author: topa
>>> Time: 7 April 2015, 2:37:32.593 pm
>>> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
>>> Ancestors: EToys-topa.122
>>>
>>> the ifPresent: part needs a block argument
>>>
>>> =============== Diff against EToys-topa.122 ===============
>>>
>>> Item was changed:
>>> ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>>> expectedFailures
>>>
>>> ^ super expectedFailures,
>>> (self class environment
>>> at: #BaseSoundSystem
>>> + ifPresent: [:e| #()]
>>> - ifPresent: [#()]
>>> ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Tobias Pape

On 07.04.2015, at 17:24, Levente Uzonyi <[hidden email]> wrote:

> But at the same time we want to minimize the usage of the dictionary API of the Environments.

Do we?

> And Symbols are still Strings. :)

I disagree.

Best
        -Tobias

>
> Levente
>
> On Tue, 7 Apr 2015, Tobias Pape wrote:
>
>>
>> On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:
>>
>>> What's wrong with #hasClassNamed:?
>>
>> From my POV, it takes a String, and we wanted a symbol here ;)
>> Also, I wanted t be conisten with #setUP
>>
>>>
>>> Levente
>>>
>>> On Tue, 7 Apr 2015, [hidden email] wrote:
>>>
>>>> Tobias Pape uploaded a new version of EToys to project The Trunk:
>>>> http://source.squeak.org/trunk/EToys-topa.123.mcz
>>>>
>>>> ==================== Summary ====================
>>>>
>>>> Name: EToys-topa.123
>>>> Author: topa
>>>> Time: 7 April 2015, 2:37:32.593 pm
>>>> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
>>>> Ancestors: EToys-topa.122
>>>>
>>>> the ifPresent: part needs a block argument
>>>>
>>>> =============== Diff against EToys-topa.122 ===============
>>>>
>>>> Item was changed:
>>>> ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>>>> expectedFailures
>>>>
>>>> ^ super expectedFailures,
>>>> (self class environment
>>>> at: #BaseSoundSystem
>>>> + ifPresent: [:e| #()]
>>>> - ifPresent: [#()]
>>>> ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Bert Freudenberg
On 07.04.2015, at 17:49, Tobias Pape <[hidden email]> wrote:

>
> On 07.04.2015, at 17:24, Levente Uzonyi <[hidden email]> wrote:
>
>> But at the same time we want to minimize the usage of the dictionary API of the Environments.
>
> Do we?
>
>> And Symbols are still Strings. :)
>
> I disagree.
In Smalltalk, they are.

- Bert -






smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Levente Uzonyi-2
In reply to this post by Tobias Pape
On Tue, 7 Apr 2015, Tobias Pape wrote:

>
> On 07.04.2015, at 17:24, Levente Uzonyi <[hidden email]> wrote:
>
>> But at the same time we want to minimize the usage of the dictionary API of the Environments.
>
> Do we?

I could only quote myself here, so someone else will have to answer this.

>
>> And Symbols are still Strings. :)
>
> I disagree.

#aSymbol isKindOf: String. "==> true"

Should the code be portable to other Smalltalk dialects?
Do we plan to change the superclass of Symbol?
Is there any other reason to not use symbols as strings in Squeak?


Levente

>
> Best
> -Tobias
>
>>
>> Levente
>>
>> On Tue, 7 Apr 2015, Tobias Pape wrote:
>>
>>>
>>> On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:
>>>
>>>> What's wrong with #hasClassNamed:?
>>>
>>> From my POV, it takes a String, and we wanted a symbol here ;)
>>> Also, I wanted t be conisten with #setUP
>>>
>>>>
>>>> Levente
>>>>
>>>> On Tue, 7 Apr 2015, [hidden email] wrote:
>>>>
>>>>> Tobias Pape uploaded a new version of EToys to project The Trunk:
>>>>> http://source.squeak.org/trunk/EToys-topa.123.mcz
>>>>>
>>>>> ==================== Summary ====================
>>>>>
>>>>> Name: EToys-topa.123
>>>>> Author: topa
>>>>> Time: 7 April 2015, 2:37:32.593 pm
>>>>> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
>>>>> Ancestors: EToys-topa.122
>>>>>
>>>>> the ifPresent: part needs a block argument
>>>>>
>>>>> =============== Diff against EToys-topa.122 ===============
>>>>>
>>>>> Item was changed:
>>>>> ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>>>>> expectedFailures
>>>>>
>>>>> ^ super expectedFailures,
>>>>> (self class environment
>>>>> at: #BaseSoundSystem
>>>>> + ifPresent: [:e| #()]
>>>>> - ifPresent: [#()]
>>>>> ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Tobias Pape

On 07.04.2015, at 18:07, Levente Uzonyi <[hidden email]> wrote:

> On Tue, 7 Apr 2015, Tobias Pape wrote:
>
>>
>> On 07.04.2015, at 17:24, Levente Uzonyi <[hidden email]> wrote:
>>
>>> But at the same time we want to minimize the usage of the dictionary API of the Environments.
>>
>> Do we?
>
> I could only quote myself here, so someone else will have to answer this.
>
>>
>>> And Symbols are still Strings. :)
>>
>> I disagree.
>
> #aSymbol isKindOf: String. "==> true"
>
> Should the code be portable to other Smalltalk dialects?
> Do we plan to change the superclass of Symbol?
> Is there any other reason to not use symbols as strings in Squeak?
>

Just feel free to change TileMorphTest>>#expectedFailures and TileMorphTest>>#setUp to your liking.
We could also just remove it.

best
        -tobias

>
> Levente
>
>>
>> Best
>> -Tobias
>>
>>>
>>> Levente
>>>
>>> On Tue, 7 Apr 2015, Tobias Pape wrote:
>>>
>>>>
>>>> On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:
>>>>
>>>>> What's wrong with #hasClassNamed:?
>>>>
>>>> From my POV, it takes a String, and we wanted a symbol here ;)
>>>> Also, I wanted t be conisten with #setUP
>>>>
>>>>>
>>>>> Levente
>>>>>
>>>>> On Tue, 7 Apr 2015, [hidden email] wrote:



Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Tobias Pape
In reply to this post by Bert Freudenberg

On 07.04.2015, at 18:06, Bert Freudenberg <[hidden email]> wrote:

> On 07.04.2015, at 17:49, Tobias Pape <[hidden email]> wrote:
>>
>> On 07.04.2015, at 17:24, Levente Uzonyi <[hidden email]> wrote:
>>
>>> But at the same time we want to minimize the usage of the dictionary API of the Environments.
>>
>> Do we?
>>
>>> And Symbols are still Strings. :)
>>
>> I disagree.
>
> In Smalltalk, they are.
For what value of smalltalk? Ansi says:




Also, I have to apologize, In GemStone, Symbol is a subclass of String, yes.

Best
        -Tobias :)



Bildschirmfoto 2015-04-07 um 18.39.22.PNG (72K) Download Attachment
signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Eliot Miranda-2
In reply to this post by Tobias Pape
Hi Tobias,

     hasClassNamed: and symbols are to be preferred to avoid the cost of interning.  The class name keys are, as they should be, symbols, and we don't want to pay the cost of interning to do that lookup.  And I agree with Levente that symbols are searched for when SystemNavigation is used to find such soft class references.  Your string position is understandable but needlessly expensive.  The use of symbols (and the assumption that they're strings) is simple and efficient.

Eliot (phone)

On Apr 7, 2015, at 8:21 AM, Tobias Pape <[hidden email]> wrote:

>
> On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:
>
>> What's wrong with #hasClassNamed:?
>
> From my POV, it takes a String, and we wanted a symbol here ;)
> Also, I wanted t be conisten with #setUP
>
>>
>> Levente
>>
>> On Tue, 7 Apr 2015, [hidden email] wrote:
>>
>>> Tobias Pape uploaded a new version of EToys to project The Trunk:
>>> http://source.squeak.org/trunk/EToys-topa.123.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: EToys-topa.123
>>> Author: topa
>>> Time: 7 April 2015, 2:37:32.593 pm
>>> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
>>> Ancestors: EToys-topa.122
>>>
>>> the ifPresent: part needs a block argument
>>>
>>> =============== Diff against EToys-topa.122 ===============
>>>
>>> Item was changed:
>>> ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>>> expectedFailures
>>>
>>>    ^ super expectedFailures,
>>>        (self class environment
>>>            at: #BaseSoundSystem
>>> +            ifPresent: [:e| #()]
>>> -            ifPresent: [#()]
>>>            ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Tobias Pape
Hi Eliot

On 08.04.2015, at 09:56, Eliot Miranda <[hidden email]> wrote:

> Hi Tobias,
>
>     hasClassNamed: and symbols are to be preferred to avoid the cost of interning.  

I don't quite understand that. When I use a symbol, it already has been interned,
either during method-compilation or because I created it. How is interning avoided here?
  I thought this was the very reason to not pass a Symbol to hasClassNamed?
What about its sibling classNamed: (or classOrTraitNamed:)?

> The class name keys are, as they should be, symbols, and we don't want to pay the cost of interning to do that lookup.  And I agree with Levente that symbols are searched for when SystemNavigation is used to find such soft class references.

Right, I did not argue against that :)

>  Your string position is understandable but needlessly expensive.  The use of symbols (and the assumption that they're strings) is simple and efficient.

Don't get me wrong, I think that this assumption is worthwhile in (at least)
Core Squeak, yes.

Best
        -Tobias :)

>
> Eliot (phone)
>
> On Apr 7, 2015, at 8:21 AM, Tobias Pape <[hidden email]> wrote:
>
>>
>> On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:
>>
>>> What's wrong with #hasClassNamed:?
>>
>> From my POV, it takes a String, and we wanted a symbol here ;)
>> Also, I wanted t be conisten with #setUP
>>
>>>
>>> Levente
>>>
>>> On Tue, 7 Apr 2015, [hidden email] wrote:
>>>
>>>> Tobias Pape uploaded a new version of EToys to project The Trunk:
>>>> http://source.squeak.org/trunk/EToys-topa.123.mcz
>>>>
>>>> ==================== Summary ====================
>>>>
>>>> Name: EToys-topa.123
>>>> Author: topa
>>>> Time: 7 April 2015, 2:37:32.593 pm
>>>> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
>>>> Ancestors: EToys-topa.122
>>>>
>>>> the ifPresent: part needs a block argument
>>>>
>>>> =============== Diff against EToys-topa.122 ===============
>>>>
>>>> Item was changed:
>>>> ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>>>> expectedFailures
>>>>
>>>>   ^ super expectedFailures,
>>>>       (self class environment
>>>>           at: #BaseSoundSystem
>>>> +            ifPresent: [:e| #()]
>>>> -            ifPresent: [#()]
>>>>           ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!



Reply | Threaded
Open this post in threaded view
|

Class names, Symbols, and Strings (was: The Trunk: EToys-topa.123.mcz)

Bert Freudenberg
On 08.04.2015, at 10:09, Tobias Pape <[hidden email]> wrote:

>
> Hi Eliot
>
> On 08.04.2015, at 09:56, Eliot Miranda <[hidden email]> wrote:
>
>> Hi Tobias,
>>
>>    hasClassNamed: and symbols are to be preferred to avoid the cost of interning.  
>
> I don't quite understand that. When I use a symbol, it already has been interned,
> either during method-compilation or because I created it. How is interning avoided here?
>  I thought this was the very reason to not pass a Symbol to hasClassNamed?
My reason for preferring a Symbol over a String is to avoid paying the storage space twice. With a Symbol, the literal will be shared.

> What about its sibling classNamed: (or classOrTraitNamed:)?

That implementation uses asSymbol anyway, so it's actually preferable to pass a Symbol.

- Bert -

PS: Meaningful Subjects Are A Good Idea™


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: EToys-topa.123.mcz

Eliot Miranda-2
In reply to this post by Tobias Pape


On Wed, Apr 8, 2015 at 1:09 AM, Tobias Pape <[hidden email]> wrote:
Hi Eliot

On 08.04.2015, at 09:56, Eliot Miranda <[hidden email]> wrote:

> Hi Tobias,
>
>     hasClassNamed: and symbols are to be preferred to avoid the cost of interning.

I don't quite understand that. When I use a symbol, it already has been interned,
either during method-compilation or because I created it. How is interning avoided here?
  I thought this was the very reason to not pass a Symbol to hasClassNamed?
What about its sibling classNamed: (or classOrTraitNamed:)?

> The class name keys are, as they should be, symbols, and we don't want to pay the cost of interning to do that lookup.  And I agree with Levente that symbols are searched for when SystemNavigation is used to find such soft class references.

Right, I did not argue against that :)

I misunderstood.  So this discussion is just about the argument name?  In any case I'm with Bert for using symbols to refer to class names whereever possible.
 

>  Your string position is understandable but needlessly expensive.  The use of symbols (and the assumption that they're strings) is simple and efficient.

Don't get me wrong, I think that this assumption is worthwhile in (at least)
Core Squeak, yes.

Best
        -Tobias :)

>
> Eliot (phone)
>
> On Apr 7, 2015, at 8:21 AM, Tobias Pape <[hidden email]> wrote:
>
>>
>> On 07.04.2015, at 17:16, Levente Uzonyi <[hidden email]> wrote:
>>
>>> What's wrong with #hasClassNamed:?
>>
>> From my POV, it takes a String, and we wanted a symbol here ;)
>> Also, I wanted t be conisten with #setUP
>>
>>>
>>> Levente
>>>
>>> On Tue, 7 Apr 2015, [hidden email] wrote:
>>>
>>>> Tobias Pape uploaded a new version of EToys to project The Trunk:
>>>> http://source.squeak.org/trunk/EToys-topa.123.mcz
>>>>
>>>> ==================== Summary ====================
>>>>
>>>> Name: EToys-topa.123
>>>> Author: topa
>>>> Time: 7 April 2015, 2:37:32.593 pm
>>>> UUID: 71b565ae-57ad-4d33-91d2-d6bfeec75490
>>>> Ancestors: EToys-topa.122
>>>>
>>>> the ifPresent: part needs a block argument
>>>>
>>>> =============== Diff against EToys-topa.122 ===============
>>>>
>>>> Item was changed:
>>>> ----- Method: TileMorphTest>>expectedFailures (in category 'testing') -----
>>>> expectedFailures
>>>>
>>>>   ^ super expectedFailures,
>>>>       (self class environment
>>>>           at: #BaseSoundSystem
>>>> +            ifPresent: [:e| #()]
>>>> -            ifPresent: [#()]
>>>>           ifAbsent: [#(testSoundTile) "Only this test depends on Sound"])!






--
best,
Eliot