Squeak and Namespaces

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
155 messages Options
12345 ... 8
Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Göran Krampe
Hi!

Howard Stearns <[hidden email]> wrote:
> I like Andreas' way of comparing what the proposal does to the cost of
> programmer changes. Determining whether his analysis is correct depends,

I agree that this is a trade off that we need to look at closely.

> I think, on what the proposal is actually doing, no?  I think it's
> possible to implement it in such a way that changes scale appropriately,
> but it is not yet clear to me that the code actually does things that way.
> -Howard

Ok, the code is small and it has class comments. If you (and or anyone
else) is serious about looking at it for such an analysis I can offer a
detailed writeup of EXACTLY what it does and how it works. After all, I
have spent enough hours on this that I do not wish to see it all wasted.
:)

Say "please do" and I will do it. :)

regards, Göran

Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

J J-6
In reply to this post by Andreas.Raab
+1


>From: Andreas Raab <[hidden email]>
>Reply-To: The general-purpose Squeak developers
>list<[hidden email]>
>To: The general-purpose Squeak developers
>list<[hidden email]>
>Subject: Re: Squeak and Namespaces
>Date: Wed, 29 Nov 2006 00:14:11 -0800
>
>Bert Freudenberg wrote:
>>Actually, that is the beauty of the proposal. Colons are already allowed
>>unquoted in a symbol. #My::Class is valid right now. In this proposal, the
>>compiler knows *nothing* about namespaces. It just permits a colon in a
>>global identifier. It's the only syntax change.
>
>Is that really true? I haven't looked at the code in a while but Goran used
>code that I had originally written and that code most certainly wasn't just
>permitting colons in a global identifier.  What it did do was introducing
>explicitly scoped variables and the result of Foo::Bar would depend on what
>is stored in Foo's scope under the name of #Bar and not on what is stored
>under Smalltalk at: #'Foo::Bar'. Of course, these two can be made the same
>by using the same association but that's still quite a bit different from
>just permitting colons in global names.
>
>Generally speaking, I'm -1 on the proposal, mostly because what the
>proposal doesn't achieve is to make a real step towards enabling
>scalability of development (which to me is really what we're after). That's
>because the *author* of some code still needs to find unique names
>(prefixes) that do not conflict with the rest of the world and that a
>"change of prefix" becomes very, very expensive because it's literally like
>renaming all of the classes at once (and consequently breaking all of the
>code that uses any name from that "prefix space").
>
>So basically you're trading the probability of conflicts (reduced due to
>the increased length in names) with the severity of conflicts (increased
>since changing the prefix is more expensive). It's an incremental approach
>that shifts tradeoffs but doesn't do anything to address the problem on a
>more fundamental basis (in all fairness, Goran never claimed it did but
>it's important in this discussion to understand what this proposal does and
>doesn't do to assess the impact of a change).
>
>But since it's "only" an incremental shift in tradeoffs I wonder if a
>language change (with significant costs for compatibility) is really
>justified. It seems to me that the practical gain is fairly minor and there
>is little motivation that I can see for anyone with a "serious" project to
>adopt this solution given that it will neither be portable nor
>backward-compatible. Put on top that the proposal deliberately doesn't take
>a stand on any general modularity issues (visibility, dependencies), then
>what exactly does one gain?
>
>To me the basic question here is: Is the prefix pattern so pervasive (and
>so problematic) that it deserves a special syntactic representation?
>Without taking a stab at the "real" problem (scalability of development) my
>answer is: No. It's a clever hack but nothing that I would loose sleep over
>if it weren't there (and I won't loose sleep over it being there either but
>I'd like us to be clear about what we're trying to achieve with adopting
>it).
>
>Cheers,
>   - Andreas
>

_________________________________________________________________
Stay up-to-date with your friends through the Windows Live Spaces friends
list.
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

J J-6
In reply to this post by Howard Stearns
My personal feeling on this is simply (as Step said) more research needs to
be done on this.  It feels like just trying to stick on a band aid.  But
this is less like a band aid and more like a tattoo.  Once you get
namespaces in, it's going to be pretty hard to take them out again if
research shows a better way.


