Re: About pushBack:

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

Re: sending text messages in and out of squeak from another application

Joshua Gargus-2
SqueakSource has newer versions.  For example: http://
www.squeaksource.com/OSProcess/OSProcess-dtl.36.mcz

How do you intend to use OSProcess?  Unix sockets or pipes would be  
more efficient than a TCP socket (although it hardly matters for text  
chat messages).  But then you have to have a different solution for  
Windows.  It seems like more trouble than necessary.

Josh


On Aug 4, 2007, at 5:03 PM, Lawson English wrote:

> Thanks. I found something named OSProcess, but from the  
> documentation, I can't tell if it i s actualy workign on a Mac, or  
> on any other OS for that matter. Nor can I figure out how to  
> download it if need be since the latest version is listed as 4.2.2  
> while the SqueakMap Package Loader only lists 4.0.1, which won't  
> load anyway due to some kind of error.
>
>
>
>
> Joshua Gargus wrote:
>> One suggestion is to create a network connection using sockets.  
>> Another is to use files.  For example, Second Life might write  
>> chat messages to a directory that Squeak would periodically check  
>> to see if new messages have arrived.  It might be easiest to put  
>> each message into it's own file.
>>
>> Josh
>>
>>
>> On Aug 4, 2007, at 12:49 PM, Lawson English wrote:
>>
>>> Hi. I'm trying to create a simple chat connection between Croquet  
>>> and Second Life, and it seems the most safe way to do this (to  
>>> avoid leaking private IM into a Croquet island) is to simply let  
>>> Squeak display the text i/o outside of Croquet.
>>>
>>> So... how do I send a message to squeak and pass one back out of  
>>> squeak?
>>>
>>> This seems a fundamental thing to do, but I'm not sure how to  
>>> start..
>>>
>>> Thanks.
>>>
>>>
>>> Lawson English.
>>>
>>
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

LawsonEnglish
Joshua Gargus wrote:
> SqueakSource has newer versions.  For example:
> http://www.squeaksource.com/OSProcess/OSProcess-dtl.36.mcz
How do I get that into squeak? It doesnt seem to appear in the
Montecello browser, and I'm not sure how to load it from the download.

>
> How do you intend to use OSProcess?  Unix sockets or pipes would be
> more efficient than a TCP socket (although it hardly matters for text
> chat messages).  But then you have to have a different solution for
> Windows.  It seems like more trouble than necessary.


I might be. The sample source code I have from IBM just uses pies for
Linux. I'd like a generic solution to something that should be trivial,
but right now, I'd settle for a proof of concept working on any platform.

Not that appears likely at the moment.



Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

Joshua Gargus-2
On Aug 4, 2007, at 5:37 PM, Lawson English wrote:

> Joshua Gargus wrote:
>> SqueakSource has newer versions.  For example: http://
>> www.squeaksource.com/OSProcess/OSProcess-dtl.36.mcz
> How do I get that into squeak? It doesnt seem to appear in the  
> Montecello browser,

Do you have the OSProcess repository in Monticello's list of  
repositories?  You should have an entry like 'http://squeaksource.com/ 
OSProcess'.  If not, you must add it.

> and I'm not sure how to load it from the download.

There is a 'load' option when a .mcz file is selected in a Squeak  
'file list'.

Josh


>
>>
>> How do you intend to use OSProcess?  Unix sockets or pipes would  
>> be more efficient than a TCP socket (although it hardly matters  
>> for text chat messages).  But then you have to have a different  
>> solution for Windows.  It seems like more trouble than necessary.
>
>
> I might be. The sample source code I have from IBM just uses pies  
> for Linux. I'd like a generic solution to something that should be  
> trivial, but right now, I'd settle for a proof of concept working  
> on any platform.
>
> Not that appears likely at the moment.
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

LawsonEnglish
Joshua Gargus wrote:

