The Trunk: Traits-nice.300.mcz

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

The Trunk: Traits-nice.300.mcz

commits-2
Nicolas Cellier uploaded a new version of Traits to project The Trunk:
http://source.squeak.org/trunk/Traits-nice.300.mcz

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

Name: Traits-nice.300
Author: nice
Time: 2 November 2013, 12:30:54.426 am
UUID: fced9294-e4ef-4fb3-b2db-6e8da24a6e82
Ancestors: Traits-nice.299

Avoid spurious warnings in Trait>>rename: when an Undeclared isn't really referenced.

This may help some SUnit tests to pass.

=============== Diff against Traits-nice.299 ===============

Item was changed:
  ----- Method: Trait>>rename: (in category 'initialize') -----
  rename: aString
  "The new name of the receiver is the argument, aString."
 
  | newName |
  (newName := aString asSymbol) ~= self name
  ifFalse: [^ self].
  (self environment includesKey: newName)
  ifTrue: [^ self error: newName , ' already exists'].
+ ((self environment undeclared includesKey: newName)
+ and: [(self environment undeclared unreferencedKeys includes: newName) not])
- (self environment undeclared includesKey: newName)
  ifTrue: [self inform: 'There are references to, ' , aString printString , '
  from Undeclared. Check them after this change.'].
  self environment renameClass: self as: newName.
  name := newName!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.300.mcz

Frank Shearar-3
On 1 November 2013 23:31,  <[hidden email]> wrote:

> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
> http://source.squeak.org/trunk/Traits-nice.300.mcz
>
> ==================== Summary ====================
>
> Name: Traits-nice.300
> Author: nice
> Time: 2 November 2013, 12:30:54.426 am
> UUID: fced9294-e4ef-4fb3-b2db-6e8da24a6e82
> Ancestors: Traits-nice.299
>
> Avoid spurious warnings in Trait>>rename: when an Undeclared isn't really referenced.
>
> This may help some SUnit tests to pass.
>
> =============== Diff against Traits-nice.299 ===============
>
> Item was changed:
>   ----- Method: Trait>>rename: (in category 'initialize') -----
>   rename: aString
>         "The new name of the receiver is the argument, aString."
>
>         | newName |
>         (newName := aString asSymbol) ~= self name
>                 ifFalse: [^ self].
>         (self environment includesKey: newName)
>                 ifTrue: [^ self error: newName , ' already exists'].
> +       ((self environment undeclared includesKey: newName)
> +               and: [(self environment undeclared unreferencedKeys includes: newName) not])
> -       (self environment undeclared includesKey: newName)
>                 ifTrue: [self inform: 'There are references to, ' , aString printString , '
>   from Undeclared. Check them after this change.'].
>         self environment renameClass: self as: newName.
>         name := newName!

There's a lot of text in this method. I think it would read more
easily if we added an "undeclared := self environment undeclared" var.
The + lines above would then be something like

((undeclared includesKey: newName)
    and: [(undeclared unreferencedKeys includes: newName) not])
        ifTrue: []

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Traits-nice.300.mcz

Nicolas Cellier
Yes, it clearly smells.
The second time I put this in a method, I had the same reflexion.
It's a quick "fix", and I didn't want to delay its application.
But anyway, it's more a workaround than a fix and we'll have to perform another pass...


2013/11/2 Frank Shearar <[hidden email]>
On 1 November 2013 23:31,  <[hidden email]> wrote:
> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
> http://source.squeak.org/trunk/Traits-nice.300.mcz
>
> ==================== Summary ====================
>
> Name: Traits-nice.300
> Author: nice
> Time: 2 November 2013, 12:30:54.426 am
> UUID: fced9294-e4ef-4fb3-b2db-6e8da24a6e82
> Ancestors: Traits-nice.299
>
> Avoid spurious warnings in Trait>>rename: when an Undeclared isn't really referenced.
>
> This may help some SUnit tests to pass.
>
> =============== Diff against Traits-nice.299 ===============
>
> Item was changed:
>   ----- Method: Trait>>rename: (in category 'initialize') -----
>   rename: aString
>         "The new name of the receiver is the argument, aString."
>
>         | newName |
>         (newName := aString asSymbol) ~= self name
>                 ifFalse: [^ self].
>         (self environment includesKey: newName)
>                 ifTrue: [^ self error: newName , ' already exists'].
> +       ((self environment undeclared includesKey: newName)
> +               and: [(self environment undeclared unreferencedKeys includes: newName) not])
> -       (self environment undeclared includesKey: newName)
>                 ifTrue: [self inform: 'There are references to, ' , aString printString , '
>   from Undeclared. Check them after this change.'].
>         self environment renameClass: self as: newName.
>         name := newName!

There's a lot of text in this method. I think it would read more
easily if we added an "undeclared := self environment undeclared" var.
The + lines above would then be something like

((undeclared includesKey: newName)
    and: [(undeclared unreferencedKeys includes: newName) not])
        ifTrue: []

frank