>From: Howard Stearns <[hidden email]>
>Reply-To: The general-purpose Squeak developers
>list<[hidden email]>
>To: The general-purpose Squeak developers
>list<[hidden email]>
>Subject: Re: Squeak and Namespaces
>Date: Wed, 29 Nov 2006 09:32:41 -0600
>
>There's a heuristic that says incremental wins are good, but there are
>cases that don't apply. ("The world is better off without Saddam Hussein in
>power, no?") How do we know that this isn't leading the kind of "half a
>loaf" (non-)solution that I tend to worry about?
>
>Guy Steele once told me that the first thing he tries to get right about a
>language is the namespace. "Get that wrong and you'll never recover."
>
>I like Andreas' way of comparing what the proposal does to the cost of
>programmer changes. Determining whether his analysis is correct depends, I
>think, on what the proposal is actually doing, no?  I think it's possible
>to implement it in such a way that changes scale appropriately, but it is
>not yet clear to me that the code actually does things that way.
>-Howard
>
>Hernan Tylim wrote:
>>+1
>>
>>I like Goran solution. Its true that only  fixes the "prefix" problem  and
>>not the "namespace" problem, as Andreas pointed out. But to me that is not
>>a bad thing. its one step further to make Squeak a little more
>>comfortable.
>>
>>Regards,
>>Hernán
>>
>>On 29 Nov 2006 15:59:41 +0100, *Lex Spoon* <[hidden email]
>><mailto:[hidden email]>> wrote:
>>
>>     Andreas Raab <[hidden email] <mailto:[hidden email]>>
>>writes:
>>      > Generally speaking, I'm -1 on the proposal, mostly because what
>>the
>>      > proposal doesn't achieve is to make a real step towards enabling
>>      > scalability of development (which to me is really what we're
>>      > after). That's because the *author* of some code still needs to
>>find
>>      > unique names (prefixes) that do not conflict with the rest of the
>>      > world and that a "change of prefix" becomes very, very expensive
>>      > because it's literally like renaming all of the classes at once
>>(and
>>      > consequently breaking all of the code that uses any name from that
>>      > "prefix space").
>>
>>     It's a good observation.  Nonetheless, a hierarchical global
>>namespace
>>     seems a good step forward over a flat global namespace.  I do not
>>know
>>     about *this* system, but in general I would love if global variables
>>     and classes had long hierarchical names.  Using the existing class
>>     categories would seem great for that.
>>
>>     Right now, responsible programmers already fake a hierarchical
>>     namespace by putting prefixes in front of all their global names.  At
>>     the very least, it would be nice to support this practice in the
>>     programming language.  Ideally, you can even use long names
>>     ("Monticello") instead of short prefixes ("MC") and thus greatly
>>     reduce the chance of conflicts.
>>
>>     In practice, I bet it's not so hard to pick prefixes that are unique
>>     in the contexts the package will be used in.  Most of the time, you
>>     can just use the name of the project, which you have surely already
>>     gone to some efforts to try and make unique.  If nothing else, all
>>the
>>     open-source projects would benefit!
>>
>>
>>     Finally, keep in mind what the great naming systems you describe for
>>     the future would look like.  They will probably still have path-based
>>     identifiers!  The only difference from hierarchical names would
>>likely
>>     be that the path can start from somewhere other than a single global
>>     root.  Thus, a flexible hierarchical-naming system would seem like a
>>     good basis for the kind of naming system you are thinking about.  (In
>>     particular, you would want Foo::Bar to really mean "Bar" within
>>     "Foo"....)
>>
>>
>>
>>     -Lex
>>
>>
>>
>>
>>
>>--
>>Saludos,
>>Hernán
>>
>>
>>------------------------------------------------------------------------
>>
>>
>
>--
>Howard Stearns
>University of Wisconsin - Madison
>Division of Information Technology
>mailto:[hidden email]
>jabber:[hidden email]
>voice:+1-608-262-3724
>

_________________________________________________________________
Fixing up the home? Live Search can help
http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmemailtaglinenov06&FORM=WLMTAG


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Bert Freudenberg
On Nov 29, 2006, at 19:14 , J J wrote:

> Once you get namespaces in, it's going to be pretty hard to take  
> them out again if research shows a better way.

Is that so? Did you read the proposal? It does not look hard at all  
to back out again.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Göran Krampe
Hi!

Bert Freudenberg <[hidden email]> wrote:
> On Nov 29, 2006, at 19:14 , J J wrote:
>
> > Once you get namespaces in, it's going to be pretty hard to take  
> > them out again if research shows a better way.
>
> Is that so? Did you read the proposal? It does not look hard at all  
> to back out again.
>
> - Bert -

It would be trivial to back this out. But I guess most people arguing in
this thread haven't read either the article nor have they actually
looked at how it works or on the code itself. That is of course no
crime, but it would be easier to discuss it if people actually looked at
it. ;) ;)

But now I guess people are waiting for that walkthrough instead. :)

regards, Göran

Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

J J-6