> On Aug 4, 2007, at 5:37 PM, Lawson English wrote:
>
>> Joshua Gargus wrote:
>>> SqueakSource has newer versions.  For example:
>>> http://www.squeaksource.com/OSProcess/OSProcess-dtl.36.mcz
>> How do I get that into squeak? It doesnt seem to appear in the
>> Montecello browser,
>
> Do you have the OSProcess repository in Monticello's list of
> repositories?  You should have an entry like
> 'http://squeaksource.com/OSProcess'.  If not, you must add it.
>
>> and I'm not sure how to load it from the download.
>
> There is a 'load' option when a .mcz file is selected in a Squeak
> 'file list'.
>
> Josh
>
Thanks,  got it to load. Stil lnot sure the best way to proceedd though.
Windows requires one to use sockets for Interapplication communication?


Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

johnmci
In reply to this post by LawsonEnglish

On Aug 4, 2007, at 5:03 PM, Lawson English wrote:

> Thanks. I found something named OSProcess, but from the  
> documentation, I can't tell if it i s actualy workign on a Mac, or  
> on any other OS for that matter. Nor can I figure out how to  
> download it if need be since the latest version is listed as 4.2.2  
> while the SqueakMap Package Loader only lists 4.0.1, which won't  
> load anyway due to some kind of error.

The 3.8.18beta1U mac carbon VM in the 3.9 distribution folder now has  
the OSProcess plugin included.
You just need the latest smalltalk software to use. The instructions  
should tell you "hopefully" how to quickly test it to see if it works  
for you.


--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

LawsonEnglish
John M McIntosh wrote:

>
> On Aug 4, 2007, at 5:03 PM, Lawson English wrote:
>
>> Thanks. I found something named OSProcess, but from the
>> documentation, I can't tell if it i s actualy workign on a Mac, or on
>> any other OS for that matter. Nor can I figure out how to download it
>> if need be since the latest version is listed as 4.2.2 while the
>> SqueakMap Package Loader only lists 4.0.1, which won't load anyway
>> due to some kind of error.
>
> The 3.8.18beta1U mac carbon VM in the 3.9 distribution folder now has
> the OSProcess plugin included.
> You just need the latest smalltalk software to use. The instructions
> should tell you "hopefully" how to quickly test it to see if it works
> for you.
>
Thanks very much.

Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

Enno Schwass
Hi

>>> Thanks. I found something named OSProcess, but from the  
>>> documentation, I can't tell if it i s actualy workign on a Mac,  
>>> or on any other OS for that matter. Nor can I figure out how to  
>>> download it if need be since the latest version is listed as  
>>> 4.2.2 while the SqueakMap Package Loader only lists 4.0.1, which  
>>> won't load anyway due to some kind of error.
>>
>> The 3.8.18beta1U mac carbon VM in the 3.9 distribution folder now  
>> has the OSProcess plugin included.
>> You just need the latest smalltalk software to use. The  
>> instructions should tell you "hopefully" how to quickly test it to  
>> see if it works for you.
> Thanks very much.

I myself had problems to install CommandShell via UniverseBrowser.  
What I did to get it working on my Powerbook was:

I take the latest squeak-dev image, then install OSProcess via  
UniverseBrowser, then download

http://wiki.squeak.org/squeak/uploads/1914/CommandShellV3-0-5-dtl.sar

and install it via FileList (load)

open a workspace and do Alt-p on

OSProcess thisOSProcess waitForCommandOutput: '/bin/ls'

Everything okay?
Enno

Reply | Threaded
Open this post in threaded view
|

Re: About pushBack:

Jason Johnson-5
In reply to this post by Andreas.Raab
On 8/4/07, Andreas Raab <[hidden email]> wrote:
Yes. But the main reason is that Java interfaces a) implicitly encourage
minimal interfaces (since you can't provide an implementation there is
no reason to add anything but the minimal set of methods that need to be
supported) and b) that they describe only the "what" (interface) not the
"how" (implementation).


Well that's one way for a language beat people into doing things the way it wants. :)  But from what I have seen the inability to specify a default implementation causes people to either have the same code duplicated (which Java programmers don't mind because Java is a language one writes and uses tools to write), or hierarchies that make no sense, since they were only made to avoid duplication of code.

Contrast this with traits (or MI in general) where larger interfaces are
implicitly encouraged (adding utility methods or "refactoring" the
interface which ultimately leads to a *worse* interface which is much
larger than it needs to be and that you can't get rid of since it's
needed by the implementation) and the need to traverse a multitude of
hierarchies to understand where some implementation comes from plus the
need to disambiguate by renaming and you end up in a nice spaghetti bowl.


