namespace collisions

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

namespace collisions

Chris Muller-3
Does Pharo have namespaces?

If not, may I request that we remember to apply due consideration when
choosing names for globals, including class-variables?

The top version of ScriptLoader in the Pharo repository consumes the
name #Repository, preventing any class or global from using that name.
 I am now faced with a namespace collision with another package that
wants to declare a class named Repository.

A class-var in "ScriptLoader" really doesn't need to consume such a
valuable name does it?  Can this be renamed to something more specific
to free up that name?

 - Chris

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: namespace collisions

Stéphane Ducasse
Yes we can.
Stef
On Sep 9, 2009, at 11:56 PM, Chris Muller wrote:

> Does Pharo have namespaces?
>
> If not, may I request that we remember to apply due consideration when
> choosing names for globals, including class-variables?
>
> The top version of ScriptLoader in the Pharo repository consumes the
> name #Repository, preventing any class or global from using that name.
> I am now faced with a namespace collision with another package that
> wants to declare a class named Repository.
>
> A class-var in "ScriptLoader" really doesn't need to consume such a
> valuable name does it?  Can this be renamed to something more specific
> to free up that name?
>
> - Chris
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: namespace collisions

Stéphane Ducasse
In reply to this post by Chris Muller-3
Chris

may be I'm not well woken up but do you imply that classVar binding  
are stored in the systemDictionary?
I imagine that we can still have two classes having the same classVar  
name Default without problem
so I'm confused.

Stef

On Sep 9, 2009, at 11:56 PM, Chris Muller wrote:

> Does Pharo have namespaces?
>
> If not, may I request that we remember to apply due consideration when
> choosing names for globals, including class-variables?
>
> The top version of ScriptLoader in the Pharo repository consumes the
> name #Repository, preventing any class or global from using that name.
> I am now faced with a namespace collision with another package that
> wants to declare a class named Repository.
>
> A class-var in "ScriptLoader" really doesn't need to consume such a
> valuable name does it?  Can this be renamed to something more specific
> to free up that name?
>
> - Chris
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: namespace collisions

Chris Muller-3
Ah, ok, I am confused too.  I can probably work around this, but..
The problem occurred when I tried to upgrade my version of
ScriptLoader.  I already had a class named #Repository in my image,
but when I tried to load the latest in the Pharo repository via MC, I
get the following stack trace.

I hadn't considered whether ClassVar names would or wouldn't clash
with Class names (not to mention which the compiler would interpret in
an ambiguous situation..), and and Squeak let me define a class and
class-var of the same name.  However, MC will not let me load
something because it found an existing #bindingOf: #Repository..

I can work around this, no need to rename that class-var..

Thanks..

