SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

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

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Igor Stasenko
2009/7/29 Nicolas Cellier <[hidden email]>:

> 2009/7/29 Igor Stasenko <[hidden email]>:
>> 2009/7/29 Damien Cassou <[hidden email]>:
>>> 2009/7/29 Mariano Martinez Peck <[hidden email]>:
>>>>
>>>> On Tue, Jul 28, 2009 at 5:39 PM, Igor Stasenko <[hidden email]> wrote:
>>>>>
>>>>> I think that all such kind of queries (like isXXXPlatform) should be
>>>>> not included and not used in a well-designed system.
>>>>> If you want some capability - then you should ask directly for it,
>>>>> irrespectively on what platform you are currently running.
>>>>
>>>> I am agree. I really believe in the phrase "tell don't ask". However, I have
>>>> a couple of things to say:
>>>>
>>>> 1) It is not as easy as it seems. If you want to delegate to another object
>>>> and be polymorphic regarding the platform you must reify a couple of classes
>>>> (in your slash it is easy because you have the File hierarchy). I mean, you
>>>> cannot put everything in the Platform class. And this must be done in every
>>>> place. You must really understand that piece of code to change it. I can do
>>>> this in my projects, but I don't know about to do it everywhere.
>>>
>>> The class OSPlatform is quite small. I would vote for:
>>>
>>> - implementing the following methods
>>>
>>> OSPlatform>>isMacOSX
>>>  ^ false
>>> OSPlatform>>isWin32
>>>  ^ false
>>> OSPlatform>>isUnix
>>>  ^ false
>>>
>>> and then
>>>
>>> MacOSXPlatform>>isMacOSX
>>>  ^ true
>>> UnixPlatform>>isUnix
>>>  ^ true
>>> Win32Platform>>isWin32
>>>  ^ true
>>>
>>> - when you want to test the platform, just do:
>>>
>>> OSPlatform current isMacOSX
>>>
>>> or
>>>
>>> OSPlatform current isWin32
>>>
>>> What do you think?
>>>
>>
>> How about shortcut methods then?
>>
>> OSPlatform class>>isMacOSX
>>  ^ self current isMacOSX
>>
>> etc...
>>
>
> Or let it be a global? like Smalltalk, Processor, etc...
> Do we write SystemDictionary current?
>
you mean global var 'Platform'?

there is OSPlatform global var. Why not use it instead?
Or, someone please tell me, why everyone tend to mis-use the singleton
pattern in a form:
'Foo current' , whereas the Foo is already a singleton???

>>> --
>>> Damien Cassou
>>> http://damiencassou.seasidehosting.st
>>>
>>> "Lambdas are relegated to relative obscurity until Java makes them
>>> popular by not having them." James Iry
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Andreas Wacknitz
In reply to this post by Marcus Denker-3

Am 29.07.2009 um 20:08 schrieb Marcus Denker:

>
> On 29.07.2009, at 14:02, Andreas Wacknitz wrote:
>
>>
>> Am 29.07.2009 um 17:46 schrieb Damien Cassou:
>>
>>> On Wed, Jul 29, 2009 at 5:20 PM, Andreas Wacknitz<[hidden email]>
>>> wrote:
>>>> When I learned object orientation one of the first things I
>>>> encountered was:
>>>> "Procedural code makes decisions, object oriented code delegates."
>>>> Or, sometimes simply: "Tell, don't ask!".
>>>> For me this looks like asking...
>>>
>>> I agree but this would be a good start I think.
>> A start in what direction? Is there a plan to change this later? And
>> if so, when, who and how?
>>
>
> The old Squeak desease was that nothing ever was done, because at some
> point
> it was found that "we could do better". This resulted in *complete*
> paralysis.
>
> For Pharo, the idea is to do something if it´s better. Just imagine
> what you can
> do in 10 years if you do a lot of little things a little bit better.
> Instead of
> doing nothing and waiting for perfection.
>
I understand your point but part of Squeak's problem is its actual  
state.
Many things are really messy and crappy.
While the proposed solution might be better for the actual problem (a  
special unit test for the Mac),
I really fear a new source for code rot. When this isXXX will be  
established it will be used in other situations
sooner or later. And I can't see that
        OSPlatform current isMacOSX