Well, this is certainly true of MI, but it isn't true for type classes and I, therefore, don't believe it has to be this way for traits.  It is a valid concern though and I have seen things already that look like what I would consider mis-uses of the technology (and for anyone who will ask, no I don't remember what, just methods too big for a trait IMO).


The ultimate problem with traits (MI) isn't state - it's that it drops
the idea of encapsulation (objects staying individual entities) and
simply merge the implementation into a common name space. That this
isn't a great idea is known as far back as C's #include statement.


If used that way then sure, of course you're right.  But IMO traits are supposed to be a signal that says "I implement this protocol" in a first class manner.  The fact that they allow you to define a default implementation is good to avoid code duplication but it should not be used to have a form of MI.


Indeed. Having interfaces to describe what is expected of a particular
responsibility is a very, very good idea. Sharing the implementations
via MI-like mechanisms is not. Note however, that for example mixins
preserve the encapsulation of objects in much stronger ways than traits
by not merging the name spaces but rather constructing a unified
inheritance chain. From my POV this is advantageous to what traits do.


Hrm, I guess I need to go dig deeper into exactly how mixins work because I don't understand what you mean here.  I looked a little at Strongtalk mixins and they seemed to be a function that applied to a class to inject existing methods into it somehow.  I mentally wrote it down as being the same thing as a Haskell type class and Squeak traits.
 

Why not? I haven't seen very many streams which "by their nature" would
be read-only or write-only. There are no such streams in Squeak for
example; there are only those that have been made arbitrarily read-only
(ReadStream) or that have attributes describing their readability state
(FileStream). But even if there were, it is not clear to me that it is
advantageous for a client to receive a MessageNotUnderstood instead of a
ReadOnlyStream error. Since Squeak isn't statically typed, there is not
much of an advantage here.

Cheers,
   - Andreas


I was thinking of the user level, not the programmer level.  For example, write-only streams would be /dev/null, one could see a UDP connection as a write-only as well as TCP in some cases ( e.g. the data socket in an FTP transaction).  Read-only are even more common (e.g. files on read-only media, files you have read-only access to, etc.).

I was also thinking of it as negative to have to have certain methods protected by a "isWritable/Readable" type flag in an OO language, but you bring up a good point about typing.  On the other hand, in practice what the user will see is something like "ReadOnlyStream does not understand: writeData:", right?  That would be just as informative to me as "ExternalStream is readonly", since once you see the DNU pop up you would say "oh yea, of course it doesn't understand writing", no?


Reply | Threaded
Open this post in threaded view
|

Re: About pushBack:

Jason Johnson-5
Oh, and I forgot to mention:

I don't personally see traits as something that comes up that often.  99% of the time inheritance, or some OO pattern gives the best solution.  But in that 1% something like a trait is the correct solution and not having it shows up a design wart.

Personally the thing that stuck out to me in my travels through the Squeak image was just the Magnitude class.  I personally think that should just be a trait.  In fact I would see at least equality and comparability as separate traits.  By having it be a class causes certain design warts [1] imo.

[1]  In the case where a class should really inherit somewhere else you either have to inherit from Magnitude and duplicate the other code, inherit from the correct class and duplicate the Magnitude code or change the highest class in your hierarchy to inherit from Magnitude instead of Object.  These solutions are all code smell imo.


Reply | Threaded
Open this post in threaded view
|

Re: About pushBack:

Nicolas Cellier-3
Jason Johnson a écrit :

> Oh, and I forgot to mention:
>
> I don't personally see traits as something that comes up that often.  
> 99% of the time inheritance, or some OO pattern gives the best
> solution.  But in that 1% something like a trait is the correct solution
> and not having it shows up a design wart.
>
> Personally the thing that stuck out to me in my travels through the
> Squeak image was just the Magnitude class.  I personally think that
> should just be a trait.  In fact I would see at least equality and
> comparability as separate traits.  By having it be a class causes
> certain design warts [1] imo.
>
> [1]  In the case where a class should really inherit somewhere else you
> either have to inherit from Magnitude and duplicate the other code,
> inherit from the correct class and duplicate the Magnitude code or
> change the highest class in your hierarchy to inherit from Magnitude
> instead of Object.  These solutions are all code smell imo.
>
>
> ------------------------------------------------------------------------
>

Very true.
Try to extend algebra with matrices, vector space, or symbolic
computation, and you will see that simple inheritance makes it hard to
avoid duplications.
This makes me think of axiom which has a separate hierarchy for
inheriting mathematical properties...

Nicolas


Reply | Threaded
Open this post in threaded view
|

Re: About pushBack:

Andreas.Raab
In reply to this post by Jason Johnson-5
Jason Johnson wrote:
> I don't personally see traits as something that comes up that often.  
> 99% of the time inheritance, or some OO pattern gives the best
> solution.  But in that 1% something like a trait is the correct solution
> and not having it shows up a design wart.

I completely agree with this statement. And in return I *urge* you to
look at actual code and stand corrected ;-) Let's take an example:

