The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Classes as Namespaces

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Classes as Namespaces Posted: Jul 30, 2008 6:42 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Classes as Namespaces
Feed Title: Michael Lucas-Smith
Feed URL: http://www.michaellucassmith.com/site.atom
Feed Description: Smalltalk and my misinterpretations of life
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Michael Lucas-Smith

Advertisement

Sometimes, the VisualWorks namespace paradigm leaves a lot to be desired. For one - it promotes the idea that everything should be in a namespace that is publicly declared. That pretty much means installing code in a fake namespace doesn't work so well without a great deal of trickery.

To combat this, Smalltalk/X implemented namespaces simply as classes - you put a class inside another class, the parent class can reference the child class but the child class must fully qualify the parent class. The same approach is employed in Newspeak too.

Travis has said to me many times how much he likes this model and, to be honest, I think the model has some interesting merits too - though I'm not sure I'd want to throw away the existing namespace mechanism completely.

Today I wondered just how hard it would be to make classes act as namespaces in VisualWorks using the existing mechanism. As it turns out, it was pretty easy. ClassNamespaces (and ClassNamespaces-tests) are now in public store. There may be bugs but it seems to be working for me. The tests aren't unit tests, they're classes inside classes with various class lookups to make sure the scoping works the way I expect it would work.

Give this a go if you're interested and post your feedback as comments here or just email me directly. If you think this is the sort of thing that belongs in the base, please say so as well.

Read: Classes as Namespaces

Topic: Smalltalk Daily 7/28/08: Creating Windows Shortcuts Previous Topic   Next Topic Topic: Industry Misinterpretations 98: Where's My Food

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use