is really that much better than
  SmalltalkImage current platformName = 'Mac OS'


Andreas



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Mariano Martinez Peck


On Wed, Jul 29, 2009 at 6:06 PM, Andreas Wacknitz <[hidden email]> wrote:

Am 29.07.2009 um 20:08 schrieb Marcus Denker:

>
> On 29.07.2009, at 14:02, Andreas Wacknitz wrote:
>
>>
>> Am 29.07.2009 um 17:46 schrieb Damien Cassou:
>>
>>> On Wed, Jul 29, 2009 at 5:20 PM, Andreas Wacknitz<[hidden email]>
>>> wrote:
>>>> When I learned object orientation one of the first things I
>>>> encountered was:
>>>> "Procedural code makes decisions, object oriented code delegates."
>>>> Or, sometimes simply: "Tell, don't ask!".
>>>> For me this looks like asking...
>>>
>>> I agree but this would be a good start I think.
>> A start in what direction? Is there a plan to change this later? And
>> if so, when, who and how?
>>
>
> The old Squeak desease was that nothing ever was done, because at some
> point
> it was found that "we could do better". This resulted in *complete*
> paralysis.
>
> For Pharo, the idea is to do something if it´s better. Just imagine
> what you can
> do in 10 years if you do a lot of little things a little bit better.
> Instead of
> doing nothing and waiting for perfection.
>
I understand your point but part of Squeak's problem is its actual
state.
Many things are really messy and crappy.
While the proposed solution might be better for the actual problem (a
special unit test for the Mac),
I really fear a new source for code rot. When this isXXX will be
established it will be used in other situations

Yes. I am agree. The thing is, who will do it?  Ho has the time to understand every place and change it ?
 

sooner or later. And I can't see that
       OSPlatform current isMacOSX
is really that much better than
       SmalltalkImage current platformName = 'Mac OS'


Yes it is. I it is not MUCH better, but a bit better and easy to implement. Tomorrow the platform name changes and you have to change your code all over the image. At least, with this, you have the hardcoded in a single place. After this, with a single "senders" you can see where it is used and how to modify this for a more OO stuff.

 



Andreas



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Andreas Wacknitz

Am 29.07.2009 um 21:13 schrieb Mariano Martinez Peck:



On Wed, Jul 29, 2009 at 6:06 PM, Andreas Wacknitz <[hidden email]> wrote:

Am 29.07.2009 um 20:08 schrieb Marcus Denker:

>
> On 29.07.2009, at 14:02, Andreas Wacknitz wrote:
>
>>
>> Am 29.07.2009 um 17:46 schrieb Damien Cassou:
>>
>>> On Wed, Jul 29, 2009 at 5:20 PM, Andreas Wacknitz<[hidden email]>
>>> wrote:
>>>> When I learned object orientation one of the first things I
>>>> encountered was:
>>>> "Procedural code makes decisions, object oriented code delegates."
>>>> Or, sometimes simply: "Tell, don't ask!".
>>>> For me this looks like asking...
>>>
>>> I agree but this would be a good start I think.
>> A start in what direction? Is there a plan to change this later? And
>> if so, when, who and how?
>>
>
> The old Squeak desease was that nothing ever was done, because at some
> point
> it was found that "we could do better". This resulted in *complete*
> paralysis.
>
> For Pharo, the idea is to do something if it´s better. Just imagine
> what you can
> do in 10 years if you do a lot of little things a little bit better.
> Instead of
> doing nothing and waiting for perfection.
>
I understand your point but part of Squeak's problem is its actual
state.
Many things are really messy and crappy.
While the proposed solution might be better for the actual problem (a
special unit test for the Mac),
I really fear a new source for code rot. When this isXXX will be
established it will be used in other situations

Yes. I am agree. The thing is, who will do it?  Ho has the time to understand every place and change it ?
 

sooner or later. And I can't see that
       OSPlatform current isMacOSX
is really that much better than
       SmalltalkImage current platformName = 'Mac OS'


Yes it is. I it is not MUCH better, but a bit better and easy to implement. Tomorrow the platform name changes and you have to change your code all over the image. At least, with this, you have the hardcoded in a single place. After this, with a single "senders" you can see where it is used and how to modify this for a more OO stuff.

I beg to disagree. First, you could also search for senders of "platformName". Second, what to do when you need to add a new platform?
At the moment there is "isUnix". But there might be differences between Linux, Solaris, RiscOS, FreeBSD, ...
You don't want a single search and multiple change but a single search AND change.
In my opinion the proposed code is only a minor improvement.

Andreas


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Douglas Brebner
Andreas Wacknitz wrote:

>
> Am 29.07.2009 um 21:13 schrieb Mariano Martinez Peck:
>
>>
>>
>> On Wed, Jul 29, 2009 at 6:06 PM, Andreas Wacknitz <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>>
>>     Am 29.07.2009 um 20:08 schrieb Marcus Denker:
>>
>>
>>
>>     sooner or later. And I can't see that
>>            OSPlatform current isMacOSX
>>     is really that much better than
>>            SmalltalkImage current platformName = 'Mac OS'
>>
>>
>>
>> Yes it is. I it is not MUCH better, but a bit better and easy to
>> implement. Tomorrow the platform name changes and you have to change
>> your code all over the image. At least, with this, you have the
>> hardcoded in a single place. After this, with a single "senders" you
>> can see where it is used and how to modify this for a more OO stuff.
>
> I beg to disagree. First, you could also search for senders of
> "platformName". Second, what to do when you need to add a new platform?
> At the moment there is "isUnix". But there might be differences
> between Linux, Solaris, RiscOS, FreeBSD, ...
There can be considerable differences. e.g. the gnu tools used by Linux
have different command line options from the BSD tools which could
impact things like OSProcess.
> You don't want a single search and multiple change but a single search
> AND change.
> In my opinion the proposed code is only a minor improvement.
>
>
Maybe one possible solution would be to select on features, e.g.
something like PlatformFeatures>>#menuSupport? I believe Common Lisp
does something like that with their *features* variable.


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Igor Stasenko
2009/7/30 Douglas Brebner <[hidden email]>:

> Andreas Wacknitz wrote:
>>
>> Am 29.07.2009 um 21:13 schrieb Mariano Martinez Peck:
>>
>>>
>>>
>>> On Wed, Jul 29, 2009 at 6:06 PM, Andreas Wacknitz <[hidden email]
>>> <mailto:[hidden email]>> wrote:
>>>
>>>
>>>     Am 29.07.2009 um 20:08 schrieb Marcus Denker:
>>>
>>>
>>>
>>>     sooner or later. And I can't see that
>>>            OSPlatform current isMacOSX
>>>     is really that much better than
>>>            SmalltalkImage current platformName = 'Mac OS'
>>>
>>>
>>>
>>> Yes it is. I it is not MUCH better, but a bit better and easy to
>>> implement. Tomorrow the platform name changes and you have to change
>>> your code all over the image. At least, with this, you have the
>>> hardcoded in a single place. After this, with a single "senders" you
>>> can see where it is used and how to modify this for a more OO stuff.
>>
>> I beg to disagree. First, you could also search for senders of
>> "platformName". Second, what to do when you need to add a new platform?
>> At the moment there is "isUnix". But there might be differences
>> between Linux, Solaris, RiscOS, FreeBSD, ...
> There can be considerable differences. e.g. the gnu tools used by Linux
> have different command line options from the BSD tools which could
> impact things like OSProcess.
>> You don't want a single search and multiple change but a single search
>> AND change.
>> In my opinion the proposed code is only a minor improvement.
>>
>>
> Maybe one possible solution would be to select on features, e.g.
> something like PlatformFeatures>>#menuSupport? I believe Common Lisp
> does something like that with their *features* variable.
>
right, this is what i'm actually proposing.. use it in a way like:

menuBuilder := OSProcess platformMenuBuilder.

menuBuilder ifNotNil: [
   menuBuilder addMenu: #('File Edit Help Other Boring Stuff')...
]


>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Igor Stasenko
2009/7/30 Igor Stasenko <[hidden email]>:
[snip ]
> right, this is what i'm actually proposing.. use it in a way like:
>
> menuBuilder := OSProcess platformMenuBuilder.
>
> menuBuilder ifNotNil: [
>   menuBuilder addMenu: #('File Edit Help Other Boring Stuff')...
> ]
>
err.. OSPlatform, not OSProcess :)



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

David T. Lewis
On Thu, Jul 30, 2009 at 04:40:35AM +0300, Igor Stasenko wrote:

> 2009/7/30 Igor Stasenko <[hidden email]>:
> [snip ]
> > right, this is what i'm actually proposing.. use it in a way like:
> >
> > menuBuilder := OSProcess platformMenuBuilder.
> >
> > menuBuilder ifNotNil: [
> > ?? menuBuilder addMenu: #('File Edit Help Other Boring Stuff')...
> > ]
> >
> err.. OSPlatform, not OSProcess :)

;-)

FWIW, the implementation that I used for OSProcess is:

        OSProcess class>>isWindows
        OSProcess class>>isUnix
        OSProcess class>>isUnixMac
        OSProcess class>>isNonUnixMac
        OSProcess class>>isRiscOS (1)
        OSProcess class>>isOS2 (2)

And yes, Squeak does run on platforms other than unix and win32. Hopefully
it is not too much of a stretch to envision #isSqueakNOS, #isPlan9, #isVMS,
#isChrome, and #isTripos (3). And Tripos was the host for BCPL (4) which was a
host for early Smalltalk, which begat Squeak, which inspired Pharo, which
leads us to this discussion, so give some love to Tripos and also to Martin
Richards (5) who continues to advance the development of several of these
seminal technologies.

Dave

(1) http://en.wikipedia.org/wiki/Riscos
    http:/rowledge.org/tim/squeak/RISCOSSqueak.html
(2) http://en.wikipedia.org/wiki/OS2
    http://www.jvuletich.org/Squeak/SqueakForOS2/SqueakForOS2Eng.html
(3) http://en.wikipedia.org/wiki/TRIPOS
    http://www.cl.cam.ac.uk/~mr10/Cintpos.html
(4) http://en.wikipedia.org/wiki/BCPL
    http://www.cl.cam.ac.uk/~mr10/BCPL.html
(5) http://www.cl.cam.ac.uk/~mr10


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Douglas Brebner
David T. Lewis wrote:

> FWIW, the implementation that I used for OSProcess is:
>
> OSProcess class>>isWindows
> OSProcess class>>isUnix
> OSProcess class>>isUnixMac
> OSProcess class>>isNonUnixMac
> OSProcess class>>isRiscOS (1)
> OSProcess class>>isOS2 (2)
>
> And yes, Squeak does run on platforms other than unix and win32. Hopefully
> it is not too much of a stretch to envision #isSqueakNOS, #isPlan9, #isVMS,
> #isChrome, and #isTripos (3). And Tripos was the host for BCPL (4) which was a
> host for early Smalltalk, which begat Squeak, which inspired Pharo, which
> leads us to this discussion, so give some love to Tripos and also to Martin
> Richards (5) who continues to advance the development of several of these
> seminal technologies.
>
>  
I believe there's a port to Syllable too, and I expect to see one to
AROS or another AmigaOS version :)


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Damien Cassou
In reply to this post by Igor Stasenko
On Wed, Jul 29, 2009 at 8:30 PM, Igor Stasenko<[hidden email]> wrote:
> Or, someone please tell me, why everyone tend to mis-use the singleton
> pattern in a form:
> 'Foo current' , whereas the Foo is already a singleton???

Because you can transform 'Foo current' in a non-singleton if you want
to later. This is not the case of Foo.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

David T. Lewis
In reply to this post by Douglas Brebner
On Thu, Jul 30, 2009 at 05:51:02AM +0100, Douglas Brebner wrote:

> David T. Lewis wrote:
> > FWIW, the implementation that I used for OSProcess is:
> >
> > OSProcess class>>isWindows
> > OSProcess class>>isUnix
> > OSProcess class>>isUnixMac
> > OSProcess class>>isNonUnixMac
> > OSProcess class>>isRiscOS (1)
> > OSProcess class>>isOS2 (2)
> >
> > And yes, Squeak does run on platforms other than unix and win32. Hopefully
> > it is not too much of a stretch to envision #isSqueakNOS, #isPlan9, #isVMS,
> > #isChrome, and #isTripos (3). And Tripos was the host for BCPL (4) which was a
> > host for early Smalltalk, which begat Squeak, which inspired Pharo, which
> > leads us to this discussion, so give some love to Tripos and also to Martin
> > Richards (5) who continues to advance the development of several of these
> > seminal technologies.
> >  
> I believe there's a port to Syllable too, and I expect to see one to
> AROS or another AmigaOS version :)

[veering hopelessly off topic, sorry]
The original AmigoOS was Tripos: http://www.amigahistory.co.uk/tripos.html



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Douglas Brebner
David T. Lewis wrote:

> On Thu, Jul 30, 2009 at 05:51:02AM +0100, Douglas Brebner wrote:
>  
>> David T. Lewis wrote:
>>    
>>> FWIW, the implementation that I used for OSProcess is:
>>>
>>> OSProcess class>>isWindows
>>> OSProcess class>>isUnix
>>> OSProcess class>>isUnixMac
>>> OSProcess class>>isNonUnixMac
>>> OSProcess class>>isRiscOS (1)
>>> OSProcess class>>isOS2 (2)
>>>
>>> And yes, Squeak does run on platforms other than unix and win32. Hopefully
>>> it is not too much of a stretch to envision #isSqueakNOS, #isPlan9, #isVMS,
>>> #isChrome, and #isTripos (3). And Tripos was the host for BCPL (4) which was a
>>> host for early Smalltalk, which begat Squeak, which inspired Pharo, which
>>> leads us to this discussion, so give some love to Tripos and also to Martin
>>> Richards (5) who continues to advance the development of several of these
>>> seminal technologies.
>>>  
>>>      
>> I believe there's a port to Syllable too, and I expect to see one to
>> AROS or another AmigaOS version :)
>>    
>
> [veering hopelessly off topic, sorry]
> The original AmigoOS was Tripos: http://www.amigahistory.co.uk/tripos.html
>  

The original Amiga*D*OS was Tripos, AmigaOS was more than that (as that
page mentions, Intuition already existed). Though I agree, this is very
offtopic  :)

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: SmalltalkImage current platformName [WAS] Re: Baseline test results on pharo core 10392

Igor Stasenko
In reply to this post by Damien Cassou
2009/7/30 Damien Cassou <[hidden email]>:
> On Wed, Jul 29, 2009 at 8:30 PM, Igor Stasenko<[hidden email]> wrote:
>> Or, someone please tell me, why everyone tend to mis-use the singleton
>> pattern in a form:
>> 'Foo current' , whereas the Foo is already a singleton???
>
> Because you can transform 'Foo current' in a non-singleton if you want
> to later. This is not the case of Foo.
>

But this will never be the case for things like OSPlatform, isnt?
So, why lenghtening the path to get to interesting feature/protocol,
by introducing #current ?

> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> "Lambdas are relegated to relative obscurity until Java makes them
> popular by not having them." James Iry
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
12