Here is what the base class hierarchy in Nile looks like:

AbstractCollectionStream
   ReadableCollectionStream
     ByteReader
     StringReader
   WritableCollectionStream
     ByteWriter
     StringWriter
     ReadWriteCollectionStream

Except from the -somewhat arbitrary- distinction between byte and string
reader it's pretty standard and looks (if you replace
AbstractCollectionStream with PositionableStream) fairly similar to what
we have today:

PositionableStream
   ReadStream
   WriteStream
     ReadWriteStream

But now, let's look at how it works. Here is how the Nile class library
looks when we add the traits (written as <trait>):

AbstractCollectionStream
   ReadableCollectionStream <ReadableCollectionStream - position,
setPosition, collection, setCollection:>
     ByteReader <ByteReading - next, nextInto:, next:>
     StringReader <CharacterReading>
   WritableCollectionStream <NSTWriteableCollectionStream - position,
setPosition:, collection, setCollection:>
     ByteWriter <ByteWriting - nextPut:, nextPutAll:>
     StringWriter <CharacterWriting - nextPut:>
     ReadWriteCollectionStream <ReadableCollectionStream - size,
collection, setCollection:, position, setPosition:>

and the traits hierarchy itself is here:

<ByteReading>
<ByteWriting>
<CharacterReading>
<CharacterWriting>
<CollectionStream>
        <PositionableStream>
<GettableStream>
        <Stream>
<PositionableStream>
        <Stream>
<PuttableStream>
        <Stream>
<ReadableCollectionStream>
        <GettableStream @ basicBack -> back>
        <CollectionStream>
<Stream>
<WriteableCollectionStream>
        <PuttableStream>
        <CollectionStream>

Now let's start counting: Instead of a single inheritance hierarchy with
8 entities (classes) that I need to know about I have 19 entities (8
classes, 11 traits) in an MI hierarchy. In addition we have nested
traits (so you'll have to know the other inheritance branches fairly
well), renames (ReadableCollectionStream) and exclusions (6 out of 8
classes have exclusions) complicating the structure even further. A more
realistic complexity measure (counting the number of occurrences of the
various entities) ends up with about 4x the complexity of the traits
version (which is certainly what it feels like).

So why would this be advantageous to a single inheritance hierarchy?

I'm pretty sure someone will come back and say "but wait! isn't the idea
that *other* clients will use those traits and in return will be simpler
and better and easier?" So let's look at this too:

I'll be looking at the Files hierarchy in Nile for the sole purpose that
it is the only comparable piece that has counter parts in Squeak today
and Squeak's files are certainly messy enough that they need a good
makeover. So here is the hierarchy for files in Nile (again without the
traits):

AbstractFileStream
   AbstractBinaryStream
     ReadFileBinaryStream
     WriteFileBinaryStream
     ReadWriteFileBinaryStream
   AbstractTextStream
     ReadFileTextStream
     WriteFileTextStream
     ReadWriteFileTextStream

The structure is ... shall we say unusual and (I think) heavily
influenced by the desire to create permutations of existing traits
instead of applying other OO design principles. And here is the version
with traits information included:

