Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
April 2018
- 643 messages
Re: [Pharo-dev] Images, VMs and 32 vs 64bit
by Nicolas Cellier
The general principle is that the VM insulate almost every OS specific
feature: the image sees the same virtual machine.
So you can save a 32bits image on an OS, and restart it on another.
The images effectively share the same code base whatever the OS.
There might be a plugin or two which are not present on all platforms
though.
If FFI is used then a few more differences will generally creep in image
side
That means that some OS dependent subclasses will care of implementation
details at image side.
An image carries the implementation for all platforms, but only one is
active at a time.
See senders of os osVersion osName platformName
For Squeak, the image code base is the same for 32 and 64bits and I presume
it's also the case for Pharo.
But you cannot save on 32 bits and restart on 64bits et vice et versa.
There are again very few implementation details that are present at image
side.
For example SmallInteger maxVal changes, there are also instances of
SmallFloat64 on a 64bits image, but this should be mostly transparent.
See wordSize and senders for discovering a few parts of the image sensitive
to the word size... (on Squeak, FFI/Alien, image segments, ...).
Concerning the underlying OS, , so it's again the same code base, you can
save an image on an OS and restart it on another.
For the VM, as Guile said, there are more changes, because there you will
find a lot more implementation details.
Since the VM is implemented in (mostly) in Smalltalk, if you load VMMaker
then you will see abstract superclass, and 32/64 bits specializations for
some part of the VM.
2018-04-11 8:51 GMT+02:00 Guillermo Polito <guillermopolito(a)gmail.com>:
> VMs share most of the code. At least the basic interpreter, primitives and
> garbage collector.
> But there are some platform specificities such as how some plugins are
> managed.
> Also there are different JIT backends, one per platform.
> I don't know if a VM comes shipped with all of them or just the one needed.
>
> For more details, better ask the vm-dev mailing list.
>
> On Wed, Apr 11, 2018 at 12:39 AM, Benoit St-Jean via Pharo-dev <
> pharo-dev(a)lists.pharo.org> wrote:
>
>>
>>
>> ---------- Forwarded message ----------
>> From: Benoit St-Jean <bstjean(a)yahoo.com>
>> To: Pharo Development List <pharo-dev(a)lists.pharo.org>, "Peter Uhnák" <
>> i.uhnak(a)gmail.com>
>> Cc:
>> Bcc:
>> Date: Tue, 10 Apr 2018 22:39:16 +0000 (UTC)
>> Subject: Re: [Pharo-dev] Images, VMs and 32 vs 64bit
>> Thanks!
>>
>> I don't really care about the image format, my question was more oriented
>> towards the code itself. As I don't have a Mac, I was curious as to
>> whether there would be code differences between platforms, VMs and 32 vs
>> 64bit distributions, code-wise!
>>
>>
>> -----------------
>> Benoît St-Jean
>> Yahoo! Messenger: bstjean
>> Twitter: @BenLeChialeux
>> Pinterest: benoitstjean
>> Instagram: Chef_Benito
>> IRC: lamneth
>> Blogue: endormitoire.wordpress.com
>> "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
>>
>>
>> On Tuesday, April 10, 2018, 6:29:33 p.m. EDT, Peter Uhnák <
>> i.uhnak(a)gmail.com> wrote:
>>
>>
>> > images for different platforms (Mac, Linux, Windows)
>>
>> yes
>> It is the responsibility of the VM to contain the differences. Note that
>> there's some "platform-specific" code, but the image contains the code for
>> all platforms at once.
>> Generally speaking you can code on one platform, copy the image files to
>> another and continue your work (although doing this can cause trouble, as
>> e.g. some file paths may now point to non-existing locations).
>> You can download the images independently of the platform too (e.g. Pharo
>> 6 images: http://files.pharo.org/image/60/ )
>>
>> > VMs (32bit, 64bit)
>>
>> yes?
>> the files are different, but I don't know if there's code difference, or
>> if the images are just built with different memory layouts
>>
>> Peter
>>
>> On Wed, Apr 11, 2018 at 12:13 AM, Benoit St-Jean via Pharo-dev <
>> pharo-dev(a)lists.pharo.org> wrote:
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Benoit St-Jean <bstjean(a)yahoo.com>
>> To: Pharo Development List <pharo-dev(a)lists.pharo.org>
>> Cc:
>> Bcc:
>> Date: Tue, 10 Apr 2018 22:13:18 +0000 (UTC)
>> Subject: Images, VMs and 32 vs 64bit
>> I was wondering if images for different platforms (Mac, Linux, Windows)
>> and VMs (32bit, 64bit) are, code-wise, the same? By "the same", I mean do
>> they all have the exact same code base or some classes/methods are in some
>> and not in others or different?
>>
>> -----------------
>> Benoît St-Jean
>> Yahoo! Messenger: bstjean
>> Twitter: @BenLeChialeux
>> Pinterest: benoitstjean
>> Instagram: Chef_Benito
>> IRC: lamneth
>> Blogue: endormitoire.wordpress.com
>> "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
>>
>>
>>
>>
>
>
> --
>
>
>
> Guille Polito
>
> Research Engineer
>
> Centre de Recherche en Informatique, Signal et Automatique de Lille
>
> CRIStAL - UMR 9189
>
> French National Center for Scientific Research - *http://www.cnrs.fr
> <http://www.cnrs.fr>*
>
>
> *Web:* *http://guillep.github.io* <http://guillep.github.io>
>
> *Phone: *+33 06 52 70 66 13
>
April 11, 2018
Re: [Pharo-dev] Images, VMs and 32 vs 64bit
by phil@highoctane.be
But once you are using an image on a given platform it may not work on
another one just like that (e.g. FreeType will give trouble).
Phil
On Wed, Apr 11, 2018, 08:52 Guillermo Polito <guillermopolito(a)gmail.com>
wrote:
> VMs share most of the code. At least the basic interpreter, primitives and
> garbage collector.
> But there are some platform specificities such as how some plugins are
> managed.
> Also there are different JIT backends, one per platform.
> I don't know if a VM comes shipped with all of them or just the one needed.
>
> For more details, better ask the vm-dev mailing list.
>
> On Wed, Apr 11, 2018 at 12:39 AM, Benoit St-Jean via Pharo-dev <
> pharo-dev(a)lists.pharo.org> wrote:
>
>>
>>
>> ---------- Forwarded message ----------
>> From: Benoit St-Jean <bstjean(a)yahoo.com>
>> To: Pharo Development List <pharo-dev(a)lists.pharo.org>, "Peter Uhnák" <
>> i.uhnak(a)gmail.com>
>> Cc:
>> Bcc:
>> Date: Tue, 10 Apr 2018 22:39:16 +0000 (UTC)
>> Subject: Re: [Pharo-dev] Images, VMs and 32 vs 64bit
>> Thanks!
>>
>> I don't really care about the image format, my question was more oriented
>> towards the code itself. As I don't have a Mac, I was curious as to
>> whether there would be code differences between platforms, VMs and 32 vs
>> 64bit distributions, code-wise!
>>
>>
>> -----------------
>> Benoît St-Jean
>> Yahoo! Messenger: bstjean
>> Twitter: @BenLeChialeux
>> Pinterest: benoitstjean
>> Instagram: Chef_Benito
>> IRC: lamneth
>> Blogue: endormitoire.wordpress.com
>> "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
>>
>>
>> On Tuesday, April 10, 2018, 6:29:33 p.m. EDT, Peter Uhnák <
>> i.uhnak(a)gmail.com> wrote:
>>
>>
>> > images for different platforms (Mac, Linux, Windows)
>>
>> yes
>> It is the responsibility of the VM to contain the differences. Note that
>> there's some "platform-specific" code, but the image contains the code for
>> all platforms at once.
>> Generally speaking you can code on one platform, copy the image files to
>> another and continue your work (although doing this can cause trouble, as
>> e.g. some file paths may now point to non-existing locations).
>> You can download the images independently of the platform too (e.g. Pharo
>> 6 images: http://files.pharo.org/image/60/ )
>>
>> > VMs (32bit, 64bit)
>>
>> yes?
>> the files are different, but I don't know if there's code difference, or
>> if the images are just built with different memory layouts
>>
>> Peter
>>
>> On Wed, Apr 11, 2018 at 12:13 AM, Benoit St-Jean via Pharo-dev <
>> pharo-dev(a)lists.pharo.org> wrote:
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Benoit St-Jean <bstjean(a)yahoo.com>
>> To: Pharo Development List <pharo-dev(a)lists.pharo.org>
>> Cc:
>> Bcc:
>> Date: Tue, 10 Apr 2018 22:13:18 +0000 (UTC)
>> Subject: Images, VMs and 32 vs 64bit
>> I was wondering if images for different platforms (Mac, Linux, Windows)
>> and VMs (32bit, 64bit) are, code-wise, the same? By "the same", I mean do
>> they all have the exact same code base or some classes/methods are in some
>> and not in others or different?
>>
>> -----------------
>> Benoît St-Jean
>> Yahoo! Messenger: bstjean
>> Twitter: @BenLeChialeux
>> Pinterest: benoitstjean
>> Instagram: Chef_Benito
>> IRC: lamneth
>> Blogue: endormitoire.wordpress.com
>> "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
>>
>>
>>
>>
>
>
> --
>
>
>
> Guille Polito
>
> Research Engineer
>
> Centre de Recherche en Informatique, Signal et Automatique de Lille
>
> CRIStAL - UMR 9189
>
> French National Center for Scientific Research - *http://www.cnrs.fr
> <http://www.cnrs.fr>*
>
>
> *Web:* *http://guillep.github.io* <http://guillep.github.io>
>
> *Phone: *+33 06 52 70 66 13
>
April 11, 2018
Re: [Pharo-dev] Images, VMs and 32 vs 64bit
by Guillermo Polito
VMs share most of the code. At least the basic interpreter, primitives and
garbage collector.
But there are some platform specificities such as how some plugins are
managed.
Also there are different JIT backends, one per platform.
I don't know if a VM comes shipped with all of them or just the one needed.
For more details, better ask the vm-dev mailing list.
On Wed, Apr 11, 2018 at 12:39 AM, Benoit St-Jean via Pharo-dev <
pharo-dev(a)lists.pharo.org> wrote:
>
>
> ---------- Forwarded message ----------
> From: Benoit St-Jean <bstjean(a)yahoo.com>
> To: Pharo Development List <pharo-dev(a)lists.pharo.org>, "Peter Uhnák" <
> i.uhnak(a)gmail.com>
> Cc:
> Bcc:
> Date: Tue, 10 Apr 2018 22:39:16 +0000 (UTC)
> Subject: Re: [Pharo-dev] Images, VMs and 32 vs 64bit
> Thanks!
>
> I don't really care about the image format, my question was more oriented
> towards the code itself. As I don't have a Mac, I was curious as to
> whether there would be code differences between platforms, VMs and 32 vs
> 64bit distributions, code-wise!
>
>
> -----------------
> Benoît St-Jean
> Yahoo! Messenger: bstjean
> Twitter: @BenLeChialeux
> Pinterest: benoitstjean
> Instagram: Chef_Benito
> IRC: lamneth
> Blogue: endormitoire.wordpress.com
> "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
>
>
> On Tuesday, April 10, 2018, 6:29:33 p.m. EDT, Peter Uhnák <
> i.uhnak(a)gmail.com> wrote:
>
>
> > images for different platforms (Mac, Linux, Windows)
>
> yes
> It is the responsibility of the VM to contain the differences. Note that
> there's some "platform-specific" code, but the image contains the code for
> all platforms at once.
> Generally speaking you can code on one platform, copy the image files to
> another and continue your work (although doing this can cause trouble, as
> e.g. some file paths may now point to non-existing locations).
> You can download the images independently of the platform too (e.g. Pharo
> 6 images: http://files.pharo.org/image/60/ )
>
> > VMs (32bit, 64bit)
>
> yes?
> the files are different, but I don't know if there's code difference, or
> if the images are just built with different memory layouts
>
> Peter
>
> On Wed, Apr 11, 2018 at 12:13 AM, Benoit St-Jean via Pharo-dev <
> pharo-dev(a)lists.pharo.org> wrote:
>
>
>
> ---------- Forwarded message ----------
> From: Benoit St-Jean <bstjean(a)yahoo.com>
> To: Pharo Development List <pharo-dev(a)lists.pharo.org>
> Cc:
> Bcc:
> Date: Tue, 10 Apr 2018 22:13:18 +0000 (UTC)
> Subject: Images, VMs and 32 vs 64bit
> I was wondering if images for different platforms (Mac, Linux, Windows)
> and VMs (32bit, 64bit) are, code-wise, the same? By "the same", I mean do
> they all have the exact same code base or some classes/methods are in some
> and not in others or different?
>
> -----------------
> Benoît St-Jean
> Yahoo! Messenger: bstjean
> Twitter: @BenLeChialeux
> Pinterest: benoitstjean
> Instagram: Chef_Benito
> IRC: lamneth
> Blogue: endormitoire.wordpress.com
> "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
>
>
>
>
--
Guille Polito
Research Engineer
Centre de Recherche en Informatique, Signal et Automatique de Lille
CRIStAL - UMR 9189
French National Center for Scientific Research - *http://www.cnrs.fr
<http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13
April 11, 2018
Re: [Pharo-dev] Changed #atEnd primitive - #atEnd vs #next returning nil
by Alistair Grant
Hi Sven,
On 10 April 2018 at 23:54, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
> Alistair,
>
> I am replying in-between, please don't take my remarks as being negative, I just like to straighten things out as clear as possible.
No problem.
>> On 10 Apr 2018, at 22:14, Alistair Grant <akgrant0710(a)gmail.com> wrote:
>>
>> Hi Sven,
>>
>> On 10 April 2018 at 19:36, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>>> I have trouble understanding your problem analysis, and how your proposed solution, would solve it.
>>
>> The discussion started with my proposal to modify the Zinc streams to
>> check the return value of #next for nil rather than using #atEnd to
>> iterate over the underlying stream. You correctly pointed out that
>> the intention behind #atEnd is that it can be used to control
>> iterating over streams.
>
> OK
>
>>> Where is it being said that #next and/or #atEnd should be blocking or non-blocking ?
>>
>> There is existing code that assumes that #atEnd is non-blocking and
>> that #next is allowed block. I believe that we should keep those
>> conditions.
>
> I fail to see where that is written down, either way. Can you point me to comments stating that, I would really like to know ?
I'm not aware of it being written down, just that ever existing
implementation I'm aware of behaves this way.
On the other hand, making #atEnd blocking breaks Eliot's REPL sample
(in Squeak).
>>> How is this related to how EOF is signalled ?
>>
>> Because, combined with terminal EOF not being known until the user
>> explicitly flags it (with Ctrl-D) it means that #atEnd can't be used
>> for iterating over input from stdin connected to a terminal.
>
> This seems to me like an exception that only holds for one particular stream in one particular scenario (interactive stdin). I might be wrong.
>
>>> It seems to me that there are quite a few classes of streams that are 'special' in the sense that #next could be blocking and/or #atEnd could be unclear - socket/network streams, serial streams, maybe stdio (interactive or not). Without a message like #isDataAvailable you cannot handle those without blocking.
>>
>> Right. I think this is a distraction (I was trying to explain some
>> details, but it's causing more confusion instead of helping).
>>
>> The important point is that #atEnd doesn't work for iterating over
>> streams with terminal input
>
> Maybe you should also point to the actual code that fails. I mean you showed a partial stack trace, but not how you got there, precisely. How does the application reading from an interactive stdin do to get into trouble ?
Included below.
>>> Reading from stdin seems like a very rare case for a Smalltalk system (not that it should not be possible).
>>
>> There's been quite a bit of discussion and several projects recently
>> related to using pharo for scripting, so it may become more common.
>> E.g.
>>
>> https://www.quora.com/Can-Smalltalk-be-a-batch-file-scripting-language/answ…
>> https://github.com/rajula96reddy/pharo-cli
>
> Still, it is not common at all.
>
>>> I have a feeling that too much functionality is being pushed into too small an API.
>>
>> This is just about how should Zinc streams be iterating over the
>> underlying streams. You didn't like checking the result of #next for
>> nil since it isn't general, correctly pointing out that nil is a valid
>> value for non-byte oriented streams. But #atEnd doesn't work for
>> stdin from a terminal.
>>
>>
>> At this point I think there are three options:
>>
>> 1. Modify Zinc to check the return value of #next instead of using #atEnd.
>>
>> This is what all existing character / byte oriented streams in Squeak
>> and Pharo do. At that point the Zinc streams can be used on all file
>> / stdio input and output.
>
> I agree that such code exists in many places, but there is lots of stream reading that does not check for nils.
Right. Streams can be categorised in many ways, but for this
discussion I think streams are broken in to two types:
1) Byte / Character oriented
2) All others
For historical reasons, byte / character oriented streams need to
check for EOF by using "stream next == nil" and all other streams
should use #atEnd.
This avoids the "nil being part of the domain" issue that was
discussed earlier in the thread.
>> 2. Modify all streams to signal EOF in some other way, i.e. a sentinel
>> or notification / exception.
>>
>> This is what we were discussing below. But it is a decent chunk of
>> work with significant impact on the existing code base.
>
> Agreed. This would be a future extension.
>
>> 3. Require anyone who wants to read from stdin to code around Zinc's
>> inability to handle terminal input.
>>
>> I'd prefer to avoid this option if possible.
>
> See higher for a more concrete usage example request.
testAtEnd.st
--
| ch stream string stdin |
'stdio.cs' asFileReference fileIn.
"stdin := FileStream stdin."
stdin := ZnCharacterReadStream on:
(ZnBufferedReadStream on:
Stdio stdin).
stream := (String new: 100) writeStream.
ch := stdin next.
[ ch == nil ] whileFalse: [
stream nextPut: ch.
ch := stdin next. ].
string := stream contents.
FileStream stdout
nextPutAll: string; lf;
nextPutAll: 'Characters read: ';
nextPutAll: string size asString;
lf.
Smalltalk snapshot: false andQuit: true.
--
Execute with:
./pharo --headless Pharo7.0-64bit-e76f1a2.image testAtEnd.st
and type Ctrl-D gives:
'Errors in script loaded from testAtEnd.st'
MessageNotUnderstood: receiver of "<" is nil
UndefinedObject(Object)>>doesNotUnderstand: #<
ZnUTF8Encoder>>nextCodePointFromStream:
ZnUTF8Encoder(ZnCharacterEncoder)>>nextFromStream:
ZnCharacterReadStream>>nextElement
ZnCharacterReadStream(ZnEncodedReadStream)>>next
UndefinedObject>>DoIt
OpalCompiler>>evaluate
Using #atEnd to control the loop instead of "stdin next == nil"
produces the same result.
Replacing stdin with FileStream stdin makes the script work.
stdio.cs fixes a bug in StdioStream which really isn't part of this
discussion (PR to be submitted).
Cheers,
Alistair
>> Does that clarify the situation?
>
> Yes, it helps. Thanks. But questions remain.
>
>> Thanks,
>> Alistair
>>
>>
>>
>>>> On 10 Apr 2018, at 18:30, Alistair Grant <akgrant0710(a)gmail.com> wrote:
>>>>
>>>> First a quick update:
>>>>
>>>> After doing some work on primitiveFileAtEnd, #atEnd now answers
>>>> correctly for files that don't report their size correctly, e.g.
>>>> /dev/urandom and /proc/cpuinfo, whether the files are opened directly or
>>>> redirected through stdin.
>>>>
>>>> However determining whether stdin from a terminal has reached the end of
>>>> file can't be done without making #atEnd blocking since we have to wait
>>>> for the user to flag the end of file, e.g. by typing Ctrl-D. And #atEnd
>>>> is assumed to be non-blocking.
>>>>
>>>> So currently using ZnCharacterReadStream with stdin from a terminal will
>>>> result in a stack dump similar to:
>>>>
>>>> MessageNotUnderstood: receiver of "<" is nil
>>>> UndefinedObject(Object)>>doesNotUnderstand: #<
>>>> ZnUTF8Encoder>>nextCodePointFromStream:
>>>> ZnUTF8Encoder(ZnCharacterEncoder)>>nextFromStream:
>>>> ZnCharacterReadStream>>nextElement
>>>> ZnCharacterReadStream(ZnEncodedReadStream)>>next
>>>> UndefinedObject>>DoIt
>>>>
>>>>
>>>> Going back through the various suggestions that have been made regarding
>>>> using a sentinel object vs. raising a notification / exception, my
>>>> (still to be polished) suggestion is to:
>>>>
>>>> 1. Add an endOfStream instance variable
>>>> 2. When the end of the stream is reached answer the value of the
>>>> instance variable (i.e. the result of sending #value to the variable).
>>>> 3. The initial default value would be a block that raises a Deprecation
>>>> warning and then returns nil. This would allow existing code to
>>>> function for a changeover period.
>>>> 4. At the end of the deprecation period the default value would be
>>>> changed to a unique sentinel object which would answer itself as its
>>>> #value.
>>>>
>>>> At any time users of the stream can set their own sentinel, including a
>>>> block that raises an exception.
>>>>
>>>>
>>>> Cheers,
>>>> Alistair
>>>>
>>>>
>>>> On 4 April 2018 at 19:24, Stephane Ducasse <stepharo.self(a)gmail.com> wrote:
>>>>> Thanks for this discussion.
>>>>>
>>>>> On Wed, Apr 4, 2018 at 1:37 PM, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>>>>>> Alistair,
>>>>>>
>>>>>> First off, thanks for the discussions and your contributions, I really appreciate them.
>>>>>>
>>>>>> But I want to have a discussion at the high level of the definition and semantics of the stream API in Pharo.
>>>>>>
>>>>>>> On 4 Apr 2018, at 13:20, Alistair Grant <akgrant0710(a)gmail.com> wrote:
>>>>>>>
>>>>>>> On 4 April 2018 at 12:56, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>>>>>>>> Playing a bit devil's advocate, the idea is that, in general,
>>>>>>>>
>>>>>>>> [ stream atEnd] whileFalse: [ stream next. "..." ].
>>>>>>>>
>>>>>>>> is no longer allowed ?
>>>>>>>
>>>>>>> It hasn't been allowed "forever" [1]. It's just been misused for
>>>>>>> almost as long.
>>>>>>>
>>>>>>> [1] Time began when stdio stream support was introduced. :-)
>>>>>>
>>>>>> I am still not convinced. Another way to put it would be that the old #atEnd or #upToEnd do not make sense for these streams and some new loop is needed, based on a new test (it exists for socket streams already).
>>>>>>
>>>>>> [ stream isDataAvailable ] whileTrue: [ stream next ]
>>>>>>
>>>>>>>> And you want to replace it with
>>>>>>>>
>>>>>>>> [ stream next ifNil: [ false ] ifNotNil: [ :x | "..." true ] whileTrue.
>>>>>>>>
>>>>>>>> That is a pretty big change, no ?
>>>>>>>
>>>>>>> That's the way quite a bit of code already operates.
>>>>>>>
>>>>>>> As Denis pointed out, it's obviously problematic in the general sense,
>>>>>>> since nil can be embedded in non-byte oriented streams. I suspect
>>>>>>> that in practice not many people write code that reads streams from
>>>>>>> both byte oriented and non-byte oriented streams.
>>>>>>
>>>>>> Maybe yes, maybe no. As Denis' example shows there is a clear definition problem.
>>>>>>
>>>>>> And I do use streams of byte arrays or strings all the time, this is really important. I want my parsers to work on all kinds of streams.
>>>>>>
>>>>>>>> I think/feel like a proper EOF exception would be better, more correct.
>>>>>>>>
>>>>>>>> [ [ stream next. "..." true ] on: EOF do: [ false ] ] whileTrue.
>>>>>>>
>>>>>>> I agree, but the email thread Nicolas pointed to raises some
>>>>>>> performance questions about this approach. It should be
>>>>>>> straightforward to do a basic performance comparison which I'll get
>>>>>>> around to if other objections aren't raised.
>>>>>>
>>>>>> Reading in bigger blocks, using #readInto:startingAt:count: (which is basically Unix's (2) Read sys call), would solve performance problems, I think.
>>>>>>
>>>>>>>> Will we throw away #atEnd then ? Do we need it if we cannot use it ?
>>>>>>>
>>>>>>> Unix file i/o returns EOF if the end of file has been reach OR if an
>>>>>>> error occurs. You should still check #atEnd after reading past the
>>>>>>> end of the file to make sure no error occurred. Another part of the
>>>>>>> primitive change I'm proposing is to return additional information
>>>>>>> about what went wrong in the event of an error.
>>>>>>
>>>>>> I am sorry, but this kind of semantics (the OR) is way too complex at the general image level, it is too specific and based on certain underlying implementation details.
>>>>>>
>>>>>> Sven
>>>>>>
>>>>>>> We could modify the read primitive so that it fails if an error has
>>>>>>> occurred, and then #atEnd wouldn't be required.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Alistair
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>> On 4 Apr 2018, at 12:41, Alistair Grant <akgrant0710(a)gmail.com> wrote:
>>>>>>>>>
>>>>>>>>> Hi Nicolas,
>>>>>>>>>
>>>>>>>>> On 4 April 2018 at 12:36, Nicolas Cellier
>>>>>>>>> <nicolas.cellier.aka.nice(a)gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2018-04-04 12:18 GMT+02:00 Alistair Grant <akgrant0710(a)gmail.com>:
>>>>>>>>>>>
>>>>>>>>>>> Hi Sven,
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Apr 04, 2018 at 11:32:02AM +0200, Sven Van Caekenberghe wrote:
>>>>>>>>>>>> Somehow, somewhere there was a change to the implementation of the
>>>>>>>>>>>> primitive called by some streams' #atEnd.
>>>>>>>>>>>
>>>>>>>>>>> That's a proposed change by me, but it hasn't been integrated yet. So
>>>>>>>>>>> the discussion below should apply to the current stable vm (from August
>>>>>>>>>>> last year).
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> IIRC, someone said it is implemented as 'remaining size being zero'
>>>>>>>>>>>> and some virtual unix files like /dev/random are zero sized.
>>>>>>>>>>>
>>>>>>>>>>> Currently, for files other than sdio (stdout, stderr, stdin) it is
>>>>>>>>>>> effectively defined as:
>>>>>>>>>>>
>>>>>>>>>>> atEnd := stream position >= stream size
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> And, as you say, plenty of virtual unix files report size 0.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> Now, all kinds of changes are being done image size to work around this.
>>>>>>>>>>>
>>>>>>>>>>> I would phrase this slightly differently :-)
>>>>>>>>>>>
>>>>>>>>>>> Some code does the right thing, while other code doesn't. E.g.:
>>>>>>>>>>>
>>>>>>>>>>> MultiByteFileStream>>upToEnd is good, while
>>>>>>>>>>> FileStream>>contents is incorrect
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> I am a strong believer in simple, real (i.e. infinite) streams, but I
>>>>>>>>>>>> am not sure we are doing the right thing here.
>>>>>>>>>>>>
>>>>>>>>>>>> Point is, I am not sure #next returning nil is official and universal.
>>>>>>>>>>>>
>>>>>>>>>>>> Consider the comments:
>>>>>>>>>>>>
>>>>>>>>>>>> Stream>>#next
>>>>>>>>>>>> "Answer the next object accessible by the receiver."
>>>>>>>>>>>>
>>>>>>>>>>>> ReadStream>>#next
>>>>>>>>>>>> "Primitive. Answer the next object in the Stream represented by the
>>>>>>>>>>>> receiver. Fail if the collection of this stream is not an Array or a
>>>>>>>>>>>> String.
>>>>>>>>>>>> Fail if the stream is positioned at its end, or if the position is out
>>>>>>>>>>>> of
>>>>>>>>>>>> bounds in the collection. Optional. See Object documentation
>>>>>>>>>>>> whatIsAPrimitive."
>>>>>>>>>>>>
>>>>>>>>>>>> Note how there is no talk about returning nil !
>>>>>>>>>>>>
>>>>>>>>>>>> I think we should discuss about this first.
>>>>>>>>>>>>
>>>>>>>>>>>> Was the low level change really correct and the right thing to do ?
>>>>>>>>>>>
>>>>>>>>>>> The primitive change proposed doesn't affect this discussion. It will
>>>>>>>>>>> mean that #atEnd returns false (correctly) sometimes, while currently it
>>>>>>>>>>> returns true (incorrectly). The end result is still incorrect, e.g.
>>>>>>>>>>> #contents returns an empty string for /proc/cpuinfo.
>>>>>>>>>>>
>>>>>>>>>>> You're correct about no mention of nil, but we have:
>>>>>>>>>>>
>>>>>>>>>>> FileStream>>next
>>>>>>>>>>>
>>>>>>>>>>> (position >= readLimit and: [self atEnd])
>>>>>>>>>>> ifTrue: [^nil]
>>>>>>>>>>> ifFalse: [^collection at: (position := position + 1)]
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> which has been around for a long time (I suspect, before Pharo existed).
>>>>>>>>>>>
>>>>>>>>>>> Having said that, I think that raising an exception is a better
>>>>>>>>>>> solution, but it is a much, much bigger change than the one I proposed
>>>>>>>>>>> in https://github.com/pharo-project/pharo/pull/1180.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>> Alistair
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>> yes, if you are after universal behavior englobing Unix streams, the
>>>>>>>>>> Exception might be the best way.
>>>>>>>>>> Because on special stream you can't allways say in advance, you have to try.
>>>>>>>>>> That's the solution adopted by authors of Xtreams.
>>>>>>>>>> But there is a runtime penalty associated to it.
>>>>>>>>>>
>>>>>>>>>> The penalty once was so high that my proposal to generalize EndOfStream
>>>>>>>>>> usage was rejected a few years ago by AndreaRaab.
>>>>>>>>>> http://forum.world.st/EndOfStream-unused-td68806.html
>>>>>>>>>
>>>>>>>>> Thanks for this, I'll definitely take a look.
>>>>>>>>>
>>>>>>>>> Do you have a sense of how Denis' suggestion of using an EndOfStream
>>>>>>>>> object would compare?
>>>>>>>>>
>>>>>>>>> It would keep the same coding style, but avoid the problems with nil.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Alistair
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> I have regularly benched Xtreams, but stopped a few years ago.
>>>>>>>>>> Maybe i can excavate and pass on newer VM.
>>>>>>>>>>
>>>>>>>>>> In the mean time, i had experimented a programmable end of stream behavior
>>>>>>>>>> (via a block, or any other valuable)
>>>>>>>>>> http://www.squeaksource.com/XTream.htm
>>>>>>>>>> so as to reconcile performance and universality, but it was a source of
>>>>>>>>>> complexification at implementation side.
>>>>>>>>>>
>>>>>>>>>> Nicolas
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> Note also that a Guille introduced something new, #closed which is
>>>>>>>>>>>> related to the difference between having no more elements (maybe right now,
>>>>>>>>>>>> like an open network stream) and never ever being able to produce more data.
>>>>>>>>>>>>
>>>>>>>>>>>> Sven
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>> <stdio.cs>
>
>
April 11, 2018
Re: [Pharo-dev] Executive Programming
by Ben Coman
I guess one thing important to C-level executives are relationships between
people
so the old reliable Contact Book might work. This could be done in several
levels:
* basic - addresses & birthdays colleagues & family
* intermediate - interface with external services to automatically send
email
* advanced - automatically buy a present from colleague's Amazon wish list
Bonus points if the interface works well from a smart phone.
Along the same of people relationships, maybe they would be interested in a
way to mine Facebook / LinkedIn data,
but their may be sensitive non-technical issues to be careful of here
or trawl news feeds doing sentiment analysis of their company.
cheers -ben
On 7 April 2018 at 23:20, Stephane Ducasse <stepharo.self(a)gmail.com> wrote:
> Ben
>
> what would be interesting to build is a case: what a Boss would like to
> code?
> Because once we have this case we could model it and have a DSL
> (pharo) to script it.
>
> Stef
>
> On Sat, Apr 7, 2018 at 8:36 AM, Ben Coman <btc(a)openinworld.com> wrote:
> > This article about the "Mining Industry's Impending Digital
> Metamorphosis"
> > https://medium.com/@CORE_Innovation/minings-impending-
> metamorphosis-155d66869149
> >
> > is a little off topic, except where it says "All levels, including
> > management and executives will need to have some level coding experience
> and
> > understanding."
> >
> > made me think this must be pervasive across many industries and that an
> > interesting strategy
> > for Pharo would be teaching a course called... "Executive Programming".
> > Pharo could be ideally suited to filling this niche...
> > * Executives don't need to learn the *most* efficient language (i.e. C),
> > * and don't need to learn a system suited to large groups of developers
> > (i.e. Java)
> > * and don't have the time to wait for things to compile (i.e. big tick
> > immediate feedback)
> > They are never going to "do the work" but just need to gain a general
> > understanding of "programming" to better strategise at a higher level and
> > interact with developers.
> > What better language is there for this than Pharo?
> >
> > But guess what happens when the boss is familiar with and likes one
> > particular language... ?
> >
> > /cue maniacal laugh
> >
> > cheers -ben
> >
> > P.S. I'd be interested in collaborating on something that is not an end
> user
> > book, but more of an Instructors manual for such a course.
>
>
April 11, 2018
Re: [Pharo-dev] Executive Programming
by Ben Coman
On 11 April 2018 at 02:55, askoh <askoh(a)askoh.com> wrote:
> Ben:
>
> I have been thinking along the same lines.
> Smalltalk is my PersonalOS.
>
Nice idea, but its a long step beyond what I had in mind.
I don't expect an executive to be using Pharo daily. Their daily time is
better spent elsewhere.
I expect the majority would want to round out their background knowledge
to fill that gap "you don't know what you don't know."
What they want is "maximum impact in minimum time" [whoops "bingo sir" (
http://dilbert.com/strip/1994-02-22)
Actually thats makes me think "Pharo - the fastest way to learn
programming"
would make a good tagline for this.
cheers -ben
>
> Instead of *.bat or *.sh files, I would use Smalltalk to call OS commands
> directly in methods to do what I want in the OS while using Smalltalk to do
> the logic. PersonalOS should be able to run on multiple OS's using the same
> methods to do the same things. So, an easy interface to OS commands and
> possibly OS APIs would encourage people to use Smalltalk for controlling
> everything else. Smalltalk would be the center of control and automation
> from individuals to corporations and beyond.
>
> Hopefully, we can get critical mass with this.
>
April 11, 2018
Re: [Pharo-dev] Why String do not implement #displayString?
by Esteban A. Maringolo
In Object yes (to default to the existing #printOn: implementation), but
there are several other implementors of #displayOn: that work completely
different (e.g. Collection, UndefinedObject, etc).
Nonetheless, I think the #printOn:/#displayOn: is a good practice, in my
Pharo classes I "polyfill" what's missing to support it.
Regards!
On 10/04/2018 19:42, Benoit St-Jean wrote:
> As far as I can remember, yes. Dolphin has always been like that.
>
> ***BUT*** you will also notice that Dolphin has always used #printOn:
> inside #displayOn: ! (Latest image is also like that)
>
>
> On Tuesday, April 10, 2018, 6:33:05 p.m. EDT, Esteban A. Maringolo
> <emaringolo(a)gmail.com> wrote:
>
>
> Current VisualWorks (8.x) has #Object>>displayString but it is not
> implemented in terms of #displayOn:
>
> Dolphin Smalltalk is the one that has #displayString implemented in
> terms of #displayOn: and uses #displayString in all end user
> presentations of the object, so for aPerson, the inspector would show 'a
> Person('John Doe')' and on a end user ListView the same instance would
> show 'John Doe'.
>
> It is like that since Dolphin 5 at least (~2003?).
April 10, 2018
Re: [Pharo-dev] Why String do not implement #displayString?
by Benoit St-Jean
As far as I can remember, yes. Dolphin has always been like that.
***BUT*** you will also notice that Dolphin has always used #printOn: inside #displayOn: ! (Latest image is also like that)
-----------------
Benoît St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero". (A. Einstein)
On Tuesday, April 10, 2018, 6:33:05 p.m. EDT, Esteban A. Maringolo <emaringolo(a)gmail.com> wrote:
Current VisualWorks (8.x) has #Object>>displayString but it is not implemented in terms of #displayOn:
Dolphin Smalltalk is the one that has #displayString implemented in terms of #displayOn: and uses #displayString in all end user presentations of the object, so for aPerson, the inspector would show 'a Person('John Doe')' and on a end user ListView the same instance would show 'John Doe'.
It is like that since Dolphin 5 at least (~2003?).
Regards,
On 10/04/2018 19:04, Benoit St-Jean wrote:
In the "old" days, programmers made sure to respect the following conventions : you implement #storeOn:, #displayString: and #printOn: . Eventually, an object will be sent #storeString and #printString and will use your #whateverOn: implementation.Â
It looks like that good habit that I've learned at university looooooong ago got lost somewhere. It looks like no one uses #displayString anymore and rely solely on #printString instead! I had a teacher once telling me #displayString had a crappy implementation : it just sent #printString and that to be "code clean", one should implement #displayOn: and modify #displayString accordingly.
But if I recall, VW at the time introduced #displayOn: for widgets and other things, hence why #displayString never sent #displayOn:.
To make a long story short of what should have been and what it's always been, here's an excellent paper on the subject!
http://esug.org/data/HistoricalDocuments/TheSmalltalkReport/ST07/04wo.pdf
-----------------
Benoît St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero". (A. Einstein)
On Tuesday, April 10, 2018, 11:28:57 a.m. EDT, Esteban A. Maringolo <emaringolo(a)gmail.com> wrote:
Isn't #displayString implemented in terms of #displayOn: the same way
#printString is implemented in terms of "printOn:"?
And in the case of String #displayString should return the receiver (it
is, self), so the following should be true.
| s |
s := 'Hello, ''Funny'' World'.
s displayString = s. "true"
s printString = s. "false"
Regards,
On 10/04/2018 12:21, Denis Kudriashov wrote:
> Hi.
>
> According to the comment of #displayString it should be used as default
> textual representation of objects in the UI:
>
>Â Â "While printString is about to give a detailled information about an
>Â Â object, displayString is a message that should return a short
>Â Â string-based representation to be used by list and related UI
>Â Â frameworks. By default, simply return printString."
>Â Â "asString should not be implemented in Object, and kept for
>Â Â conversion between strings, symbols, text and characters."
>
> But String itself does not respect this message:
>
>Â Â 'some string' displayString " ==> '''someString''' "
>
>
> Is it bug? Or is there any reason for this?
>
> Best regards,
> Denis
--
Esteban A. Maringolo
--
Esteban A. Maringolo
April 10, 2018
Re: [Pharo-dev] Images, VMs and 32 vs 64bit
by Benoit St-Jean
Thanks!
I don't really care about the image format, my question was more oriented towards the code itself. As I don't have a Mac, I was curious as to whether there would be code differences between platforms, VMs and 32 vs 64bit distributions, code-wise!
-----------------
Benoît St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero". (A. Einstein)
On Tuesday, April 10, 2018, 6:29:33 p.m. EDT, Peter Uhnák <i.uhnak(a)gmail.com> wrote:
> images for different platforms (Mac, Linux, Windows)
yesIt is the responsibility of the VM to contain the differences. Note that there's some "platform-specific" code, but the image contains the code for all platforms at once.Generally speaking you can code on one platform, copy the image files to another and continue your work (although doing this can cause trouble, as e.g. some file paths may now point to non-existing locations).You can download the images independently of the platform too (e.g. Pharo 6 images: http://files.pharo.org/image/60/ )
> VMs (32bit, 64bit)
yes?the files are different, but I don't know if there's code difference, or if the images are just built with different memory layouts
Peter
On Wed, Apr 11, 2018 at 12:13 AM, Benoit St-Jean via Pharo-dev <pharo-dev(a)lists.pharo.org> wrote:
---------- Forwarded message ----------
From:Â Benoit St-Jean <bstjean(a)yahoo.com>
To:Â Pharo Development List <pharo-dev(a)lists.pharo.org>
Cc:Â
Bcc:Â
Date:Â Tue, 10 Apr 2018 22:13:18 +0000 (UTC)
Subject:Â Images, VMs and 32 vs 64bit
I was wondering if images for different platforms (Mac, Linux, Windows) and VMs (32bit, 64bit) are, code-wise, the same? By "the same", I mean do they all have the exact same code base or some classes/methods are in some and not in others or different?
-----------------
Benoît St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero". (A. Einstein)
April 10, 2018
Re: [Pharo-dev] Why String do not implement #displayString?
by Esteban A. Maringolo
Current VisualWorks (8.x) has #Object>>displayString but it is not
implemented in terms of #displayOn:
Dolphin Smalltalk is the one that has #displayString implemented in
terms of #displayOn: and uses #displayString in all end user
presentations of the object, so for aPerson, the inspector would show 'a
Person('John Doe')' and on a end user ListView the same instance would
show 'John Doe'.
It is like that since Dolphin 5 at least (~2003?).
Regards,
On 10/04/2018 19:04, Benoit St-Jean wrote:
> In the "old" days, programmers made sure to respect the following
> conventions : you implement #storeOn:, #displayString: and #printOn:
> . Eventually, an object will be sent #storeString and #printString
> and will use your #whateverOn: implementation.Â
>
> It looks like that good habit that I've learned at university
> looooooong ago got lost somewhere. It looks like no one uses
> #displayString anymore and rely solely on #printString instead! I had
> a teacher once telling me #displayString had a crappy implementation :
> it just sent #printString and that to be "code clean", one should
> implement #displayOn: and modify #displayString accordingly.
>
> But if I recall, VW at the time introduced #displayOn: for widgets and
> other things, hence why #displayString never sent #displayOn:.
>
> To make a long story short of what should have been and what it's
> always been, here's an excellent paper on the subject!
>
> http://esug.org/data/HistoricalDocuments/TheSmalltalkReport/ST07/04wo.pdf
>
>
> -----------------
> Benoît St-Jean
> Yahoo! Messenger: bstjean
> Twitter: @BenLeChialeux
> Pinterest: benoitstjean
> Instagram: Chef_Benito
> IRC: lamneth
> Blogue: endormitoire.wordpress.com
> "A standpoint is an intellectual horizon of radius zero". (A. Einstein)
>
>
> On Tuesday, April 10, 2018, 11:28:57 a.m. EDT, Esteban A. Maringolo
> <emaringolo(a)gmail.com> wrote:
>
>
> Isn't #displayString implemented in terms of #displayOn: the same way
> #printString is implemented in terms of "printOn:"?
>
> And in the case of String #displayString should return the receiver (it
> is, self), so the following should be true.
>
> | s |
> s := 'Hello, ''Funny'' World'.
> s displayString = s. "true"
> s printString = s. "false"
>
> Regards,
>
>
> On 10/04/2018 12:21, Denis Kudriashov wrote:
> > Hi.
> >
> > According to the comment of #displayString it should be used as default
> > textual representation of objects in the UI:
> >
> >Â Â "While printString is about to give a detailled information about an
> >Â Â object, displayString is a message that should return a short
> >Â Â string-based representation to be used by list and related UI
> >Â Â frameworks. By default, simply return printString."
> >Â Â "asString should not be implemented in Object, and kept for
> >Â Â conversion between strings, symbols, text and characters."
> >
> > But String itself does not respect this message:
> >
> >Â Â 'some string' displayString " ==> '''someString''' "
> >
> >
> > Is it bug? Or is there any reason for this?
> >
> > Best regards,
> > Denis
>
>
> --
> Esteban A. Maringolo
>
>
--
Esteban A. Maringolo
April 10, 2018