[BUG] Browsing uniclasses

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

[BUG] Browsing uniclasses

Christoph Thiede

Hi all,


there is another small bug IWLT fix for the release:




The message [category] list is empty.


At first glance, Browser >> #hasClassSelected is erroneous because it hardcodes Smalltalk instead of the displayed environment:


hasClassSelected

^ selectedClassName notNil and: [(Smalltalk classNamed: selectedClassName) notNil]


Is my assumption correct that there should be almost zero references to Smalltalk in Browser & Co.?
Now I have to ask the question of whether you should use self environment or self selectedEnvironment here. What's the difference?

Best,
Christoph



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: [BUG] Browsing uniclasses

marcel.taeumel
Hi Christoph,

uniclasses do not show up in the System Browser; they are not supported there. Yes, there can be strange behavior if you still try to. :-)

Best,
Marcel

Am 24.02.2020 14:37:44 schrieb Thiede, Christoph <[hidden email]>:

Hi all,


there is another small bug IWLT fix for the release:




The message [category] list is empty.


At first glance, Browser >> #hasClassSelected is erroneous because it hardcodes Smalltalk instead of the displayed environment:


hasClassSelected

^ selectedClassName notNil and: [(Smalltalk classNamed: selectedClassName) notNil]


Is my assumption correct that there should be almost zero references to Smalltalk in Browser & Co.?
Now I have to ask the question of whether you should use self environment or self selectedEnvironment here. What's the difference?

Best,
Christoph



Reply | Threaded
Open this post in threaded view
|

Re: [BUG] Browsing uniclasses

Christoph Thiede

Hi Marcel,


but it should not be a big task to support them, should it? After fixing #hasClassSelected, I could compile and categorize methods as usual ...


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 24. Februar 2020 14:42:26
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] [BUG] Browsing uniclasses
 
Hi Christoph,

uniclasses do not show up in the System Browser; they are not supported there. Yes, there can be strange behavior if you still try to. :-)

Best,
Marcel

Am 24.02.2020 14:37:44 schrieb Thiede, Christoph <[hidden email]>:

Hi all,


there is another small bug IWLT fix for the release:




The message [category] list is empty.


At first glance, Browser >> #hasClassSelected is erroneous because it hardcodes Smalltalk instead of the displayed environment:


hasClassSelected

^ selectedClassName notNil and: [(Smalltalk classNamed: selectedClassName) notNil]


Is my assumption correct that there should be almost zero references to Smalltalk in Browser & Co.?
Now I have to ask the question of whether you should use self environment or self selectedEnvironment here. What's the difference?

Best,
Christoph



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: [BUG] Browsing uniclasses

marcel.taeumel
Well, but it makes no sense to browse a uniclass, does it? Except, maybe, if you manage to add new code to those uniclasses via Squeak's reflection interface. And then want to get a code browser for that.

Otherwise, use the uniclass's base class to browse.

Uniclasses are basically for Etoys only and have limited tool support in Squeak's standard code browsing tools. It's a little bit like object-as-method. :-)

Best,
Marcel

Am 24.02.2020 14:50:36 schrieb Thiede, Christoph <[hidden email]>:

Hi Marcel,


but it should not be a big task to support them, should it? After fixing #hasClassSelected, I could compile and categorize methods as usual ...


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 24. Februar 2020 14:42:26
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] [BUG] Browsing uniclasses
 
Hi Christoph,

uniclasses do not show up in the System Browser; they are not supported there. Yes, there can be strange behavior if you still try to. :-)

Best,
Marcel

Am 24.02.2020 14:37:44 schrieb Thiede, Christoph <[hidden email]>:

Hi all,


there is another small bug IWLT fix for the release:




The message [category] list is empty.


At first glance, Browser >> #hasClassSelected is erroneous because it hardcodes Smalltalk instead of the displayed environment:


hasClassSelected

^ selectedClassName notNil and: [(Smalltalk classNamed: selectedClassName) notNil]


Is my assumption correct that there should be almost zero references to Smalltalk in Browser & Co.?
Now I have to ask the question of whether you should use self environment or self selectedEnvironment here. What's the difference?

Best,
Christoph



Reply | Threaded
Open this post in threaded view
|

Re: [BUG] Browsing uniclasses

Christoph Thiede

Well, but it makes no sense to browse a uniclass, does it? Except, maybe, if you manage to add new code to those uniclasses via Squeak's reflection interface. And then want to get a code browser for that.


I use #newSubclass every week for playing around with things and it's not even located in the EToys package :-)

It might be not a top important feature, but I think it would be nice if Squeak would not have these arbitrary limitations, so I would be happy to fix this (before or after the release).
Would there be any good reason to refer to #Smalltalk instead of #environment or #selectedEnvironment from within the Brower?

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 24. Februar 2020 15:01:18
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] [BUG] Browsing uniclasses
 
