[Cuis-dev] Naming conventions
Hernan Wilkinson
hernan.wilkinson at 10pines.com
Fri May 1 16:27:54 PDT 2020
Hi all,
interesting thread!!
Class name prefix are not nice but it is very easily to get used to them.
When you got use to them when you read something like WAHtmlCanvas, your
mind disregards the WA and focus on HtmlCanvas. Prefix do not look nice,
but they solve the problem of name clashing in a simple way and without
adding anything special... but namespaces look as a better "engineering"
solution :-)
Many details have to be take care when implementing namespaces, it is not
that simple. The implementation I liked about this was Geman Leiva's one,
showed at ESUG 2010. Here is a video showing it:
https://www.youtube.com/watch?v=n4I7fSVNX2A
It was a clean, Smalltalk like solution and, if I recall correctly, it did
not have a performance hit.
Cheers!
Hernan.
On Thu, Apr 30, 2020 at 3:56 PM Juan Vuletich via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:
> On 4/29/2020 12:57 AM, Luciano Notarfrancesco via Cuis-dev wrote:
>
>
>
> On Tue, 28 Apr 2020 at 8:52 PM, Juan Vuletich <juan at jvuletich.org> wrote:
>
>>
>> Without backticks, we'd need to add packages as globals, so they can be
>> resolved at runtime. With the backticks we can avoid that, because we
>> can give the Compiler the context to resolve package names if in a
>> required package, just like class names, at compile time.
>>
>
> But that would work regardless of back ticks, right? Erik doesn’t like
> backticks very much, I also avoid them in my code.
>
> I just did some experiments changing Class>>bindingOf:. Currently it first
> looks in class var names and SharedPools calling localBindingOf:, then it
> looks in globals by calling Smalltalk bindingOf:. I added a
> packageBindingOf: after localBindingOf:, and if self package is not nil it
> tries to resolve the binding within the package. We can put required
> packages here and they will look like globals, right? And also resolve
> classes of the local package.
>
>
> You are right! Yes, the backticks are optional. There is still the message
> send to get the class. So there is some performance penalty, and some users
> in critical code might still prefer to use them, so the literal is the
> class and not the module. But it is a small detail.
>
> I tried one of the ideas: keeping all classes global, but adding a prefix
> like ‘PackageName.’ to the binding key in the Smalltalk system dictionary.
> I added a Class>>globalName too. Seems to almost work, but tools break all
> over the place.
>
>
>>
> Cheers,
>
> --
> Juan Vuletichwww.cuis-smalltalk.orghttps://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Devhttps://github.com/jvuletichhttps://www.linkedin.com/in/juan-vuletich-75611b3
> @JuanVuletich
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
--
*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200501/07b0d9af/attachment.htm>
More information about the Cuis-dev
mailing list