AbstractFileStream
   AbstractBinaryStream
     ReadFileBinaryStream <ReadFileStream - fileName, bufferType,
getFileID, setFileID: setFileName> <ByteReading>
     WriteFileBinaryStream <WriteFileStream - fileName, bufferType,
getFileID, setFileID: setFileName> <ByteWriting>
     ReadWriteFileBinaryStream <ReadFileStream - fileName, bufferType,
getFileID, setFileID: setFileName> <WriteFileStream - fileName,
bufferType, getFileID, setFileID: setFileName> <ByteWriting>
   AbstractTextStream
     ReadFileTextStream <ReadFileStream - fuleName, bufferType,
getFileID, setFileID: setFileName> <CharacterReading>
     WriteFileTextStream <WriteFileStream - fileName, bufferType,
getFileID, setFileID: setFileName> <CharacterWriting>
     ReadWriteFileTextStream <ReadFileStream - fileName, bufferType,
getFileID, setFileID: setFileName> <WriteFileStream - fileName,
bufferType, getFileID, setFileID: setFileName> <ByteWriting>

<FileStream>
   <PositionableStream - isBinary>
<ReadFileStream>
   <GettableStream - close, isBinary, isClosed>
   <FileStream>
<WriteFileStream>
   <PuttableStream - close, isBinary, isClosed>
   <FileStream>

The amount of added complexity is mindboggling to me, and other than
AbstractFileStream being a subclass of Object there doesn't seem to be
*any* advantage of using traits. The disadvantages however, like the
explosion in the number of entities are very real (I think anyone who
has tried to understand the Squeak 3.9 and later meta class hierarchy
will agree).

So ultimately, I agree with your statement. There may be *some* uses for
traits, but those are few and far inbetween (and, realistically
speaking, nobody has found one yet). In the cases that we have seen so
far, traits are simply used as MI with all the same problems that MI
has. Nile certainly shows the symptoms (added complexity, conflicts)
that we've come to recognize as the hallmark of MI systems.

Cheers,
   - Andreas


Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

LawsonEnglish
In reply to this post by johnmci
John M McIntosh wrote:

>
> On Aug 4, 2007, at 5:03 PM, Lawson English wrote:
>
>> Thanks. I found something named OSProcess, but from the
>> documentation, I can't tell if it i s actualy workign on a Mac, or on
>> any other OS for that matter. Nor can I figure out how to download it
>> if need be since the latest version is listed as 4.2.2 while the
>> SqueakMap Package Loader only lists 4.0.1, which won't load anyway
>> due to some kind of error.
>
> The 3.8.18beta1U mac carbon VM in the 3.9 distribution folder now has
> the OSProcess plugin included.
> You just need the latest smalltalk software to use. The instructions
> should tell you "hopefully" how to quickly test it to see if it works
> for you.

Hmmm. For some reason, the version with 3.8.18beta specified doesnt'
quite work. A different folder, labled Squeak3.9-final-7067, seemed to
work better, but it may have just be "cleaner" than the other one when I
started testing.

Now that I know that it works (I can even do a few simple shell commands
from the shell window, whee), I have ot figure out how to use it. Are
they any existing examples I might look at for implementing I/O via pipes?

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

David T. Lewis
On Sun, Aug 05, 2007 at 07:33:01PM -0700, Lawson English wrote:

> John M McIntosh wrote:
> >
> >On Aug 4, 2007, at 5:03 PM, Lawson English wrote:
> >
> >>Thanks. I found something named OSProcess, but from the
> >>documentation, I can't tell if it i s actualy workign on a Mac, or on
> >>any other OS for that matter. Nor can I figure out how to download it
> >>if need be since the latest version is listed as 4.2.2 while the
> >>SqueakMap Package Loader only lists 4.0.1, which won't load anyway
> >>due to some kind of error.
> >
> >The 3.8.18beta1U mac carbon VM in the 3.9 distribution folder now has
> >the OSProcess plugin included.
> >You just need the latest smalltalk software to use. The instructions
> >should tell you "hopefully" how to quickly test it to see if it works
> >for you.
>
> Hmmm. For some reason, the version with 3.8.18beta specified doesnt'
> quite work. A different folder, labled Squeak3.9-final-7067, seemed to
> work better, but it may have just be "cleaner" than the other one when I
> started testing.
>
> Now that I know that it works (I can even do a few simple shell commands
> from the shell window, whee), I have ot figure out how to use it. Are
> they any existing examples I might look at for implementing I/O via pipes?