Well, but it makes no sense to browse a uniclass, does it? Except, maybe, if you manage to add new code to those uniclasses via Squeak's reflection interface. And then want to get a code browser for that.

Otherwise, use the uniclass's base class to browse.

Uniclasses are basically for Etoys only and have limited tool support in Squeak's standard code browsing tools. It's a little bit like object-as-method. :-)

Best,
Marcel

Am 24.02.2020 14:50:36 schrieb Thiede, Christoph <[hidden email]>:

Hi Marcel,


but it should not be a big task to support them, should it? After fixing #hasClassSelected, I could compile and categorize methods as usual ...


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 24. Februar 2020 14:42:26
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] [BUG] Browsing uniclasses
 
Hi Christoph,

uniclasses do not show up in the System Browser; they are not supported there. Yes, there can be strange behavior if you still try to. :-)

Best,
Marcel

Am 24.02.2020 14:37:44 schrieb Thiede, Christoph <[hidden email]>:

Hi all,


there is another small bug IWLT fix for the release:




The message [category] list is empty.


At first glance, Browser >> #hasClassSelected is erroneous because it hardcodes Smalltalk instead of the displayed environment:


hasClassSelected

^ selectedClassName notNil and: [(Smalltalk classNamed: selectedClassName) notNil]


Is my assumption correct that there should be almost zero references to Smalltalk in Browser & Co.?
Now I have to ask the question of whether you should use self environment or self selectedEnvironment here. What's the difference?

Best,
Christoph



Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: [BUG] Browsing uniclasses

Jakob Reschke
In reply to this post by Christoph Thiede
Am Mo., 24. Feb. 2020 um 14:37 Uhr schrieb Thiede, Christoph
<[hidden email]>:

>
>
> At first glance, Browser >> #hasClassSelected is erroneous because it hardcodes Smalltalk instead of the displayed environment:
>
>
> hasClassSelected
>
> ^ selectedClassName notNil and: [(Smalltalk classNamed: selectedClassName) notNil]
>
>
> Is my assumption correct that there should be almost zero references to Smalltalk in Browser & Co.?
>

Indeed, this hasClassSelected is wrong when browsing other
environments (regardless of the special case "Uniclasses").

Browser should not use Smalltalk to access any browsed objects. It may
use Smalltalk or better self class environment to find other classes
from the Tools package for IDE purposes, but then it might be better
to just refer to these classes directly without the dynamic lookup.

Reply | Threaded
Open this post in threaded view
|

Re: [BUG] Browsing uniclasses

Jakob Reschke
In reply to this post by Christoph Thiede
Am Mo., 24. Feb. 2020 um 14:37 Uhr schrieb Thiede, Christoph
<[hidden email]>:
>
> Now I have to ask the question of whether you should use self environment or self selectedEnvironment here. What's the difference?
>

Seems like there is not much difference left between
Browser>>environment and Browser>>selectedEnvironment, hmm. Before
Marcel's change in 2018, environment would either answer the browsed
environment, or, if not defined, answer the environment of the
selectedClass. You can get the environment of the selected class with
self selectedClass environment anyway (who would have thought).
selectedEnvironment was once "connected" to the selected system
category, but would only answer Smalltalk or nil. In a hierarchy
browser, selectedEnvironment nowadays answers either the browsed
environment or the environment of the class on which the browser was
opened ("centralClass"). When I changed the browsers to be more
environments-friendly in 2016/17, I seem to have preferred self
environment as a replacement for Smalltalk, except in one case
(defineClass:notifying:, which I probably aligned with
defineTrait:notifying:). But maybe I just didn't know about
selectedEnvironment for most of that time.

These use environment:
Browser copyClass {class functions} {Tools-Browser}
Browser findClass {system category functions} {Tools-Browser}
Browser hierarchicalClassList {class list} {Tools-Browser}
HierarchyBrowser classList {class list} {Tools-Browser}

These use selectedEnvironment:
Browser defineClass:notifying: {class functions} {Tools-Browser}
Browser defineTrait:notifying: {traits} {Tools-Browser}
Browser dragFromClassList: {drag and drop} {Tools-Browser}
Browser dropOnSystemCategories:at: {drag and drop} {Tools-Browser}
Browser selectedClass {class list} {Tools-Browser}

I suppose one could sort this out, better define and distinguish the
two messages, and change the message sends where appropriate. For
example, if at some point we might have a browser that shows
categories from different environments, selectedEnvironment could
answer the environment from which the selected category comes.

Independent of what we have now, the browser should use the
environment of the selected class for evaluating snippets of methods
in the code pane or for arguing about the selected class. But to
create new objects, such as subclasses, or to enumerate objects it
should always use the "browsed" environment instead, even if the
currently selected class comes from a different environment. For
example, when you browse environment X, open a hierarchy browser on
one of its classes, then select a superclass from Smalltalk and create
a new subclass of that, the new class should go into environment X.
Otherwise you cannot easily create subclasses in environments other
than Smalltalk.