Well I haven't looked at the implimentation details, no.  But what will be
the result is pretty obvious:  Right now you have a global namespace for all
classes in your image.  After the change you will have the same but instead
of MCDictionary or something it will be Monticello::Dictionary.  In other
words, the end result is just that the identifiers get longer and part of it
is implicit (i.e. you don't have to type it out usually).

The problem comes if we determine there is a much better way to do this.  We
can't just pull the namespaces out because then you will have 30 classes
named "Dictionary" and so on.  You will have to either touch them all or run
some script that appends the namespace on the front of the class and then
pull namespaces out.  I don't see either of these as doable, so I would
expect that once namespaces are in as default for a couple of years that is
what we are going to have from now on.

p.s. Does it get the namespace from the category?  If not, then that might
be something to think about. :)

>From: [hidden email]
>Reply-To: The general-purpose Squeak developers
>list<[hidden email]>
>To: The general-purpose Squeak developers
>list<[hidden email]>
>Subject: Re: Squeak and Namespaces
>Date: Wed, 29 Nov 2006 19:23:10 +0200
>
>Hi!
>
>Bert Freudenberg <[hidden email]> wrote:
> > On Nov 29, 2006, at 19:14 , J J wrote:
> >
> > > Once you get namespaces in, it's going to be pretty hard to take
> > > them out again if research shows a better way.
> >
> > Is that so? Did you read the proposal? It does not look hard at all
> > to back out again.
> >
> > - Bert -
>
>It would be trivial to back this out. But I guess most people arguing in
>this thread haven't read either the article nor have they actually
>looked at how it works or on the code itself. That is of course no
>crime, but it would be easier to discuss it if people actually looked at
>it. ;) ;)
>
>But now I guess people are waiting for that walkthrough instead. :)
>
>regards, Göran
>

_________________________________________________________________
Get the latest Windows Live Messenger 8.1 Beta version. Join now.
http://ideas.live.com


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Howard Stearns
In reply to this post by Göran Krampe
Looks like http://swiki.krampe.se/gohu/32 is the place for interested
parties to start. I'll put it on my list...

-H

[hidden email] wrote:

> Hi!
>
> Howard Stearns <[hidden email]> wrote:
>> I like Andreas' way of comparing what the proposal does to the cost of
>> programmer changes. Determining whether his analysis is correct depends,
>
> I agree that this is a trade off that we need to look at closely.
>
>> I think, on what the proposal is actually doing, no?  I think it's
>> possible to implement it in such a way that changes scale appropriately,
>> but it is not yet clear to me that the code actually does things that way.
>> -Howard
>
> Ok, the code is small and it has class comments. If you (and or anyone
> else) is serious about looking at it for such an analysis I can offer a
> detailed writeup of EXACTLY what it does and how it works. After all, I
> have spent enough hours on this that I do not wish to see it all wasted.
> :)
>
> Say "please do" and I will do it. :)
>
> regards, Göran
>

--
Howard Stearns
University of Wisconsin - Madison
Division of Information Technology
mailto:[hidden email]
jabber:[hidden email]
voice:+1-608-262-3724

Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Andreas.Raab
In reply to this post by Göran Krampe
Göran Krampe wrote:
> Foo::Bar == (Smalltalk at: #'Foo::Bar')
>
> In fact, I believe it was you Andreas that strongly suggested I should do
> it this way or take on a world of hurt. :)

Right, because it's the only way to make it so that the tools would
continue to work (since none of them is namespace aware).

>> So basically you're trading the probability of conflicts (reduced due to
>> the increased length in names) with the severity of conflicts (increased
>> since changing the prefix is more expensive).
>
> Ehm, how can it be more expensive? You mean compared to changing a single
> clashing class name?

Yes.

> And it *does* enable experimentation with prefix hiding (as I do in the
> tools part) or even experimenting with explicit imports (which I detest -
> and even Stephane now seems to think is a bad idea - but hey, feel free to
> play around).

Interesting. I'm just the other way around - I detest the idea of tools
rewriting source code under my feet and have code in the morning look
different from the same code in the afternoon, and have code that would
perfectly compile in the morning not compile in the same way in the
afternoon. And, I think imports are critical for scalability - because
they a) declare dependencies explicitly and b) allow the *user* of a
package/global to decide under which name to use them. The Python module
system works that way and it works great.

>> But since it's "only" an incremental shift in tradeoffs I wonder if a
>> language change (with significant costs for compatibility) is really
>> justified.
>
> Is the "language change" really of that kind? You can already have global
> names with : in them (which is funny) but if you try using that for a
> class you will get into trouble - a bug IIRC. So the small changes could
> even be considered to be a bug fix. :)