Look at the class side methods in PipeableOSProcess. There are a number
of examples there, and many of the methods have examples in the method
comments. A PipeableOSProcess is a proxy for an external OS process that
has its stdin/stdout/stderr pipes connected and accessible from Squeak.

You can also create instances of OSPipe if you want to work with pipes
directly, but pay attention to blocking versus non-blocking pipes, as
you can hang up your Squeak VM by reading a blocking pipe that has no
data available.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

LawsonEnglish
David T. Lewis wrote:

> On Sun, Aug 05, 2007 at 07:33:01PM -0700, Lawson English wrote:
>  
>> John M McIntosh wrote:
>>    
>>> On Aug 4, 2007, at 5:03 PM, Lawson English wrote:
>>>
>>>      
>>>> Thanks. I found something named OSProcess, but from the
>>>> documentation, I can't tell if it i s actualy workign on a Mac, or on
>>>> any other OS for that matter. Nor can I figure out how to download it
>>>> if need be since the latest version is listed as 4.2.2 while the
>>>> SqueakMap Package Loader only lists 4.0.1, which won't load anyway
>>>> due to some kind of error.
>>>>        
>>> The 3.8.18beta1U mac carbon VM in the 3.9 distribution folder now has
>>> the OSProcess plugin included.
>>> You just need the latest smalltalk software to use. The instructions
>>> should tell you "hopefully" how to quickly test it to see if it works
>>> for you.
>>>      
>> Hmmm. For some reason, the version with 3.8.18beta specified doesnt'
>> quite work. A different folder, labled Squeak3.9-final-7067, seemed to
>> work better, but it may have just be "cleaner" than the other one when I
>> started testing.
>>
>> Now that I know that it works (I can even do a few simple shell commands
>> from the shell window, whee), I have ot figure out how to use it. Are
>> they any existing examples I might look at for implementing I/O via pipes?
>>    
>
> Look at the class side methods in PipeableOSProcess. There are a number
> of examples there, and many of the methods have examples in the method
> comments. A PipeableOSProcess is a proxy for an external OS process that
> has its stdin/stdout/stderr pipes connected and accessible from Squeak.
>
> You can also create instances of OSPipe if you want to work with pipes
> directly, but pay attention to blocking versus non-blocking pipes, as
> you can hang up your Squeak VM by reading a blocking pipe that has no
> data available.
>
>
>  

Thanks for the pointers to the examples. Unfortunately, none of them
seem to work. They all return either a message that the Accessor cannot
access the system. I'm no doubt missing something.




Reply | Threaded
Open this post in threaded view
|

Re: About pushBack:

Jason Johnson-5
In reply to this post by Andreas.Raab
On 8/6/07, Andreas Raab <[hidden email]> wrote:
Jason Johnson wrote:
> I don't personally see traits as something that comes up that often.
> 99% of the time inheritance, or some OO pattern gives the best
> solution.  But in that 1% something like a trait is the correct solution
> and not having it shows up a design wart.

I completely agree with this statement. And in return I *urge* you to
look at actual code and stand corrected ;-) Let's take an example:

Well, I don't recall endorsing Nile itself (since I haven't looked at the code yet), nor saying that traits can't be abused. :)  In Haskell it is possible to use Type classes to create single inheritance (albeit compile time only) or even MI, but that's not what type classes are for.

Likewise it is certainly possible to do MI with traits, but this is IMO not the itch they best scratch.  So if I had said explicitly or seemed to imply otherwise then I do indeed stand corrected and apologize for misrepresenting myself.  Any useful feature can be abused.

Here is what the base class hierarchy in Nile looks like:
<snip>
So why would this be advantageous to a single inheritance hierarchy?

I'm pretty sure someone will come back and say "but wait! isn't the idea
that *other* clients will use those traits and in return will be simpler
and better and easier?" So let's look at this too:
<snip>
The structure is ... shall we say unusual and (I think) heavily
influenced by the desire to create permutations of existing traits
instead of applying other OO design principles.


Oh my, this does strike me as more complicated then necessary (though I still need to look at the code).  But if it is as you suggest (as it may well be), then I think something like this comes about by the constant innuendo that traits are a solution looking for a problem.  Under that kind of pressure one might start looking for a place to force the solution in, unfortunately appearing to be a self fulfilled prophecy.
 

The amount of added complexity is mindboggling to me, and other than
AbstractFileStream being a subclass of Object there doesn't seem to be
*any* advantage of using traits. The disadvantages however, like the
explosion in the number of entities are very real (I think anyone who
has tried to understand the Squeak 3.9 and later meta class hierarchy
will agree).

So ultimately, I agree with your statement. There may be *some* uses for
traits, but those are few and far inbetween (and, realistically
speaking, nobody has found one yet).


With this part I still disagree.  I think I have found one:  Magnitude.  I think that should be a trait not a class.  But to your point that is the singular case of an obvious trait that I can think of in my whole Squeak image.  But it *is* still useful in that context.

Personally, I think the best tact to take to *prove* traits is to go look at how Haskell uses Type classes.  That is the best example I have seen in using this concept.
 

In the cases that we have seen so
far, traits are simply used as MI with all the same problems that MI
has. Nile certainly shows the symptoms (added complexity, conflicts)
that we've come to recognize as the hallmark of MI systems.

Cheers,
   - Andreas


That is a shame, but you seem to agree that the concept does have value at least conceptually.  So I guess the question is, is this a concept that is just getting a bad rap by what appear to be solutions made more complicated by it's use, or is this something simply too complicated for anyone to use correctly regardless of it's conceptual value?

P.S.

Just to give something concrete, here is basically what Haskell has for the Eq (equality) type class:

class Eq
  x == y = ! (x != y)
  x != y = ! ( x == y)

So what this is saying is that objects that are of type Eq have the == and != functions.  It also provides default implementations for this, but notice: these implementations are defined from each other.  No, this wont compile.  But what this will do is allow you to just define the function that is easiest and the other definition will be correct then.

So in this case you can't just declare your new type as Eq and everything works (though you can say it derives from it, but that's something different).  You still have to define at least one function and I think most if not all the Type classes behave like this.


Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

johnmci
In reply to this post by LawsonEnglish

On Aug 6, 2007, at 9:28 AM, Lawson English wrote:

>
> Thanks for the pointers to the examples. Unfortunately, none of  
> them seem to work. They all return either a message that the  
> Accessor cannot access the system. I'm no doubt missing something.


You should first confirm your copy of Squeak 3.8.18beta1U.app  
Resources folder contains UnixOSProcessPlugin.bundle
In checking the copy of the on my ftp site does contain that.

If I do

  UnixOSProcessAccessor basicNew primGetSession

I get back magic bits.


Also check   SmalltalkImage current listLoadedModules  which shows  
for me

'UnixOSProcessPlugin 11 October 2006 (e)'

I believe I just loaded OSProcess (4.3) on SqueakMap

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: sending text messages in and out of squeak from another application

LawsonEnglish
John M McIntosh wrote:

>
> On Aug 6, 2007, at 9:28 AM, Lawson English wrote:
>
>>
>> Thanks for the pointers to the examples. Unfortunately, none of them
>> seem to work. They all return either a message that the Accessor
>> cannot access the system. I'm no doubt missing something.
>
>
> You should first confirm your copy of Squeak 3.8.18beta1U.app
> Resources folder contains UnixOSProcessPlugin.bundle
> In checking the copy of the on my ftp site does contain that.
>
> If I do
>
>  UnixOSProcessAccessor basicNew primGetSession
>
> I get back magic bits.
>
>
> Also check   SmalltalkImage current listLoadedModules  which shows for me
>
> 'UnixOSProcessPlugin 11 October 2006 (e)'
>
> I believe I just loaded OSProcess (4.3) on SqueakMap
>
Thanks very much. I just discovred I had an obsolete version of
SqueakMap, so I had to install THAT before I could see other recent updates.



12