Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

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

Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Nicolas Cellier
So, it appears that all these are Traits, and that we currently can't browse Traits.
See Trait someInstance browse...
(In my image I have a few obsolete Traits by the way)

2013/7/21 Nicolas Cellier <[hidden email]>
Note that bindingOf: contents moved to bindingOf:environment: since Environment, so the fix might have to be updated.
BTW when I browse implementors of bindingOf: I see many Trait>>bindingOf: Is it just me?


2013/7/21 Frank Shearar <[hidden email]>
On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
> Whilst trawling through ancient dusty mantis reports I found this little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to myself, "well now, this one will be closable because someone will surely have modified the compiler a fair bit by now and solved this". Wrong. Despite the fairly amazing amount of heat that the discussion released back in 2003 (ten years ago! eeek!) it appears nothing was done at the time beyond a proposed fix that only got into Mantis-land two years late through Ken Causey's good offices.
>
> I tried out the suggested test code in a very recent (#12641) image and 8 out of 10 test passed. Now I'm no compiler guru and don't claim to have any special opinion on this except that it looked pretty serious back then and probably ought to be fixed if at all possible. Unless someone has good reasons for those two 'failing' tests to be considered unimportant, of course.

Those two tests - are they the tests that Ken says failed before
loading the changeset, and work afterwards?

frank

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> There are two ways to write error-free programs; only the third one works.





Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

timrowledge

On 21-07-2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:

> So, it appears that all these are Traits, and that we currently can't browse Traits.
> See Trait someInstance browse...
> (In my image I have a few obsolete Traits by the way)

Are Traits used at all? Are they used meaningfully? I remember they seemed like a pretty cool idea but has any actual, useful usefulness of a useful nature been made of them? Are there tools to do anything sensible with them? Is there current, readable documentation that would help people make good use of them?

If not, toss'em.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Loyalty oaths.Secret searches.No-fly lists.Detention without legal recourse.Remind me - who won the cold war?



Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Nicolas Cellier
AFAIK, Trait were only used to implement Trait (See category 311Deprecated-Traits).
I don't think that simplified Trait introduced by Andreas still uses Trait.

If we have Trait in Image, we should have a minimum tool support.
But even if we don't use Trait, but have one or more instance of Trait in the image then it should not spoil browsing implementors of #bindingOf:

Then removing Trait is yet another option, but it won't be that easy to re-introduce them if we ever need them or just want to experiment things.
The idea was more to provide a minimal support for Trait and don't use them directly in core system.


2013/7/22 tim Rowledge <[hidden email]>

On 21-07-2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:

> So, it appears that all these are Traits, and that we currently can't browse Traits.
> See Trait someInstance browse...
> (In my image I have a few obsolete Traits by the way)

Are Traits used at all? Are they used meaningfully? I remember they seemed like a pretty cool idea but has any actual, useful usefulness of a useful nature been made of them? Are there tools to do anything sensible with them? Is there current, readable documentation that would help people make good use of them?

If not, toss'em.
Loyalty oaths.Secret searches.No-fly lists.Detention without legal recourse.Remind me - who won the cold war?






Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Casey Ransberger-2
In reply to this post by timrowledge
Below.

On Jul 21, 2013, at 3:22 PM, tim Rowledge <[hidden email]> wrote:

>
> On 21-07-2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:
>
>> So, it appears that all these are Traits, and that we currently can't browse Traits.
>> See Trait someInstance browse...
>> (In my image I have a few obsolete Traits by the way)
>
> Are Traits used at all? Are they used meaningfully? I remember they seemed like a pretty cool idea but has any actual, useful usefulness of a useful nature been made of them? Are there tools to do anything sensible with them? Is there current, readable documentation that would help people make good use of them?
>
> If not, toss'em.
>
> tim

Yes, some things actually use them. Like, eh, the tests for ProfStef. Yes, they are useful, in that they provide a way to handle multiple inheritance safely. They're also documented. Let's see...

The papers are all here I think:

http://scg.unibe.ch/research/traits

One of the actual problems that can be solved (it's spoken of in one of the papers, can't recall which) is code duplication between two classes which need some common behavior, but can't inherit it because heavy dependency on their existing superclasses. In this case, you'd either have to duplicate the code in one of the parents so that the two classes could share an ancestor, or duplicate code in the two classes themselves, so that they can keep the behavior from their ancestors.

Either way in this scenario (which the papers point out happens quite a bit in the collections hierarchy as a case study) you have to duplicate code, which really flies in the face of Ingall's rationale in Design Priniples Behind Smalltalk (a system should have as few parts as possible, and those parts should be as general as possible for simplicity and leverage, I'm paraphrasing here.)

Traits work best when applied pervasively in my opinion. This is evident in the Self language, where instead of implementing e.g. singleton behavior on a "subclass" (misnomer in this case used for brevity) of something whenever you run into wanting a singleton, you just give the object "traits oddball" and it gets singleton behavior. Done. No more writing

Foo class>>soleInstance
    ^ SoleInstance ifNil: [
        SoleInstance := self new ]

every time.

The current situation with Traits is *entirely* less of an emergency in Squeak as it was when I arrived, thanks to Andreas. Originally they were implemented in a deep meta circular way, which made them impossible to unload. He loathed this so much that he spent months on an epic reimplementation of a feature he didn't even want, supplying us with a much simpler Traits than what's in Pharo (decended from the original Squeak implementation) that still kept all of the Traits tests passing *and* could actually be unloaded.

All that said, they're pretty unloved, and mostly unused by Squeakers. Also, since our implementation is very different from that of Pharo (where traits are used throughout the system to a degree) we're liable to diverge behaviorally until they're eventually useless to everyone who isn't still running some (older) Squeak app that depended on them.

Sorry about the length of this message.
Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Frank Shearar-3
In reply to this post by timrowledge
On 21 July 2013 23:22, tim Rowledge <[hidden email]> wrote:

>
> On 21-07-2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:
>
>> So, it appears that all these are Traits, and that we currently can't browse Traits.
>> See Trait someInstance browse...
>> (In my image I have a few obsolete Traits by the way)
>
> Are Traits used at all? Are they used meaningfully? I remember they seemed like a pretty cool idea but has any actual, useful usefulness of a useful nature been made of them? Are there tools to do anything sensible with them? Is there current, readable documentation that would help people make good use of them?
>
> If not, toss'em.

I have started using them. Not meaningfully, or heavily. I would like
to keep them because they (a) look useful for pulling out commonality
that doesn't really have enough meat to form a class, (b) really just
look like they need a bit more tooling support, and (c) they're the
sort of low level nuts-and-bolts that are really difficult to get in
in the first place.

So for once I'm in favour of _not_ ripping them out.

frank

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Loyalty oaths.Secret searches.No-fly lists.Detention without legal recourse.Remind me - who won the cold war?
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Frank Shearar-3
In reply to this post by Nicolas Cellier
By "browse" do you mean something other than using Browser? Because I
unaware of any _serious_ Trait issues until now, other than #- not
doing the right thing in complicated compositions.

frank

On 21 July 2013 23:12, Nicolas Cellier
<[hidden email]> wrote:

> So, it appears that all these are Traits, and that we currently can't browse
> Traits.
> See Trait someInstance browse...
> (In my image I have a few obsolete Traits by the way)
>
> 2013/7/21 Nicolas Cellier <[hidden email]>
>>
>> Note that bindingOf: contents moved to bindingOf:environment: since
>> Environment, so the fix might have to be updated.
>> BTW when I browse implementors of bindingOf: I see many Trait>>bindingOf:
>> Is it just me?
>>
>>
>> 2013/7/21 Frank Shearar <[hidden email]>
>>>
>>> On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
>>> > Whilst trawling through ancient dusty mantis reports I found this
>>> > little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to
>>> > myself, "well now, this one will be closable because someone will surely
>>> > have modified the compiler a fair bit by now and solved this". Wrong.
>>> > Despite the fairly amazing amount of heat that the discussion released back
>>> > in 2003 (ten years ago! eeek!) it appears nothing was done at the time
>>> > beyond a proposed fix that only got into Mantis-land two years late through
>>> > Ken Causey's good offices.
>>> >
>>> > I tried out the suggested test code in a very recent (#12641) image and
>>> > 8 out of 10 test passed. Now I'm no compiler guru and don't claim to have
>>> > any special opinion on this except that it looked pretty serious back then
>>> > and probably ought to be fixed if at all possible. Unless someone has good
>>> > reasons for those two 'failing' tests to be considered unimportant, of
>>> > course.
>>>
>>> Those two tests - are they the tests that Ken says failed before
>>> loading the changeset, and work afterwards?
>>>
>>> frank
>>>
>>> > tim
>>> > --
>>> > tim Rowledge; [hidden email]; http://www.rowledge.org/tim
>>> > There are two ways to write error-free programs; only the third one
>>> > works.
>>>
>>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Edgar De Cleene
In reply to this post by Nicolas Cellier
Re: [squeak-dev] Can't browse Traits [was Ancient Mantis Report 1554,  compiler and global vs class variables]


On 7/21/13 7:57 PM, "Nicolas Cellier" <[hidden email]> wrote:

AFAIK, Trait were only used to implement Trait (See category 311Deprecated-Traits).
I don't think that simplified Trait introduced by Andreas still uses Trait.

If we have Trait in Image, we should have a minimum tool support.
But even if we don't use Trait, but have one or more instance of Trait in the image then it should not spoil browsing implementors of #bindingOf:

Then removing Trait is yet another option, but it won't be that easy to re-introduce them if we ever need them or just want to experiment things.
The idea was more to provide a minimal support for Trait and don't use them directly in core system.


2013/7/22 tim Rowledge <[hidden email]>

On 21-07-2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:

> So, it appears that all these are Traits, and that we currently can't browse Traits.
> See Trait someInstance browse...
> (In my image I have a few obsolete Traits by the way)

Are Traits used at all? Are they used meaningfully? I remember they seemed like a pretty cool idea but has any actual, useful usefulness of a useful nature been made of them? Are there tools to do anything sensible with them? Is there current, readable documentation that would help people make good use of them?

If not, toss'em.

Some people think they was useful....
Could be removed and guess nobody here miss they.

Edgar


Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Nicolas Cellier
In reply to this post by Frank Shearar-3
+1 for keeping them (let's be a bit conservative).

What I call does not work is:
- if you have a Trait instance, say MyTrait, then (MyTrait browse) will open on Trait rather than MyTrait
- a side effect, browsing implementors of a method #traitMethod implemented by Trait will answer exactly one Trait>>traitMethod per Trait instance



2013/7/22 Frank Shearar <[hidden email]>
By "browse" do you mean something other than using Browser? Because I
unaware of any _serious_ Trait issues until now, other than #- not
doing the right thing in complicated compositions.

frank

On 21 July 2013 23:12, Nicolas Cellier
<[hidden email]> wrote:
> So, it appears that all these are Traits, and that we currently can't browse
> Traits.
> See Trait someInstance browse...
> (In my image I have a few obsolete Traits by the way)
>
> 2013/7/21 Nicolas Cellier <[hidden email]>
>>
>> Note that bindingOf: contents moved to bindingOf:environment: since
>> Environment, so the fix might have to be updated.
>> BTW when I browse implementors of bindingOf: I see many Trait>>bindingOf:
>> Is it just me?
>>
>>
>> 2013/7/21 Frank Shearar <[hidden email]>
>>>
>>> On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
>>> > Whilst trawling through ancient dusty mantis reports I found this
>>> > little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to
>>> > myself, "well now, this one will be closable because someone will surely
>>> > have modified the compiler a fair bit by now and solved this". Wrong.
>>> > Despite the fairly amazing amount of heat that the discussion released back
>>> > in 2003 (ten years ago! eeek!) it appears nothing was done at the time
>>> > beyond a proposed fix that only got into Mantis-land two years late through
>>> > Ken Causey's good offices.
>>> >
>>> > I tried out the suggested test code in a very recent (#12641) image and
>>> > 8 out of 10 test passed. Now I'm no compiler guru and don't claim to have
>>> > any special opinion on this except that it looked pretty serious back then
>>> > and probably ought to be fixed if at all possible. Unless someone has good
>>> > reasons for those two 'failing' tests to be considered unimportant, of
>>> > course.
>>>
>>> Those two tests - are they the tests that Ken says failed before
>>> loading the changeset, and work afterwards?
>>>
>>> frank
>>>
>>> > tim
>>> > --
>>> > tim Rowledge; [hidden email]; http://www.rowledge.org/tim
>>> > There are two ways to write error-free programs; only the third one
>>> > works.
>>>
>>
>
>
>
>




Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Casey Ransberger-2
In reply to this post by Nicolas Cellier
I just had a thought: maybe you need OmniBrowser to view them? I think the Traits people at SCG were probably using it. I could swear I've browsed traits before, but I may have had OmniBrowser or maybe I'm remember an early Pharo experience. 

On Jul 21, 2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:

So, it appears that all these are Traits, and that we currently can't browse Traits.
See Trait someInstance browse...
(In my image I have a few obsolete Traits by the way)

2013/7/21 Nicolas Cellier <[hidden email]>
Note that bindingOf: contents moved to bindingOf:environment: since Environment, so the fix might have to be updated.
BTW when I browse implementors of bindingOf: I see many Trait>>bindingOf: Is it just me?


2013/7/21 Frank Shearar <[hidden email]>
On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
> Whilst trawling through ancient dusty mantis reports I found this little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to myself, "well now, this one will be closable because someone will surely have modified the compiler a fair bit by now and solved this". Wrong. Despite the fairly amazing amount of heat that the discussion released back in 2003 (ten years ago! eeek!) it appears nothing was done at the time beyond a proposed fix that only got into Mantis-land two years late through Ken Causey's good offices.
>
> I tried out the suggested test code in a very recent (#12641) image and 8 out of 10 test passed. Now I'm no compiler guru and don't claim to have any special opinion on this except that it looked pretty serious back then and probably ought to be fixed if at all possible. Unless someone has good reasons for those two 'failing' tests to be considered unimportant, of course.

Those two tests - are they the tests that Ken says failed before
loading the changeset, and work afterwards?

frank

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> There are two ways to write error-free programs; only the third one works.






cbc
Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

cbc
You can browse the traits - just not by "traitName" browse.  

The other thing not nicely supported by the tools is to remove a trait from a class (or better yet, all traits from a class).  This is supported, but oddly - pass in an empty array into the uses: clause of the class creation method.  Which this re-formats the class creation method in the browser to not include the class creation method that uses #uses: as part of it.  Not pretty, but works.

And, yes, I've used Traits happily in building AST models from parsers - where I don't have the full parser or model yet, and want to keep state around for the unfinished parts.  It's worked nicely, but Stateful Traits would have been nicer for my purpose (which is NOT included in the simplified traits in Squeak).

-Chris


On Mon, Jul 22, 2013 at 12:31 PM, Casey Ransberger <[hidden email]> wrote:
I just had a thought: maybe you need OmniBrowser to view them? I think the Traits people at SCG were probably using it. I could swear I've browsed traits before, but I may have had OmniBrowser or maybe I'm remember an early Pharo experience. 


On Jul 21, 2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:

So, it appears that all these are Traits, and that we currently can't browse Traits.
See Trait someInstance browse...
(In my image I have a few obsolete Traits by the way)

2013/7/21 Nicolas Cellier <[hidden email]>
Note that bindingOf: contents moved to bindingOf:environment: since Environment, so the fix might have to be updated.
BTW when I browse implementors of bindingOf: I see many Trait>>bindingOf: Is it just me?


2013/7/21 Frank Shearar <[hidden email]>
On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
> Whilst trawling through ancient dusty mantis reports I found this little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to myself, "well now, this one will be closable because someone will surely have modified the compiler a fair bit by now and solved this". Wrong. Despite the fairly amazing amount of heat that the discussion released back in 2003 (ten years ago! eeek!) it appears nothing was done at the time beyond a proposed fix that only got into Mantis-land two years late through Ken Causey's good offices.
>
> I tried out the suggested test code in a very recent (#12641) image and 8 out of 10 test passed. Now I'm no compiler guru and don't claim to have any special opinion on this except that it looked pretty serious back then and probably ought to be fixed if at all possible. Unless someone has good reasons for those two 'failing' tests to be considered unimportant, of course.

Those two tests - are they the tests that Ken says failed before
loading the changeset, and work afterwards?

frank

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> There are two ways to write error-free programs; only the third one works.










Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Frank Shearar-3
On 22 July 2013 21:13, Chris Cunningham <[hidden email]> wrote:

> You can browse the traits - just not by "traitName" browse.
>
> The other thing not nicely supported by the tools is to remove a trait from
> a class (or better yet, all traits from a class).  This is supported, but
> oddly - pass in an empty array into the uses: clause of the class creation
> method.  Which this re-formats the class creation method in the browser to
> not include the class creation method that uses #uses: as part of it.  Not
> pretty, but works.
>
> And, yes, I've used Traits happily in building AST models from parsers -
> where I don't have the full parser or model yet, and want to keep state
> around for the unfinished parts.  It's worked nicely, but Stateful Traits
> would have been nicer for my purpose (which is NOT included in the
> simplified traits in Squeak).

Well, I wouldn't call them "simplified". It's just that Traits have
developed since then. The end result is the same, but the implications
are different :) Stateful traits in particular are pretty recent,
certainly post-Squeak/Pharo split (IIRC at least).

frank

> -Chris
>
>
> On Mon, Jul 22, 2013 at 12:31 PM, Casey Ransberger
> <[hidden email]> wrote:
>>
>> I just had a thought: maybe you need OmniBrowser to view them? I think the
>> Traits people at SCG were probably using it. I could swear I've browsed
>> traits before, but I may have had OmniBrowser or maybe I'm remember an early
>> Pharo experience.
>>
>>
>> On Jul 21, 2013, at 3:12 PM, Nicolas Cellier
>> <[hidden email]> wrote:
>>
>> So, it appears that all these are Traits, and that we currently can't
>> browse Traits.
>> See Trait someInstance browse...
>> (In my image I have a few obsolete Traits by the way)
>>
>> 2013/7/21 Nicolas Cellier <[hidden email]>
>>>
>>> Note that bindingOf: contents moved to bindingOf:environment: since
>>> Environment, so the fix might have to be updated.
>>> BTW when I browse implementors of bindingOf: I see many Trait>>bindingOf:
>>> Is it just me?
>>>
>>>
>>> 2013/7/21 Frank Shearar <[hidden email]>
>>>>
>>>> On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
>>>> > Whilst trawling through ancient dusty mantis reports I found this
>>>> > little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to
>>>> > myself, "well now, this one will be closable because someone will surely
>>>> > have modified the compiler a fair bit by now and solved this". Wrong.
>>>> > Despite the fairly amazing amount of heat that the discussion released back
>>>> > in 2003 (ten years ago! eeek!) it appears nothing was done at the time
>>>> > beyond a proposed fix that only got into Mantis-land two years late through
>>>> > Ken Causey's good offices.
>>>> >
>>>> > I tried out the suggested test code in a very recent (#12641) image
>>>> > and 8 out of 10 test passed. Now I'm no compiler guru and don't claim to
>>>> > have any special opinion on this except that it looked pretty serious back
>>>> > then and probably ought to be fixed if at all possible. Unless someone has
>>>> > good reasons for those two 'failing' tests to be considered unimportant, of
>>>> > course.
>>>>
>>>> Those two tests - are they the tests that Ken says failed before
>>>> loading the changeset, and work afterwards?
>>>>
>>>> frank
>>>>
>>>> > tim
>>>> > --
>>>> > tim Rowledge; [hidden email]; http://www.rowledge.org/tim
>>>> > There are two ways to write error-free programs; only the third one
>>>> > works.
>>>>
>>>
>>
>>
>>
>>
>>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Hannes Hirzel
In reply to this post by Frank Shearar-3
On 7/22/13, Frank Shearar <[hidden email]> wrote:

> On 21 July 2013 23:22, tim Rowledge <[hidden email]> wrote:
>>
>> On 21-07-2013, at 3:12 PM, Nicolas Cellier
>> <[hidden email]> wrote:
>>
>>> So, it appears that all these are Traits, and that we currently can't
>>> browse Traits.
>>> See Trait someInstance browse...
>>> (In my image I have a few obsolete Traits by the way)
>>
>> Are Traits used at all? Are they used meaningfully? I remember they seemed
>> like a pretty cool idea but has any actual, useful usefulness of a useful
>> nature been made of them? Are there tools to do anything sensible with
>> them? Is there current, readable documentation that would help people make
>> good use of them?
>>
>> If not, toss'em.
>
> I have started using them. Not meaningfully, or heavily. I would like
> to keep them because they (a) look useful for pulling out commonality
> that doesn't really have enough meat to form a class, (b) really just
> look like they need a bit more tooling support, and (c) they're the
> sort of low level nuts-and-bolts that are really difficult to get in
> in the first place.
>
> So for once I'm in favour of _not_ ripping them out.

+1

> frank
>
>> tim
>> --
>> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
>> Loyalty oaths.Secret searches.No-fly lists.Detention without legal
>> recourse.Remind me - who won the cold war?
>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Casey Ransberger-2
In reply to this post by cbc
Andreas said his implementation actually could support stateful traits trivially, though it wasn't exposed anywhere, and remarked that this would basically amount to mixin inheritance.

IIRC the limitation around traits being stateless was borne of somewhat academic motivation and a self-imposed constraint on the part of the people who did the original implementation at SCG. The version in Squeak currently doesn't have this limitation (it doesn't try to prevent you from putting state on a trait, but it doesn't give you a way to do it either.)

If you want stateful traits / mixins in Squeak, a good, long look at the traits implementation in Squeak may reveal how to do it.



On Mon, Jul 22, 2013 at 1:13 PM, Chris Cunningham <[hidden email]> wrote:
You can browse the traits - just not by "traitName" browse.  

The other thing not nicely supported by the tools is to remove a trait from a class (or better yet, all traits from a class).  This is supported, but oddly - pass in an empty array into the uses: clause of the class creation method.  Which this re-formats the class creation method in the browser to not include the class creation method that uses #uses: as part of it.  Not pretty, but works.

And, yes, I've used Traits happily in building AST models from parsers - where I don't have the full parser or model yet, and want to keep state around for the unfinished parts.  It's worked nicely, but Stateful Traits would have been nicer for my purpose (which is NOT included in the simplified traits in Squeak).

-Chris


On Mon, Jul 22, 2013 at 12:31 PM, Casey Ransberger <[hidden email]> wrote:
I just had a thought: maybe you need OmniBrowser to view them? I think the Traits people at SCG were probably using it. I could swear I've browsed traits before, but I may have had OmniBrowser or maybe I'm remember an early Pharo experience. 


On Jul 21, 2013, at 3:12 PM, Nicolas Cellier <[hidden email]> wrote:

So, it appears that all these are Traits, and that we currently can't browse Traits.
See Trait someInstance browse...
(In my image I have a few obsolete Traits by the way)

2013/7/21 Nicolas Cellier <[hidden email]>
Note that bindingOf: contents moved to bindingOf:environment: since Environment, so the fix might have to be updated.
BTW when I browse implementors of bindingOf: I see many Trait>>bindingOf: Is it just me?


2013/7/21 Frank Shearar <[hidden email]>
On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
> Whilst trawling through ancient dusty mantis reports I found this little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to myself, "well now, this one will be closable because someone will surely have modified the compiler a fair bit by now and solved this". Wrong. Despite the fairly amazing amount of heat that the discussion released back in 2003 (ten years ago! eeek!) it appears nothing was done at the time beyond a proposed fix that only got into Mantis-land two years late through Ken Causey's good offices.
>
> I tried out the suggested test code in a very recent (#12641) image and 8 out of 10 test passed. Now I'm no compiler guru and don't claim to have any special opinion on this except that it looked pretty serious back then and probably ought to be fixed if at all possible. Unless someone has good reasons for those two 'failing' tests to be considered unimportant, of course.

Those two tests - are they the tests that Ken says failed before
loading the changeset, and work afterwards?

frank

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> There are two ways to write error-free programs; only the third one works.














--
Casey Ransberger


Reply | Threaded
Open this post in threaded view
|

Re: Can't browse Traits [was Ancient Mantis Report 1554, compiler and global vs class variables]

Frank Shearar-3
On 23 July 2013 09:38, Casey Ransberger <[hidden email]> wrote:
> Andreas said his implementation actually could support stateful traits
> trivially, though it wasn't exposed anywhere, and remarked that this would
> basically amount to mixin inheritance.

"Yes" in the short answer form, but "no" in the longer form. Stateful
traits are a lot like mixins except you still have the
user-resolves-conflict thing, where mixin inheritance has the order
problem ( (A mixin: B) mixin: C is not (A mixin: C) mixin: B ).

> IIRC the limitation around traits being stateless was borne of somewhat
> academic motivation and a self-imposed constraint on the part of the people
> who did the original implementation at SCG. The version in Squeak currently
> doesn't have this limitation (it doesn't try to prevent you from putting
> state on a trait, but it doesn't give you a way to do it either.)
>
> If you want stateful traits / mixins in Squeak, a good, long look at the
> traits implementation in Squeak may reveal how to do it.

Or be lazy and ask folk like Stephane Ducasse, Camillo Bruni and some
other folks whose names have, regretfully, slipped my mind. See the
Pharo-dev mailing list over the past few months, including pointers to
the literature.

frank

> On Mon, Jul 22, 2013 at 1:13 PM, Chris Cunningham <[hidden email]>
> wrote:
>>
>> You can browse the traits - just not by "traitName" browse.
>>
>> The other thing not nicely supported by the tools is to remove a trait
>> from a class (or better yet, all traits from a class).  This is supported,
>> but oddly - pass in an empty array into the uses: clause of the class
>> creation method.  Which this re-formats the class creation method in the
>> browser to not include the class creation method that uses #uses: as part of
>> it.  Not pretty, but works.
>>
>> And, yes, I've used Traits happily in building AST models from parsers -
>> where I don't have the full parser or model yet, and want to keep state
>> around for the unfinished parts.  It's worked nicely, but Stateful Traits
>> would have been nicer for my purpose (which is NOT included in the
>> simplified traits in Squeak).
>>
>> -Chris
>>
>>
>> On Mon, Jul 22, 2013 at 12:31 PM, Casey Ransberger
>> <[hidden email]> wrote:
>>>
>>> I just had a thought: maybe you need OmniBrowser to view them? I think
>>> the Traits people at SCG were probably using it. I could swear I've browsed
>>> traits before, but I may have had OmniBrowser or maybe I'm remember an early
>>> Pharo experience.
>>>
>>>
>>> On Jul 21, 2013, at 3:12 PM, Nicolas Cellier
>>> <[hidden email]> wrote:
>>>
>>> So, it appears that all these are Traits, and that we currently can't
>>> browse Traits.
>>> See Trait someInstance browse...
>>> (In my image I have a few obsolete Traits by the way)
>>>
>>> 2013/7/21 Nicolas Cellier <[hidden email]>
>>>>
>>>> Note that bindingOf: contents moved to bindingOf:environment: since
>>>> Environment, so the fix might have to be updated.
>>>> BTW when I browse implementors of bindingOf: I see many
>>>> Trait>>bindingOf: Is it just me?
>>>>
>>>>
>>>> 2013/7/21 Frank Shearar <[hidden email]>
>>>>>
>>>>> On 21 July 2013 00:41, tim Rowledge <[hidden email]> wrote:
>>>>> > Whilst trawling through ancient dusty mantis reports I found this
>>>>> > little fella' - http://bugs.squeak.org/view.php?id=1554 and thought to
>>>>> > myself, "well now, this one will be closable because someone will surely
>>>>> > have modified the compiler a fair bit by now and solved this". Wrong.
>>>>> > Despite the fairly amazing amount of heat that the discussion released back
>>>>> > in 2003 (ten years ago! eeek!) it appears nothing was done at the time
>>>>> > beyond a proposed fix that only got into Mantis-land two years late through
>>>>> > Ken Causey's good offices.
>>>>> >
>>>>> > I tried out the suggested test code in a very recent (#12641) image
>>>>> > and 8 out of 10 test passed. Now I'm no compiler guru and don't claim to
>>>>> > have any special opinion on this except that it looked pretty serious back
>>>>> > then and probably ought to be fixed if at all possible. Unless someone has
>>>>> > good reasons for those two 'failing' tests to be considered unimportant, of
>>>>> > course.
>>>>>
>>>>> Those two tests - are they the tests that Ken says failed before
>>>>> loading the changeset, and work afterwards?
>>>>>
>>>>> frank
>>>>>
>>>>> > tim
>>>>> > --
>>>>> > tim Rowledge; [hidden email]; http://www.rowledge.org/tim
>>>>> > There are two ways to write error-free programs; only the third one
>>>>> > works.
>>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
> --
> Casey Ransberger
>
>
>