Hardly so. Code that doesn't work in any previous Squeak version and
doesn't work in any other dialect cannot be called a bug fix. It's a
significant syntax change.

> I agree that it deliberately does not involve dependencies, and only a
> little bit about visibility (the tool extensions I did have some
> visibility mechanisms) - because I think we can first add the *basic*
> notion of "named buckets" (=Namespace) and the *basic* syntax - without
> blending those two issues into the pot.
>
> If someone then would want to tie these Namespaces into dependencies,
> imports, modularity etc - then that is IMHO a "next step".

Yes, and that's the major reason why I'm not violently against it ;-) It
*may* be a step that needs to be taken now but I'm still wondering if we
won't be stuck forever at this point because even between the two of us
we can't agree on some very basic notions (imports or not). That's why
I'm judging this independently of the follow-on steps (which may or may
not happen) and that's why I'm wondering if changing the syntax at this
point is really worthwhile.

> BUT... if we intend to try to tackle those two beasts on the language
> level (instead of say SM or MC level), then perhaps a Namespace "notion"
> is a first step.
>
> And it doesn't seem to be a dangerous step either. But it will enable
> experimentation.

Experimentation is already enabled by having it loadable from SqueakMap.
And there are quite some risks associated with it most importantly that
of inventing an esoteric construct that nobody wants and nobody needs
because we may not understand the needed semantics well enough to make
it work out in the long term.

> To summarise - it reifies prefixes and makes them concrete and easy to
> manipulate, and easy to spot. That is all, and since we *have* these
> things already (prefixes) - then making them tangible, concrete, real
> objects seems like a useful thing to do.

I agree with all of that. What I'm not sure about is whether that (on
its own) is reason enough for a change in syntax. The trouble with
syntax is that once it's chosen and once a semantics is chosen we're
essentially set with it. So are we certain, are we *absolutely* certain
that we understand the semantics of that change well enough to say that
"yes this is the semantics we need for the follow-on steps and it is
extremely unlikely that we'll need anything but that"? I'm not.

Cheers,
   - Andreas


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

stephane ducasse
For me the key question is what do we ***really gain *** vs the cost?  
What is the difference between each of us
systematically using a prefix? Really I do not see. Because to avoid  
conflict SD:: should be reserved to me exactly as before.
Ok cool we will have a tool that will not show SD::. Do we want the  
complexity of having nested namespace/import.../

I'm not sure. Now do we want to have import per package and a scope  
per package. I do not know.

I think that simplicity is nice. When VW introduced namespaces we  
talked a lot and thought a lot of what they would
bring. I'm still really perplex by the introduced complexity vs the  
gain.

The key questions I'm trying to understand after all these years  
looking at module system/namespaces/... is how
do they help in achieving scalability. Do we need selector namespace?  
Also where do we put import is crucial: do we want to have more Unit  
like parametrized modules by having a bind outside the module or is  
the import declared inside the using package?

I discussed once with the schemers and they told me that in fact they  
had problems with their model and they had to modify it (but never  
publish the problems they got). They discovered that but only by  
building complex app and having to change them.

> Göran Krampe wrote:
>> Foo::Bar == (Smalltalk at: #'Foo::Bar')
>> In fact, I believe it was you Andreas that strongly suggested I  
>> should do
>> it this way or take on a world of hurt. :)
>
> Right, because it's the only way to make it so that the tools would  
> continue to work (since none of them is namespace aware).
>
>>> So basically you're trading the probability of conflicts (reduced  
>>> due to
>>> the increased length in names) with the severity of conflicts  
>>> (increased
>>> since changing the prefix is more expensive).
>> Ehm, how can it be more expensive? You mean compared to changing a  
>> single
>> clashing class name?
>
> Yes.
>
>> And it *does* enable experimentation with prefix hiding (as I do  
>> in the
>> tools part) or even experimenting with explicit imports (which I  
>> detest -
>> and even Stephane now seems to think is a bad idea - but hey, feel  
>> free to
>> play around).
>
> Interesting. I'm just the other way around - I detest the idea of  
> tools rewriting source code under my feet and have code in the  
> morning look different from the same code in the afternoon, and  
> have code that would perfectly compile in the morning not compile  
> in the same way in the afternoon. And, I think imports are critical  
> for scalability - because they a) declare dependencies explicitly  
> and b) allow the *user* of a package/global to decide under which  
> name to use them. The Python module system works that way and it  
> works great.
>
>>> But since it's "only" an incremental shift in tradeoffs I wonder  
>>> if a
>>> language change (with significant costs for compatibility) is really
>>> justified.
>> Is the "language change" really of that kind? You can already have  
>> global
>> names with : in them (which is funny) but if you try using that for a
>> class you will get into trouble - a bug IIRC. So the small changes  
>> could
>> even be considered to be a bug fix. :)
>
> Hardly so. Code that doesn't work in any previous Squeak version  
> and doesn't work in any other dialect cannot be called a bug fix.  
> It's a significant syntax change.
>
>> I agree that it deliberately does not involve dependencies, and  
>> only a
>> little bit about visibility (the tool extensions I did have some
>> visibility mechanisms) - because I think we can first add the *basic*
>> notion of "named buckets" (=Namespace) and the *basic* syntax -  
>> without
>> blending those two issues into the pot.
>> If someone then would want to tie these Namespaces into dependencies,
>> imports, modularity etc - then that is IMHO a "next step".
>
> Yes, and that's the major reason why I'm not violently against  
> it ;-) It *may* be a step that needs to be taken now but I'm still  
> wondering if we won't be stuck forever at this point because even  
> between the two of us we can't agree on some very basic notions  
> (imports or not). That's why I'm judging this independently of the  
> follow-on steps (which may or may not happen) and that's why I'm  
> wondering if changing the syntax at this point is really worthwhile.
>
>> BUT... if we intend to try to tackle those two beasts on the language
>> level (instead of say SM or MC level), then perhaps a Namespace  
>> "notion"
>> is a first step.
>> And it doesn't seem to be a dangerous step either. But it will enable
>> experimentation.
>
> Experimentation is already enabled by having it loadable from  
> SqueakMap. And there are quite some risks associated with it most  
> importantly that of inventing an esoteric construct that nobody  
> wants and nobody needs because we may not understand the needed  
> semantics well enough to make it work out in the long term.
>
>> To summarise - it reifies prefixes and makes them concrete and  
>> easy to
>> manipulate, and easy to spot. That is all, and since we *have* these
>> things already (prefixes) - then making them tangible, concrete, real
>> objects seems like a useful thing to do.
>
> I agree with all of that. What I'm not sure about is whether that  
> (on its own) is reason enough for a change in syntax. The trouble  
> with syntax is that once it's chosen and once a semantics is chosen  
> we're essentially set with it. So are we certain, are we  
> *absolutely* certain that we understand the semantics of that  
> change well enough to say that "yes this is the semantics we need  
> for the follow-on steps and it is extremely unlikely that we'll  
> need anything but that"? I'm not.
>
> Cheers,
>   - Andreas
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

stephane ducasse
In reply to this post by Andreas.Raab

On 29 nov. 06, at 19:54, Andreas Raab wrote:

> Interesting. I'm just the other way around - I detest the idea of  
> tools rewriting source code under my feet and have code in the  
> morning look different from the same code in the afternoon, and  
> have code that would perfectly compile in the morning not compile  
> in the same way in the afternoon.

:)
me too.

> And, I think imports are critical for scalability - because they a)  
> declare dependencies explicitly and b) allow the *user* of a  
> package/global to decide under which name to use them. The Python  
> module system works that way and it works great.

Can you give an example? Do you mean that you can alias them?

I thought that imports at the package level (may be with alias) would  
be a nice solution, since we could
have a flat view of the world inside a package or method and change  
the binding at the border (import statement).
So I could plug a different (but compatible input) to my package. Now  
after thinking a lot about that I'm not sure.
So I arrived to the conclusion that trying on a real system is the  
only way and I do not have the time for that so I'm stuck
with my thoughts :)

Stef


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Markus Gälli-3
In reply to this post by stephane ducasse

On Nov 29, 2006, at 9:42 AM, stephane ducasse wrote:

> PS: I have been working with VW recently and I really found  
> namespaces getting in my way all the time. Also the integration of  
> namespaces
> in VW is badly supported at the refactoring level and other tools.  
> So this is often a pain.

I agree with Andreas and Stef.
Working with Seaside in VW right now, I can find 3 (three!)  
"versions" of Date in VW (Core.Date, Squeak.Date and Seaside.Date)!
It kind of sucks to have to extend Seaside.Date with date method  
extensions already existing for Core.Date for this local shop.

Maybe namespaces of VW helped to get seaside ported to VW at all, but  
I'd prefer to have an ongoing desire to unify classes, which _are_  
intended to work the same.

Cheers,

Markus

Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Göran Krampe
Hi!

Markus Gaelli <[hidden email]> wrote:

> On Nov 29, 2006, at 9:42 AM, stephane ducasse wrote:
> > PS: I have been working with VW recently and I really found  
> > namespaces getting in my way all the time. Also the integration of  
> > namespaces
> > in VW is badly supported at the refactoring level and other tools.  
> > So this is often a pain.
>
> I agree with Andreas and Stef.
> Working with Seaside in VW right now, I can find 3 (three!)  
> "versions" of Date in VW (Core.Date, Squeak.Date and Seaside.Date)!
> It kind of sucks to have to extend Seaside.Date with date method  
> extensions already existing for Core.Date for this local shop.
>
> Maybe namespaces of VW helped to get seaside ported to VW at all, but  
> I'd prefer to have an ongoing desire to unify classes, which _are_  
> intended to work the same.

It might be worth mentioning how this would work with my solution.

The idea I have talked about earlier is that "my" solution is
"optimistic" in the sense that there are no imports (which can be called
a "pessimistic" approach). So if you have those three Date classes in
the same image and just type "Date" then Squeak asks you which one you
mean and offer a menu with all three to pick from. And when you pick it,
kit gets expanded to say "Code::Date" in the browser.

In the source it is always "expanded" - it is just that the code is
"rendered" with short names if Squeak knows that they are unique in the
image anyway.

This means that having several "clashing" short names in the image will
make it apparent that they are indeed clashing - because it will "annoy"
developers that they can't just type Date and be done with it. So this
is a poisitive thing - it acts like a "force" to unify classes with the
same name - or rename one of them.

If you use imports then each developer sits in his/her little own box
and don't "notice" that they have clashing names. And thus we more
easily end up with tons of Date classes. :)

regards, Göran

Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Göran Krampe
In reply to this post by J J-6
Hi!

"J J" <[hidden email]> wrote:
> Well I haven't looked at the implimentation details, no.  But what will be
> the result is pretty obvious:  Right now you have a global namespace for all
> classes in your image.  After the change you will have the same but instead
> of MCDictionary or something it will be Monticello::Dictionary.  In other
> words, the end result is just that the identifiers get longer and part of it
> is implicit (i.e. you don't have to type it out usually).

Yes, more or less.
 
> The problem comes if we determine there is a much better way to do this.  We
> can't just pull the namespaces out because then you will have 30 classes
> named "Dictionary" and so on.  You will have to either touch them all or run
> some script that appends the namespace on the front of the class and then
> pull namespaces out.  I don't see either of these as doable, so I would
> expect that once namespaces are in as default for a couple of years that is
> what we are going to have from now on.

Eh, no not really. Today without my solution MCDictionary has the name
#MCDictionary.
With my solution it can still be called that, or be renamed to
#Monticello::Dictionary. Yes, the name of the class is the full name,
not the short one.

If we then in a while decide my solution sucks... eh, I guess the only
valid reason I can come up with would be that people think that
'Monticello::Dictionary' actually looks bad compared to 'MCDictionary',
then sure, revert those 3 methods it is all about and remove the  '::'
so that it is now called 'MonticelloDictionary' - or hey, just replace
'Monticello::' with 'MC' and tada - we are back where we are now.

Renaming classes is not hard, we do it all the time. And if we ever want
to move away from prefixes to anything else - whatever solution you
think that we *ever* will be able to agree on ;) - then we would need to
do the same anyway.

> p.s. Does it get the namespace from the category?  If not, then that might
> be something to think about. :)

The class creation template borrows the category name in some fashion
IIRC. But it is only a suggestion.

regards, Göran

Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Daniel Vainsencher-3
In reply to this post by Markus Gälli-3
I think the goals for namespaces in Squeak should be two:
1. Given 2 independently developed systems, each introducing its own
meaning for a new class name, a developer should be able to make them
able to live together in the same image without changing the actual code
for either. I think this is the real goal of scalable independent
deployment.
2. If the two systems both introduce similar concepts with the same
name,  system should facilitate their merging by the respective
maintainers. This goal is meant to facilitate sharing code that is
living (and I this is what Markus is talking about).

I think many namespace systems achieve goal 1 by having each developer
invent his own namespace (possibly more than one). I think this is a bad
decision in our context, because it makes it harder to achieve 2. So far
we've compromised by emulating this mode using the prefix convention,
but only selectively.

I think the effect of first class prefixes will be to make it more
convenient to delay the design and implementation of a real solution to
these goals. This may be a good or a bad thing, depending on how close
we feel to having a solution.

Daniel Vainsencher


Markus Gaelli wrote:
> Maybe namespaces of VW helped to get seaside ported to VW at all, but
> I'd prefer to have an ongoing desire to unify classes, which _are_
> intended to work the same.
>
> Cheers,
>
> Markus
>


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

brad fowlow

On Nov 29, 2006, at 2:26 PM, Daniel Vainsencher wrote:

1. Given 2 independently developed systems, each introducing its own meaning for a new class name, a developer should be able to make them able to live together in the same image without changing the actual code for either. I think this is the real goal of scalable independent deployment.


Yes, that's a good part of it...

2. If the two systems both introduce similar concepts with the same name,  system should facilitate their merging by the respective maintainers. This goal is meant to facilitate sharing code that is living (and I this is what Markus is talking about).


It may be counterproductive to burden the namespace design with this sort of criterion;
how do you assess it?    The problems to solve with namespaces are the ones
brought about by their absence.   Is lack of namespaces the reason why people
implement variations on the same idea?

(Not just being glib there; the problem is that if you hold out for a namespace solution
that brings peace to the Levant, it will be a long wait.  And the system needs namespaces.)

I'd offer a different second goal: the namespace solution should
give clear guidance about what things should be called.

Good namespace systems don't arise from syntax, 
nor from being backed by clever code-manipulation tools.
They also, through a mix of constraint and example, give you a really good 
idea about what the name of something ought to be.

That's important, because if there isn't an obvious way for development effort x 
to name its stuff  (to some coarse level of precision) then there isn't an obvious
guess I would make to find that stuff  so I could use it.    
Policy that constrains the choices when you name a piece of code
pays that limitation back in spades by making it easier to find everything.
In good systems, resolving namespace conflicts is a local matter,
about as deep, interesting, and worth attention as the onerous problem
of an inherited instance variable name clash (i.e. rare and boring.)

So if you're going to pick a namespace design, it might be worth
talking about what kind of naming policy you're going to use.
A question to answer: in a namespace-mature squeak,
what will be the fully-qualified name of
Object ?
SharedQueue?
Monticello's Package?
Croquet TFrame?
Seaside internal utiltities?

And when I come along with my new little pet project,
how do I decide what to start calling my own things, 
and how is my claim laid to those names I use?

Then once you've thrashed out that side of the namespace question,
maybe it will be easier to look at a design,  and assess where it moves you 
in relation to the goal.


Meanwhile, Tim R. asks,

Forgive me if I'm being hopelessly naive here (remember, none of my degrees are in CS ) but isn't namespaces something that has been solved before?

Of course.
And I don't think it's a stretch to say that the many modern answers
are convergent on most of the basic points.

You get local short names, and fully-qualified long names;
you import a long name once to use short names a lot.
There's policy that lets you know what long names you're supposed to choose.
People adhere to the policy because it guarantees goal 1) by construction...
policy-guided fully qualified names are always unique.

A common trick is to say
that you use your  domain name as the basis of your names,
and leave your use of the tail to your own disgression.
Platform components usually have a reserved rooting
that is structurally the same as all the rest.
That makes it always obvious when you're using 'core' stuff,
and what you have to keep track of as a dependency.

There's variance in the status of intermediates
 (I.e., If I have a namespace Foo.Bar.Baz,
is Foo.Bar a scope in which entities live, or is it just a partial name?
Can I import 'Foo', or Foo.Bar in one swoop, or is there a 'package' notion
that makes the next-to-last level special?)

There are questions about the interaction of namespace scoping rules
with others in the language.   E.g. does a class in package X which inherits from a class in package Y,
automatically have unqualified access to the inherited instance variables of the Y class?
(Probably, given Smalltalk's approach to protection, but it is a question to answer.)

And then are minor local questions about syntax and implementation :-).

-brad




Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

timrowledge
In reply to this post by Daniel Vainsencher-3
Forgive me if I'm being hopelessly naive here (remember, none of my  
degrees are in CS ) but isn't namespaces something that has been  
solved before? I mean, it's not exactly a new issue is it? Isn't  
there a standard somewhere for dealing with them?

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Giraffiti (n): Vandalism spray-painted very, very high



Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Michael van der Gulik-2
In reply to this post by Klaus D. Witzel


On 11/29/06, Klaus D. Witzel <[hidden email]> wrote:

Motivation for syntax: we say SmallInteger and LargeInteger to subclasses
of Integer and obviously prefer the opposite direction for a namespace
hierarchy. Let's replace the suggested :: by a legitimate binary message

  Morphic >~ View
  Tweak >~ View
  System >~ Default >~ Compiler
  My >~ Terrific >~ Compiler

Implementing Namespaces like this would mean that your code runs slower. In order to refer to a class, you'll need to send a message to a Namespace every time you refer to it, rather than just refer to the class directly.

