<div><div dir="auto">I still like the idea of using a message as</div></div><div dir="auto"> PackageName ClassName</div><div dir="auto">but the dot convention made me imagine a simple implementation. Internally all classes of a package would be prefixed with ‘PackageName.’, and we would have to change the parser to interpret PackageName.ClassName correctly as a global name, and change the method bindingOf: to lookup the association for ‘ClassName’ first as ‘Xxx.ClassName’ for methods compiled in a class belonging to package Xxx. Looks like it might work without changing much, I don’t know how hard it would be to change the tools to display the class names without the prefix when it makes sense.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 28 Apr 2020 at 4:32 PM, giorgio ferraris <<a href="mailto:giorgio.ferraris@gmail.com">giorgio.ferraris@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Thanks, Erik,<div>I suppose that was the reason, but the end result is just is a bit ugly, from my point of view. </div><div>I remember Cincom <span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium">(or, probably was ParcPlace that started the work)</span> did a hard work implementing </div><div>Namespaces in VW, but there the dot is a separator so MyNamestace.MyClass looks better than </div><div><span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium">MyNamespace@#MyClass. </span><br></div><div><span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium">Another question is portability..</span><br></div><div><font color="#000000" face="-webkit-standard" size="3"><span>But I'm just thinking aloud :)</span></font></div></div></div></div></div></div></div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><font color="#000000" face="-webkit-standard" size="3"><span><br></span></font></div><div><font color="#000000" face="-webkit-standard" size="3"><span>giorgio</span></font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 28, 2020 at 11:18 AM Erik Stel <<a href="mailto:erik.stel@gmail.com" target="_blank">erik.stel@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto">Giorgo,<div><br></div><div>The dot is the statement separator in Smalltalk. What Juan suggest is regular Smalltalk. The @ message is sent to the Smalltalk instance and it will answer the package reference by the argument (a Symbol like #MyPackage). The package has also an implementation for the message @ and will answer a class. So everything is just executed and no special compiler handling.</div><div><br></div><div>Cheers</div><div>Erik</div><div><br><div dir="ltr">(Sent from mobile device, please excuse typos and brevity)</div><div dir="ltr"><br><blockquote type="cite">On 28 Apr 2020, at 10:08, giorgio ferraris <<a href="mailto:giorgio.ferraris@gmail.com" target="_blank">giorgio.ferraris@gmail.com</a>> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">Hi, Juan, <div><br></div><div>probably there is something that makes it faster using what you propose, but a general convention between languages is a dot as a separator for namespaces. VW is adopting this. (and BTW it seems more elegant too...) .</div><div>Any case, I just started tasting Cuis water, and I have to say that, after the first moment of confusion (starting with git seems not natural for an old smalltalk programmer...) , I begin to appreciate the work you did in these years.</div><div>ciao</div><div>giorgio</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 27, 2020 at 11:19 PM Juan Vuletich <<a href="mailto:juan@jvuletich.org" target="_blank">juan@jvuletich.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><u></u>
<div bgcolor="#ffffff">
Hi Folks,<br>
<br>
On 4/27/2020 12:52 PM, Luciano Notarfrancesco via Cuis-dev wrote:
<blockquote type="cite">
<div>
<div dir="auto">I also dislike prefixes a lot. But fortunately
name clashes are less common in Cuis because there are not as
many classes as in Pharo. Personally, I’d love to have
namespaces, or have class names be local to a package.</div>
</div>
</blockquote>
<br>
Ok, this got me thinking. So, what would it take to do just that?<br>
<br>
We could make each package be a namespace. That means that classes
that are defined in a package will not be globals. But, any package
declaring a prerequisite would also behave as if in Python you did
'From package import *'. So, the compiler would know that it is
compiling some code for some package, and it would try to find class
names in all packages that were declared as prerequisites.<br>
<br>
This would have the added benefit that the compiler would check for
you that you actually declared prerequisites. Code not in a package
would not have access to classes defined at any package.<br>
<br>
Usually, there would be no need to specify namespaces when accessing
'globals', even if they belong in a different package/namespace.
Just declaring the prerequisites for your package just once, will
do. The only case where explicit call for a namespace would be
needed, is if you ask two prerequisites, they both define classes
with the same name, and there is ambiguity. In such casses something
like:<br>
a := `Smalltalk@#PackageName1@#ClassName` new.<br>
b := `Smalltalk@#PackageName2@#ClassName` new.<br>
would work as expected. See that class resolution is done at compile
time because of the use of backticks. So there's no performance
penalty. Also, there's no new syntax!<br>
<br>
If we add package names to the Smalltlak global namespace, then we
could also do:<br>
a := `PackageName1@#ClassName` new.<br>
b := `PackageName2@#ClassName` new.<br>
<br>
Again, this is only when the case is that you decided to depend on
two different packages that happen to clash. So, you are already
aware of the situation. This would never get in your way when good
old Smalltalk would do!<br>
<br>
There's some work to be done in Browsers and other tools, but I feel
it is not too much...<br>
<br>
Also note that I'd not include nested namespaces, just like we don't
have nested packages. I'd also avoid having namespaces as a separate
thing from packages. I'd have a single concept for both. So, it
would be simpler than what is available in other Smalltalks that
support namespaces.<br>
<br>
Does this make sense? I am missing something?<br>
<br>
Thanks,<br>
<pre cols="72">--
Juan Vuletich
<a href="http://www.cuis-smalltalk.org" target="_blank">www.cuis-smalltalk.org</a>
<a href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev" target="_blank">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a href="https://github.com/jvuletich" target="_blank">https://github.com/jvuletich</a>
<a href="https://www.linkedin.com/in/juan-vuletich-75611b3" target="_blank">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
<br>
<blockquote type="cite">
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, 27 Apr 2020 at 10:46
PM, giorgio ferraris via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hello,
<div>prefixes have a long story, in use also on
VisualSmalltalk or SmalltalkV long, long time ago. Not
having namespaces on many Smalltalk dialects makes
prefix the only (ugly) solution.
<div>The resulting names are horrible, I
personally dislike it a lot, but class' names clashing
is something that could easily happens.</div>
<div><br>
</div>
<div>ciao</div>
</div>
</div>
<div dir="ltr">
<div>
<div><br>
</div>
<div>giorgio</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Apr 27, 2020 at
5:34 PM Erik Stel via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi Ken,<br>
<br>
I think you just answered my question ;-).<br>
<br>
It can indeed be a Pharo ’thing’. In Pharo (default
image) you have class names like ’ZnWebSocket’. It
represents a WebSocket and comes from the ‘Zinc’
framework. I think it coexisted with WebSocket for some
time (the later is no longer part of the default Pharo
image). Also ‘MCPackage’ is a package from Monticello
(the versioning system). A full name like
‘MonticelloPackage’ would have solved that issue of name
conflict I suppose.<br>
<br>
Regards,<br>
Erik<br>
<br>
<br>
> On 27 Apr 2020, at 17:13, <a href="mailto:ken.dickey@whidbey.com" target="_blank">ken.dickey@whidbey.com</a>
wrote:<br>
> <br>
> On 2020-04-27 07:28, Erik Stel via Cuis-dev wrote:<br>
>> Hi,<br>
>> Short question:<br>
>> Also using Pharo, I’m used to creating classes
with prefixed names<br>
>> because of possible name collisions. What is
the Cuis take on these<br>
>> prefixes? I do not see any prefixes being used
in the<br>
>> packages/features I’m using at the moment.<br>
>> Regards,<br>
>> Erik<br>
> <br>
> Examples?<br>
> <br>
> What is the context?<br>
> <br>
> Not being a Pharo user, I have no idea what you are
talking about.<br>
> <br>
> Typically, one wants to use meaningful names in a
way that orients one and makes code reads like
sentences.<br>
> <br>
> Note that the base Cuis image typically has between
500 and 600 classes. The latest Pharo base image has
over 9000 classes. Perhaps the (pre)fix is for a Pharo
problem..<br>
> <br>
> -KenD<br>
> <br>
<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote>
</div>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote></div>
</div></blockquote></div></div></blockquote></div></div></div></div></div></div>
</blockquote></div></div>