ScriptLoader class(Object)>>error:
        Receiver: ScriptLoader
        Arguments and temporary variables:
                aString: 'Repository is defined elsewhere'
        Receiver's instance variables:
                superclass: Object
                methodDict: a MethodDictionary(size 961)
                format: 134
                instanceVariables: #('repository' 'inboxRepository')
                organization: ('accessing' gofer inboxRepository installer
repository repositor...etc...
                subclasses: nil
                name: #ScriptLoader
                classPool: nil
                sharedPools: nil
                environment: a SystemDictionary(lots of globals)
                category: #ScriptLoader
                traitComposition: nil
                localSelectors: nil

[] in ScriptLoader class(Class)>>declare: {[:var | (self bindingOf:
var) notNil   ifTrue: [self error: var , ' is defin...]}
        Arguments and temporary variables:
                varString: 'CurrentScriptVersionNumber PackagesBeforeLastLoad
Repository Curren...etc...
                newVars: #(#CurrentScriptVersionNumber #PackagesBeforeLastLoad
#Repository #Cur...etc...
                conflicts: false
                x: 'LogStream'
                var: #Repository

Array(SequenceableCollection)>>do:
        Receiver: #(#CurrentScriptVersionNumber #PackagesBeforeLastLoad
#Repository #CurrentUpdateVersionNum...etc...
        Arguments and temporary variables:
                aBlock: [] in ScriptLoader class(Class)>>declare: {[:var | (self
bindingOf: var...etc...
                index: 3
                indexLimiT: 5
        Receiver's instance variables:
#(#CurrentScriptVersionNumber #PackagesBeforeLastLoad #Repository
#CurrentUpdateVersionNum...etc...

ScriptLoader class(Class)>>declare:
        Receiver: ScriptLoader
        Arguments and temporary variables:
                varString: 'CurrentScriptVersionNumber PackagesBeforeLastLoad
Repository Curren...etc...
                newVars: #(#CurrentScriptVersionNumber #PackagesBeforeLastLoad
#Repository #Cur...etc...
                conflicts: false
                x: 'LogStream'
                var: #Repository
        Receiver's instance variables:
                superclass: Object
                methodDict: a MethodDictionary(size 961)
                format: 134
                instanceVariables: #('repository' 'inboxRepository')
                organization: ('accessing' gofer inboxRepository installer
repository repositor...etc...
                subclasses: nil
                name: #ScriptLoader
                classPool: nil
                sharedPools: nil
                environment: a SystemDictionary(lots of globals)
                category: #ScriptLoader
                traitComposition: nil
                localSelectors: nil


--- The full stack ---
ScriptLoader class(Object)>>error:
[] in ScriptLoader class(Class)>>declare: {[:var | (self bindingOf:
var) notNil   ifTrue: [self error: var , ' is defin...]}
Array(SequenceableCollection)>>do:
ScriptLoader class(Class)>>declare:
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[] in ClassBuilder>>name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe:
{[unsafe   ifFalse: [(self validateSuperclass: newSuper forSubclass:
oldClass...]}
BlockContext>>ensure:
ClassBuilder>>name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe:
ClassBuilder>>name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:
MCClassDefinition>>createClass
MCClassDefinition>>load
MCClassDefinition(MCDefinition)>>loadOver:
[] in MCPackageLoader>>basicLoad {[:ea | ea   loadOver: (self
obsoletionFor: ea)]}
[] in OrderedCollection(SequenceableCollection)>>do:displayingProgress:
{[:each :i |  bar value: i.  aBlock value: each]}
OrderedCollection(SequenceableCollection)>>withIndexDo:
[] in OrderedCollection(SequenceableCollection)>>do:displayingProgress:
{[:bar | self   withIndexDo: [:each :i |     bar value: i.    aBlock
value: e...]}
[] in ProgressInitiationException>>defaultMorphicAction {[result :=
workBlock value: progress]}
BlockContext>>ensure:
ProgressInitiationException>>defaultMorphicAction
ProgressInitiationException>>defaultAction
UndefinedObject>>handleSignal:
MethodContext(ContextPart)>>handleSignal:
MethodContext(ContextPart)>>handleSignal:
MethodContext(ContextPart)>>handleSignal:
ProgressInitiationException(Exception)>>signal
ProgressInitiationException>>display:at:from:to:during:
...etc...


On Thu, Sep 10, 2009 at 2:35 AM, Stéphane Ducasse
<[hidden email]> wrote:

> Chris
>
> may be I'm not well woken up but do you imply that classVar binding
> are stored in the systemDictionary?
> I imagine that we can still have two classes having the same classVar
> name Default without problem
> so I'm confused.
>
> Stef
>
> On Sep 9, 2009, at 11:56 PM, Chris Muller wrote:
>
>> Does Pharo have namespaces?
>>
>> If not, may I request that we remember to apply due consideration when
>> choosing names for globals, including class-variables?
>>
>> The top version of ScriptLoader in the Pharo repository consumes the
>> name #Repository, preventing any class or global from using that name.
>> I am now faced with a namespace collision with another package that
>> wants to declare a class named Repository.
>>
>> A class-var in "ScriptLoader" really doesn't need to consume such a
>> valuable name does it?  Can this be renamed to something more specific
>> to free up that name?
>>
>> - Chris
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: namespace collisions

Stéphane Ducasse
> Ah, ok, I am confused too.  I can probably work around this, but..
> The problem occurred when I tried to upgrade my version of
> ScriptLoader.  I already had a class named #Repository in my image,
> but when I tried to load the latest in the Pharo repository via MC, I
> get the following stack trace.
>
> I hadn't considered whether ClassVar names would or wouldn't clash
> with Class names (not to mention which the compiler would interpret in
> an ambiguous situation..), and and Squeak let me define a class and
> class-var of the same name.

in pharo too. this is strange I'm exhausted right now
so better go to sleep but this is strange.


> However, MC will not let me load
> something because it found an existing #bindingOf: #Repository..
>
> I can work around this, no need to rename that class-var..
>
> Thanks..
>
> ScriptLoader class(Object)>>error:
> Receiver: ScriptLoader
> Arguments and temporary variables:
> aString: 'Repository is defined elsewhere'
> Receiver's instance variables:
> superclass: Object
> methodDict: a MethodDictionary(size 961)
> format: 134
> instanceVariables: #('repository' 'inboxRepository')
> organization: ('accessing' gofer inboxRepository installer
> repository repositor...etc...
> subclasses: nil
> name: #ScriptLoader
> classPool: nil
> sharedPools: nil
> environment: a SystemDictionary(lots of globals)
> category: #ScriptLoader
> traitComposition: nil
> localSelectors: nil
>
> [] in ScriptLoader class(Class)>>declare: {[:var | (self bindingOf:
> var) notNil   ifTrue: [self error: var , ' is defin...]}
> Arguments and temporary variables:
> varString: 'CurrentScriptVersionNumber PackagesBeforeLastLoad
> Repository Curren...etc...
> newVars: #(#CurrentScriptVersionNumber #PackagesBeforeLastLoad
> #Repository #Cur...etc...
> conflicts: false
> x: 'LogStream'
> var: #Repository
>
> Array(SequenceableCollection)>>do:
> Receiver: #(#CurrentScriptVersionNumber #PackagesBeforeLastLoad
> #Repository #CurrentUpdateVersionNum...etc...
> Arguments and temporary variables:
> aBlock: [] in ScriptLoader class(Class)>>declare: {[:var | (self
> bindingOf: var...etc...
> index: 3
> indexLimiT: 5
> Receiver's instance variables:
> #(#CurrentScriptVersionNumber #PackagesBeforeLastLoad #Repository
> #CurrentUpdateVersionNum...etc...
>
> ScriptLoader class(Class)>>declare:
> Receiver: ScriptLoader
> Arguments and temporary variables:
> varString: 'CurrentScriptVersionNumber PackagesBeforeLastLoad
> Repository Curren...etc...
> newVars: #(#CurrentScriptVersionNumber #PackagesBeforeLastLoad
> #Repository #Cur...etc...
> conflicts: false
> x: 'LogStream'
> var: #Repository
> Receiver's instance variables:
> superclass: Object
> methodDict: a MethodDictionary(size 961)
> format: 134
> instanceVariables: #('repository' 'inboxRepository')
> organization: ('accessing' gofer inboxRepository installer
> repository repositor...etc...
> subclasses: nil
> name: #ScriptLoader
> classPool: nil
> sharedPools: nil
> environment: a SystemDictionary(lots of globals)
> category: #ScriptLoader
> traitComposition: nil
> localSelectors: nil
>
>
> --- The full stack ---
> ScriptLoader class(Object)>>error:
> [] in ScriptLoader class(Class)>>declare: {[:var | (self bindingOf:
> var) notNil   ifTrue: [self error: var , ' is defin...]}
> Array(SequenceableCollection)>>do:
> ScriptLoader class(Class)>>declare:
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> [] in  
> ClassBuilder
> >
> >
> name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe
> :
> {[unsafe   ifFalse: [(self validateSuperclass: newSuper forSubclass:
> oldClass...]}
> BlockContext>>ensure:
> ClassBuilder
> >
> >
> name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category:unsafe
> :
> ClassBuilder
> >
> >
> name:inEnvironment:subclassOf:type:instanceVariableNames:classVariableNames:poolDictionaries:category
> :
> MCClassDefinition>>createClass
> MCClassDefinition>>load
> MCClassDefinition(MCDefinition)>>loadOver:
> [] in MCPackageLoader>>basicLoad {[:ea | ea   loadOver: (self
> obsoletionFor: ea)]}
> [] in  
> OrderedCollection(SequenceableCollection)>>do:displayingProgress:
> {[:each :i |  bar value: i.  aBlock value: each]}
> OrderedCollection(SequenceableCollection)>>withIndexDo:
> [] in  
> OrderedCollection(SequenceableCollection)>>do:displayingProgress:
> {[:bar | self   withIndexDo: [:each :i |     bar value: i.    aBlock
> value: e...]}
> [] in ProgressInitiationException>>defaultMorphicAction {[result :=
> workBlock value: progress]}
> BlockContext>>ensure:
> ProgressInitiationException>>defaultMorphicAction
> ProgressInitiationException>>defaultAction
> UndefinedObject>>handleSignal:
> MethodContext(ContextPart)>>handleSignal:
> MethodContext(ContextPart)>>handleSignal:
> MethodContext(ContextPart)>>handleSignal:
> ProgressInitiationException(Exception)>>signal
> ProgressInitiationException>>display:at:from:to:during:
> ...etc...
>
>
> On Thu, Sep 10, 2009 at 2:35 AM, Stéphane Ducasse
> <[hidden email]> wrote:
>> Chris
>>
>> may be I'm not well woken up but do you imply that classVar binding
>> are stored in the systemDictionary?
>> I imagine that we can still have two classes having the same classVar
>> name Default without problem
>> so I'm confused.
>>
>> Stef
>>
>> On Sep 9, 2009, at 11:56 PM, Chris Muller wrote:
>>
>>> Does Pharo have namespaces?
>>>
>>> If not, may I request that we remember to apply due consideration  
>>> when
>>> choosing names for globals, including class-variables?
>>>
>>> The top version of ScriptLoader in the Pharo repository consumes the
>>> name #Repository, preventing any class or global from using that  
>>> name.
>>> I am now faced with a namespace collision with another package that
>>> wants to declare a class named Repository.
>>>
>>> A class-var in "ScriptLoader" really doesn't need to consume such a
>>> valuable name does it?  Can this be renamed to something more  
>>> specific
>>> to free up that name?
>>>
>>> - Chris
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project