Also, your message names are capitalised, which will have a negative affect on your karma.

Michael.


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Giovanni Corriga
Il giorno gio, 30/11/2006 alle 12.07 +1300, Michael van der Gulik ha
scritto:

>
>
> On 11/29/06, Klaus D. Witzel <[hidden email]> wrote:
>        
>         Motivation for syntax: we say SmallInteger and LargeInteger to
>         subclasses
>         of Integer and obviously prefer the opposite direction for a
>         namespace
>         hierarchy. Let's replace the suggested :: by a legitimate
>         binary message
>        
>           Morphic >~ View
>           Tweak >~ View
>           System >~ Default >~ Compiler
>           My >~ Terrific >~ Compiler
>
> Implementing Namespaces like this would mean that your code runs
> slower. In order to refer to a class, you'll need to send a message to
> a Namespace every time you refer to it, rather than just refer to the
> class directly.
>
> Also, your message names are capitalised, which will have a negative
> affect on your karma.

Isn't this what Henryk's Environments do?

        Giovanni


Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Göran Krampe
Hi!

Giovanni Corriga <[hidden email]> wrote:

> Il giorno gio, 30/11/2006 alle 12.07 +1300, Michael van der Gulik ha
> scritto:
> >
> >
> > On 11/29/06, Klaus D. Witzel <[hidden email]> wrote:
> >        
> >         Motivation for syntax: we say SmallInteger and LargeInteger to
> >         subclasses
> >         of Integer and obviously prefer the opposite direction for a
> >         namespace
> >         hierarchy. Let's replace the suggested :: by a legitimate
> >         binary message
> >        
> >           Morphic >~ View
> >           Tweak >~ View
> >           System >~ Default >~ Compiler
> >           My >~ Terrific >~ Compiler
> >
> > Implementing Namespaces like this would mean that your code runs
> > slower. In order to refer to a class, you'll need to send a message to
> > a Namespace every time you refer to it, rather than just refer to the
> > class directly.
> >
> > Also, your message names are capitalised, which will have a negative
> > affect on your karma.
>
> Isn't this what Henryk's Environments do?

Henrik, not Henryk. And I would probably say Dan's/Henrik's Environments
- Dan started that path and Henrik tried to fulfil it.

Personally I think it is too complicated - I dislike hierarchies in
general :). But yes, the idea was to use late binding using message
sends etc.

In fact, using my Namespaces you can do both I guess. We could implement
a DNU on class Namespace and that would be it. They are already reified
globals hanging in Smalltalk under their own name.

And right, I started on that Detailed walktrough I promised - but I only
got through the "core" part and actually found an issue and also need to
study some parts of it more to get it all nailed down. If you file that
core part into say a 3.7 image the idea was that you could then create
classes like Foo::Bar and use them (and thus be able to file in new code
written with these namespaces). But the method #scopeVariable needs to
be different for this to work - it expects to find an instance of
Namespace called #Foo in Smalltalk - which of course will not be there.

But here is the current draft:

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

regards, Göran

Reply | Threaded
Open this post in threaded view
|

Re: Squeak and Namespaces

Klaus D. Witzel
In reply to this post by Michael van der Gulik-2
Hi Michael,

on Thu, 30 Nov 2006 00:07:24 +0100, you wrote:

> On 11/29/06, Klaus D. Witzel <[hidden email]> wrote:
>>
>> Motivation for syntax: we say SmallInteger and LargeInteger to  
>> subclasses
>> of Integer and obviously prefer the opposite direction for a namespace
>> hierarchy. Let's replace the suggested :: by a legitimate binary message
>>
>>   Morphic >~ View
>>   Tweak >~ View
>>   System >~ Default >~ Compiler
>>   My >~ Terrific >~ Compiler
>>
>
> Implementing Namespaces like this would mean that your code runs slower.

Why should it? There are 2 possibilities:

1 - the compiler does not know about #>~ and so compiles a message send  
which results in DNU.

2 - it does know, then is compiles the usual reference to a literal  
variable (name being resolved at compile-time: that's the magic behind  
namespace+compiler).

> In
> order to refer to a class, you'll need to send a message to a Namespace
> every time you refer to it, rather than just refer to the class directly.

By no means, only the compiler has, not me :|

> Also, your message names are capitalised,

The word after the >~ is not a message name, it's in argument position  
(like in the Smalltalk programming lanugage ;-) And the word before the >~  
is in argument position, too :) That's the nature of the binary #>~  
message (handled by compiler).

> which will have a negative affect on your karma.

Not my karma: the compiler's karma ;-)

/Klaus

> Michael.



12345 ... 8