class name scoping

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

class name scoping

Mark Volkmann
What happens in Smalltalk if multiple categories contain a class with the same name? Is that allowed? If so, how do you specify which one you want?

---
Mark Volkmann



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: class name scoping

Göran Krampe
Hi!

Mark Volkmann <[hidden email]> wrote:
> What happens in Smalltalk if multiple categories contain a class with  
> the same name? Is that allowed? If so, how do you specify which one  
> you want?

Not allowed. Squeak has no namespaces. Categories have no "semantic"
meaning, it is only for organisation.

regards, Göran
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: class name scoping

Mark Volkmann
On Aug 13, 2007, at 8:24 AM, [hidden email] wrote:

Hi!

Mark Volkmann <[hidden email]> wrote:
What happens in Smalltalk if multiple categories contain a class with  
the same name? Is that allowed? If so, how do you specify which one  
you want?

Not allowed. Squeak has no namespaces. Categories have no "semantic"
meaning, it is only for organisation.

Interesting. So if I develop a Smalltalk library and you develop one and then someone decides to use both our libraries in their project then they have a problem if you and I chose the same name for one of our classes?

---
Mark Volkmann



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: class name scoping

Lukas Renggli
> Interesting. So if I develop a Smalltalk library and you develop one and
> then someone decides to use both our libraries in their project then they
> have a problem if you and I chose the same name for one of our classes?

That's why almost all Squeak libraries use a prefix for class names:

     http://wiki.squeak.org/squeak/3318

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: class name scoping

Göran Krampe
In reply to this post by Mark Volkmann
Hi!

Mark Volkmann <[hidden email]> wrote:
> Interesting. So if I develop a Smalltalk library and you develop one  
> and then someone decides to use both our libraries in their project  
> then they have a problem if you and I chose the same name for one of  
> our classes?

As Lukas wrote we tend to use prefixes.

This is a long standing discussion/debate on merits of namespace
solutions etc. I have my proposal with code to back it up here:

        http://swiki.krampe.se/gohu/32

regards, Göran

PS. Skip HTML in posts.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners