[squeak-dev] What are the current use cases for traits? (was: The Inbox: TraitsTests-pre.19.mcz)

Jakob Reschke forums.jakob at resfarm.de
Sun Mar 31 21:19:06 UTC 2019


I'm the one to blame for adding traits in the FS-AnsiStreams package. At
least in my "fork" for Squot and now Tonel that resides on GitHub. I tried
to have the readable stream, positionable stream, and writable stream
protocols like in the ANSI standard and experimented with that. Might not
be the most efficient way, but it works and avoids some the duplication
from the traditional Stream class hierarchy.

In Pharo they abandoned the "new" ansi streams and integrated
StandardFileStream & co. in FS instead.

Levente Uzonyi <leves at caesar.elte.hu> schrieb am So., 31. März 2019, 21:21:

> On Sat, 30 Mar 2019, David T. Lewis wrote:
>
> > Changing the subject line to focus on Levente's question.
> >
> > On Thu, Mar 28, 2019 at 06:43:11PM +0100, Levente Uzonyi wrote:
> >>
> >> What are the current use cases for traits?
> >
> > In order to experiment with Git based repositories, I have loaded the
> > Tonel package from the github repositories of Jakob Reschke.
> >
> >       Installer ensureRecentMetacello.
> >       (Smalltalk classNamed: #Metacello) new
> >          repository: 'github://j4yk/tonel:squeak';
> >          baseline: 'Tonel';
> >          load.
> >
> > This brings in the FS-AnsiStreams package, which uses traits.
> >
> > Having traits in Squeak allows me to load this package.
>
> I haven't tried your snippet and I don't know which version of FS depends
> on Traits, but the one on SqueakSource definitely does not.
> Btw, Traits can be flattened, so it's possible to make it loadable into
> images with no Trait support.
>
> So far all use cases of Traits in this thread (and its parent) were about
> interfaces. Squeak doesn't have a concept for that, and Traits are
> definitely more than just simple interfaces (as long as you don't want to
> interface state). Perhaps we need interfaces instead of traits.
>
> Levente
>
> >
> > Dave
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190331/dc42f469/attachment.html>


More information about the Squeak-dev mailing list