Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- August
- 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
- 2 participants
- 144614 messages
Re: [Pharo-dev] [Vm-dev] Better management of encoding of environment variables
by ducasse
>
> What's important is to create abstract layers that insulate the un-needed complexity in lowest layers possible.
> The VM excels at insulating of course.
> At image side we have to assume the responsibility of not leaking too much by ourself.
>
> As Eliot said, right now the VM (and FFI) just take sequences of uninterpreted bytes (ByteArray) and pass them to API.
> The conversion ByteString/WideString <-> specifically-encoded ByteArray is performed at image side.
>
> With FFI, we could eventually make this conversion platform specific instead of always UTF8.
> The purpose would be to reduce back and forth conversions in chained API calls for example.
> For sanity, then better follow those rules:
> - the image does not attempt direct interaction with these opaque data (other than thru OS API)
> - nor preserve them across snapshots.
> Beware, conversion is not platform specific, but can be library specific (some library on windows will take UTF8).
> So we may reify the library and always double dispatch to the library, or we create upper level abstract messages that may chain several low level OS API calls.
> We would thus let complexity creep one more level, but only if we have good reason to do so.
> We don't want to trade uniformity for small gains.
> BTW, note that the xxxW API is already a huge uniformisation progress compared to the code-page specific xxxA API!
Hi nicolas
Iâm reading and trying to understand. but the xxx lost me. :)
>
> Another strategy is to create more complex abstractions (i.e. parameterized) that can deal with a zoo of different underlying conventions.
> For example, this would be the EncodedString of VW.
> This strategy could be tempting, because it enables dealing with lower level platform-specific-encoded objects and still interact with them in the image transparently.
> But I strongly advise to think twice (or more) before introducing such complexity:
> - it breaks former invariants (thus potentially lot of code)
> - complexity tends to spread in many places
> I don't recommend it.
>
> PS: oups, sorry for out of band message, I wanted to send, but it seems that I did not press the button properly...
>
> > On 16 Jan 2019, at 10:59, Guillermo Polito <guillermopolito(a)gmail.com <mailto:guillermopolito@gmail.com>> wrote:
> >
> > Hi Nicolas,
> >
> > On Wed, Jan 16, 2019 at 10:25 AM Nicolas Cellier <nicolas.cellier.aka.nice(a)gmail.com <mailto:nicolas.cellier.aka.nice@gmail.com>> wrote:
> > IMO, windows VM (and plugins) should do the UCS2 -> UTF8 conversion because the purpose of a VM is to provide an OS independant façade.
> > I made progress recently in this area, but we should finish the job/test/consolidate.
> >
> > I'm following your changes for windows from the shadows and I think they are awesome :).
> >
> > If someone bypass the VM and use direct windows API thru FFI, then he takes the responsibility, but uniformity doesn't hurt.
> >
> > So far we are using FFI for this, as you say we create first Win32WideStrings from utf8 strings and then we use ffi calls to the *W functions.
> > I don't think we can make it for Pharo7.0.0. The cycle to build, do some acceptance tests, and then bless a new VM as stable is far too long for our inminent release :).
> >
> > But this could be for a 7.1.0, and if you like I can surely give a hand on this.
> >
> > Guille
>
>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
Jan. 18, 2019
Re: [Pharo-dev] DebugSession>>activePC:
by ducasse
I simply love the dynamic rewriting this is just too cool. We should systematically use it.
I will continue to use it in any deprecation.
Now I have a simple question (You can explain it to me over lunch one of these days).
I do not get why RBAST would not be a good representation for the compiler?
I would like to know what is the difference.
You mean that before going from BC to AST was difficult?
How opal performs it? It does not use the source of the method to recreate the AST but he can do it from the BC?
Stef
>>
>
> But I like the âhigh levelâ: using a shared AST between the compiler and the tools *and* having a mapping BC -> AST -> Text.
>
> Of course I understand that the choice to use the RB AST for the compiler is not a âtraditionalâ one.. but it turned out to work very well *and* it brings some amazing power, as we have now not only a mapping bc->text offset, but a mapping bc->AST, too. This e.g. (just a a simple example) makes the magic of the runtime transforming deprecations possible. See #transform on class Deprecation, the #sourceNodeExecuted:
>
> transform
> | node rewriteRule aMethod |
> self shouldTransform ifFalse: [ ^ self ].
> self rewriterClass ifNil:[ ^ self signal ].
> aMethod := self contextOfSender method.
> aMethod isDoIt ifTrue:[^ self]. "no need to transform doits"
> node := self contextOfSender sourceNodeExecuted.
> rewriteRule := self rewriterClass new
> replace: rule key with: rule value.
> (rewriteRule executeTree: node)
> ifFalse: [ ^ self ].
> node replaceWith: rewriteRule tree.
> Author
> useAuthor: 'AutoDeprecationRefactoring'
> during: [aMethod origin compile: aMethod ast formattedCode classified: aMethod protocol].
>
>
> Marcus
Jan. 18, 2019
Re: [Pharo-dev] Better management of encoding of environment variables
by Guillermo Polito
On Fri, Jan 18, 2019 at 1:48 PM Ben Coman via Pharo-dev <
pharo-dev(a)lists.pharo.org> wrote:
>
>
>
>
> On Wed, 16 Jan 2019 at 18:37, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>
>> Still, one of the conclusions of previous discussions about the encoding
>> of environment variables was/is that there is no single correct solution.
>> OS's are not consistent in how the encoding is done in all (historical)
>> contexts (like sometimes,
>
>
>
>> 1 env var defines the encoding to use for others,
>
>
> ouch. That one point nearly made my retract my comment next paragraph,
> but is there much more complexity?
> or just a case of utf8<==>appSpecificEncoding rather than
> ascii<==>appSpecificEncoding ?
>
It's not muuuuch more complex. The problem is that usually the bugs that
arise from wrongly managing such conversions can be super obscure.
> Sorry if I'm rehashing past discussion (do you have a link?), but
> considering...
> * 92% of web pages are UTF8 encoded[1] such that pragmatically UTF8 *is*
> the standard for text
> * Strings so pervasive in a system
> ...would there be an overall benefit to adopt UTF8 as the encoding for
> Strings
> consistently provided across the cross-platform vm interface?
> (i.e. fixing platforms that don't comply to the standard due to their
> historical baggage)
>
> And I found it interesting Microsoft are making some moves towards UTF8
> [2]...
> "With insider build 17035 and the April 2018 update (nominal build 17134)
> for Windows 10, a "Beta: Use Unicode UTF-8 for worldwide language support"
> checkbox appeared for setting the locale code page to UTF-8.[a] This allows
> for calling "narrow" functions, including fopen and SetWindowTextA, with
> UTF-8 strings. "
>
> The approach vm-side could be similar to Section 10 How to do text on
> Windows [3]
> with the philosophy of "performing the [conversions] as close to API calls
> as possible,
> and never holding the [converted] data."
>
> [1]
> https://w3techs.com/technologies/history_overview/character_encoding/ms/y
> [2] https://en.wikipedia.org/wiki/Unicode_in_Microsoft_Windows
> [3] http://utf8everywhere.org/
>
>
> different applications do different things, and other such nice stuff),
>> and certainly not across platforms.
>>
>> So this is really complex.
>>
>> Do we want to hide this in some obscure VM C code that very few people
>> can see, read, let alone help with ?
>>
>> The image side is perfectly capable of dealing with platform differences
>> in a clean/clear way, and at least we can then use the full power of our
>> language and our tools.
>>
>
> Big question... Do we currently have primitives of the same name returning
> different encodings on different platforms? I presume that would be
> awkward.
> If the image is handle encoding differences, should separate primitives be
> used? e.g. utf8GetEnv & utf16getEnv
>
> Could I get some feedback on [4] saying... **The Single Most Important
> Fact About Encodings**
> If you completely forget everything I just explained, please remember one
> extremely important fact.
> It does not make sense to have a string without knowing what encoding it
> uses. "
>
> And so... does our String nowadays require an 'encoding' instance variable
> such that this is *always* associated?
> This might remove any need for separate utf8GetEnv & utf16getEnv (if that
> was even a reasonable idea).
>
I think that will just overcomplicate things. Right now, all Strings in
Pharo are unicode strings. Characters are represented with their
corresponding unicode codepoint.
If all characters in a string have codepoints < 256 then they are just
stored in a bytestring. Otherwise they are WideStrings.
I think assuming a single representation for strings, and then encode when
interacting with external apps/APIs is MUCH simpler.
> cheers -ben
>
> [4]
> https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-softwa…
>
>
>
>> > On 16 Jan 2019, at 10:59, Guillermo Polito <guillermopolito(a)gmail.com>
>> wrote:
>> >
>> > Hi Nicolas,
>> >
>> > On Wed, Jan 16, 2019 at 10:25 AM Nicolas Cellier <
>> nicolas.cellier.aka.nice(a)gmail.com> wrote:
>> > IMO, windows VM (and plugins) should do the UCS2 -> UTF8 conversion
>> because the purpose of a VM is to provide an OS independant façade.
>> > I made progress recently in this area, but we should finish the
>> job/test/consolidate.
>> >
>> > I'm following your changes for windows from the shadows and I think
>> they are awesome :).
>> >
>> > If someone bypass the VM and use direct windows API thru FFI, then he
>> takes the responsibility, but uniformity doesn't hurt.
>> >
>> > So far we are using FFI for this, as you say we create first
>> Win32WideStrings from utf8 strings and then we use ffi calls to the *W
>> functions.
>> > I don't think we can make it for Pharo7.0.0. The cycle to build, do
>> some acceptance tests, and then bless a new VM as stable is far too long
>> for our inminent release :).
>> >
>> > But this could be for a 7.1.0, and if you like I can surely give a hand
>> on this.
>> >
>> > Guille
>>
>>
>>
--
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
Jan. 18, 2019
Re: [Pharo-dev] DebugSession>>activePC:
by Marcus Denker
> On 11 Jan 2019, at 20:28, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>
> Hi Thomas,
>
> forgive me, my first response was too terse. Having thought about it in the shower it becomes clear :-)
>
>> On Jan 11, 2019, at 6:49 AM, Thomas Dupriez <tdupriez(a)ens-paris-saclay.fr> wrote:
>>
>> Hi,
>>
>> Yes, my question was just of the form: "Hey there's this method in DebugSession. What is it doing? What's the intention behind it? Does someone know?". There was no hidden agenda behind it.
>>
>> @Eliot
>>
>> After taking another look at this method, there's something I don't understand:
>>
>> activePC: aContext
>> ^ (self isLatestContext: aContext)
>> ifTrue: [ interruptedContext pc ]
>> ifFalse: [ self previousPC: aContext ]
>>
>> isLatestContext: checks whether its argument is the suspended context (the context at the top of the stack of the interrupted process). And if that's true, activePC: returns the pc of **interruptedContext**, not of the suspended context. These two contexts are different when the debugger opens on an exception, so this method is potentially returning a pc for another context than its argument...
>>
>> Another question I have to improve the comment for this method is: what's the high-level meaning of this concept of "activePC". You gave the formal definition, but what's the point of defining this so to speak? What makes this concept interesting enough to warrant defining it and giving it a name?
>
> There are two âmodesâ where a pc us mapped to a source range. One is when stepping a context in the debugger (the context is on top and is actively executing bytecodes). Here the debugger stops immediately before a send or assignment or return, so that for sends we can do into or over, or for assignments or returns check stack top to see what will be assigned or returned. In this mode we want the pc of the send, assign or return to map to the source range for the send, or the expression being assigned or returned. Since this is the âcommon caseâ, and since this is the only choice that makes sense for assignments ta and returns, the bytecode compiler constructs itâs pc to source range map in terms of the pc of the first byte if the send, assign or return bytecode.
>
> The second âmodeâ is when selecting a context below the top context. The pc for any context below the top context will be the return pc for a send, because the send has already happened. The compiler could choose to map this pc to the send, but it would not match what works for the common case. Another choice would appear be to have two map entries, one for the send and one for the return pc, both mapping to the source range. But this wouldnât work because the result of a send might be assigned or returned and so there is a potential conflict. I stead the reasonable solution is to select the previous pc for contexts below the top of context, which will be the pc for the start of the send bytecode.
>
I checked with Thomas
-> for source mapping, we use the API of the method map. The map does the âget the mapping for the instruction beforeâ, it just needs to be told that we ask the range for an active context:
#rangeForPC:contextIsActiveContext:
it is called
^aContext debuggerMap
rangeForPC: aContext pc
contextIsActiveContext: (self isLatestContext: aContext) ]
So the logic was move from the debugger to the Map. (I think this is even your design?), and thus the logic inside the debugger is not needed anymore.
-> For the question why the AST node of the Block has no simple method to check if it is an âisOptimizedâ block (e.g. in an ifTrue:): Yes, that might be nice. The reason why is is not there is that the compiler internally using OCOptimizedBlockScope and a check on the AST level was never needed. I would have added it as soon as it would be needed (quite easy to do).
On the AST level there is already a check, though, if a *send* is optimized, which is used for code generation (#isInlined).
The question why we did not add more compatibility layers to the old AST is that is is quite different.. so even with some methods here and there 99% of clients need changes, so I did not even investigate it too much. With the idea that if we end up in a situation where we need just a method, we can just add it as needed.
In general, I have no srtong feelings about the details of the implementation of Opal. Itâs just what was possible, with the resources and the understanding that I had at the point it was done. There are for sure even mistakes. I always make mistakes.
In addition, it is based on a prior compiler which was done for a different closure model whose Design-choices influenced it too much I think, sometimes good, sometimes not.
But I like the âhigh levelâ: using a shared AST between the compiler and the tools *and* having a mapping BC -> AST -> Text.
Of course I understand that the choice to use the RB AST for the compiler is not a âtraditionalâ one.. but it turned out to work very well *and* it brings some amazing power, as we have now not only a mapping bc->text offset, but a mapping bc->AST, too. This e.g. (just a a simple example) makes the magic of the runtime transforming deprecations possible. See #transform on class Deprecation, the #sourceNodeExecuted:
transform
| node rewriteRule aMethod |
self shouldTransform ifFalse: [ ^ self ].
self rewriterClass ifNil:[ ^ self signal ].
aMethod := self contextOfSender method.
aMethod isDoIt ifTrue:[^ self]. "no need to transform doits"
node := self contextOfSender sourceNodeExecuted.
rewriteRule := self rewriterClass new
replace: rule key with: rule value.
(rewriteRule executeTree: node)
ifFalse: [ ^ self ].
node replaceWith: rewriteRule tree.
Author
useAuthor: 'AutoDeprecationRefactoring'
during: [aMethod origin compile: aMethod ast formattedCode classified: aMethod protocol].
Marcus
Jan. 18, 2019
Re: [Pharo-dev] [Vm-dev] Better management of encoding of environment variables
by Nicolas Cellier
Le mer. 16 janv. 2019 Ã 23:23, Eliot Miranda <eliot.miranda(a)gmail.com> a
écrit :
>
> Hi Sven,
>
> On Wed, Jan 16, 2019 at 2:37 AM Sven Van Caekenberghe <sven(a)stfx.eu>
> wrote:
>
>> Still, one of the conclusions of previous discussions about the encoding
>> of environment variables was/is that there is no single correct solution.
>> OS's are not consistent in how the encoding is done in all (historical)
>> contexts (like sometimes, 1 env var defines the encoding to use for others,
>> different applications do different things, and other such nice stuff), and
>> certainly not across platforms.
>>
>> So this is really complex.
>>
>> Do we want to hide this in some obscure VM C code that very few people
>> can see, read, let alone help with ?
>>
>> The image side is perfectly capable of dealing with platform differences
>> in a clean/clear way, and at least we can then use the full power of our
>> language and our tools.
>>
>
> Agreed. At the same time I think it is very important that we don't reply
> on the FFI for environment variable access. This is a basic cross-platform
> facility. So I would like to see the environment accessed through
> primitives, but have the image place interpretation on the result of the
> primitive(s), and have the primitive(s) answer a raw result, just a
> sequence of uninterpreted bytes.
>
> VisualWorks takes this approach and provides a class UninterpretedBytes
> that the VM is aware of. That's always seemed like an ugly name and
> overkill to me. I would just use ByteArray and provide image level
> conversion from ByteArray to String, which is what I believe we have anyway.
>
>
What's important is to create abstract layers that insulate the un-needed
complexity in lowest layers possible.
The VM excels at insulating of course.
At image side we have to assume the responsibility of not leaking too much
by ourself.
As Eliot said, right now the VM (and FFI) just take sequences of
uninterpreted bytes (ByteArray) and pass them to API.
The conversion ByteString/WideString <-> specifically-encoded ByteArray is
performed at image side.
With FFI, we could eventually make this conversion platform specific
instead of always UTF8.
The purpose would be to reduce back and forth conversions in chained API
calls for example.
For sanity, then better follow those rules:
- the image does not attempt direct interaction with these opaque data
(other than thru OS API)
- nor preserve them across snapshots.
Beware, conversion is not platform specific, but can be library specific
(some library on windows will take UTF8).
So we may reify the library and always double dispatch to the library, or
we create upper level abstract messages that may chain several low level OS
API calls.
We would thus let complexity creep one more level, but only if we have good
reason to do so.
We don't want to trade uniformity for small gains.
BTW, note that the xxxW API is already a huge uniformisation progress
compared to the code-page specific xxxA API!
Another strategy is to create more complex abstractions (i.e.
parameterized) that can deal with a zoo of different underlying conventions.
For example, this would be the EncodedString of VW.
This strategy could be tempting, because it enables dealing with lower
level platform-specific-encoded objects and still interact with them in the
image transparently.
But I strongly advise to think twice (or more) before introducing such
complexity:
- it breaks former invariants (thus potentially lot of code)
- complexity tends to spread in many places
I don't recommend it.
PS: oups, sorry for out of band message, I wanted to send, but it seems
that I did not press the button properly...
>
>> > On 16 Jan 2019, at 10:59, Guillermo Polito <guillermopolito(a)gmail.com>
>> wrote:
>> >
>> > Hi Nicolas,
>> >
>> > On Wed, Jan 16, 2019 at 10:25 AM Nicolas Cellier <
>> nicolas.cellier.aka.nice(a)gmail.com> wrote:
>> > IMO, windows VM (and plugins) should do the UCS2 -> UTF8 conversion
>> because the purpose of a VM is to provide an OS independant façade.
>> > I made progress recently in this area, but we should finish the
>> job/test/consolidate.
>> >
>> > I'm following your changes for windows from the shadows and I think
>> they are awesome :).
>> >
>> > If someone bypass the VM and use direct windows API thru FFI, then he
>> takes the responsibility, but uniformity doesn't hurt.
>> >
>> > So far we are using FFI for this, as you say we create first
>> Win32WideStrings from utf8 strings and then we use ffi calls to the *W
>> functions.
>> > I don't think we can make it for Pharo7.0.0. The cycle to build, do
>> some acceptance tests, and then bless a new VM as stable is far too long
>> for our inminent release :).
>> >
>> > But this could be for a 7.1.0, and if you like I can surely give a hand
>> on this.
>> >
>> > Guille
>>
>>
>>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
Jan. 18, 2019
Re: [Pharo-dev] Better management of encoding of environment variables
by Ben Coman
On Wed, 16 Jan 2019 at 18:37, Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
> Still, one of the conclusions of previous discussions about the encoding
> of environment variables was/is that there is no single correct solution.
> OS's are not consistent in how the encoding is done in all (historical)
> contexts (like sometimes,
> 1 env var defines the encoding to use for others,
ouch. That one point nearly made my retract my comment next paragraph, but
is there much more complexity?
or just a case of utf8<==>appSpecificEncoding rather than
ascii<==>appSpecificEncoding ?
Sorry if I'm rehashing past discussion (do you have a link?), but
considering...
* 92% of web pages are UTF8 encoded[1] such that pragmatically UTF8 *is*
the standard for text
* Strings so pervasive in a system
...would there be an overall benefit to adopt UTF8 as the encoding for
Strings
consistently provided across the cross-platform vm interface?
(i.e. fixing platforms that don't comply to the standard due to their
historical baggage)
And I found it interesting Microsoft are making some moves towards UTF8
[2]...
"With insider build 17035 and the April 2018 update (nominal build 17134)
for Windows 10, a "Beta: Use Unicode UTF-8 for worldwide language support"
checkbox appeared for setting the locale code page to UTF-8.[a] This allows
for calling "narrow" functions, including fopen and SetWindowTextA, with
UTF-8 strings. "
The approach vm-side could be similar to Section 10 How to do text on
Windows [3]
with the philosophy of "performing the [conversions] as close to API calls
as possible,
and never holding the [converted] data."
[1]
https://w3techs.com/technologies/history_overview/character_encoding/ms/y
[2] https://en.wikipedia.org/wiki/Unicode_in_Microsoft_Windows
[3] http://utf8everywhere.org/
different applications do different things, and other such nice stuff), and
> certainly not across platforms.
>
> So this is really complex.
>
> Do we want to hide this in some obscure VM C code that very few people can
> see, read, let alone help with ?
>
> The image side is perfectly capable of dealing with platform differences
> in a clean/clear way, and at least we can then use the full power of our
> language and our tools.
>
Big question... Do we currently have primitives of the same name returning
different encodings on different platforms? I presume that would be
awkward.
If the image is handle encoding differences, should separate primitives be
used? e.g. utf8GetEnv & utf16getEnv
Could I get some feedback on [4] saying... **The Single Most Important Fact
About Encodings**
If you completely forget everything I just explained, please remember one
extremely important fact.
It does not make sense to have a string without knowing what encoding it
uses. "
And so... does our String nowadays require an 'encoding' instance variable
such that this is *always* associated?
This might remove any need for separate utf8GetEnv & utf16getEnv (if that
was even a reasonable idea).
cheers -ben
[4]
https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-softwa…
> > On 16 Jan 2019, at 10:59, Guillermo Polito <guillermopolito(a)gmail.com>
> wrote:
> >
> > Hi Nicolas,
> >
> > On Wed, Jan 16, 2019 at 10:25 AM Nicolas Cellier <
> nicolas.cellier.aka.nice(a)gmail.com> wrote:
> > IMO, windows VM (and plugins) should do the UCS2 -> UTF8 conversion
> because the purpose of a VM is to provide an OS independant façade.
> > I made progress recently in this area, but we should finish the
> job/test/consolidate.
> >
> > I'm following your changes for windows from the shadows and I think they
> are awesome :).
> >
> > If someone bypass the VM and use direct windows API thru FFI, then he
> takes the responsibility, but uniformity doesn't hurt.
> >
> > So far we are using FFI for this, as you say we create first
> Win32WideStrings from utf8 strings and then we use ffi calls to the *W
> functions.
> > I don't think we can make it for Pharo7.0.0. The cycle to build, do some
> acceptance tests, and then bless a new VM as stable is far too long for our
> inminent release :).
> >
> > But this could be for a 7.1.0, and if you like I can surely give a hand
> on this.
> >
> > Guille
>
>
>
Jan. 18, 2019
Re: [Pharo-dev] Better management of encoding of environment variables
by Sven Van Caekenberghe
Dave,
> On 18 Jan 2019, at 01:54, David T. Lewis via Pharo-dev <pharo-dev(a)lists.pharo.org> wrote:
>
>
> From: "David T. Lewis" <lewis(a)mail.msen.com>
> Subject: Re: [Pharo-dev] Better management of encoding of environment variables
> Date: 18 January 2019 at 01:54:34 GMT+1
> To: Pharo Development List <pharo-dev(a)lists.pharo.org>
>
>
> On Thu, Jan 17, 2019 at 04:57:18PM +0100, Sven Van Caekenberghe wrote:
>>
>>> On 16 Jan 2019, at 23:23, Eliot Miranda <eliot.miranda(a)gmail.com> wrote:
>>>
>>> On Wed, Jan 16, 2019 at 2:37 AM Sven Van Caekenberghe <sven(a)stfx.eu> wrote:
>>>
>>> The image side is perfectly capable of dealing with platform differences
>>> in a clean/clear way, and at least we can then use the full power of our
>>> language and our tools.
>>>
>> Agreed. At the same time I think it is very important that we don't reply
>> on the FFI for environment variable access. This is a basic cross-platform
>> facility. So I would like to see the environment accessed through primitives,
>> but have the image place interpretation on the result of the primitive(s),
>> and have the primitive(s) answer a raw result, just a sequence of uninterpreted
>> bytes.
>>
>> OK, I can understand that ENV VAR access is more fundamental than FFI
>> (although FFI is already essential for Pharo, also during startup).
>>
>>> VisualWorks takes this approach and provides a class UninterpretedBytes
>>> that the VM is aware of. That's always seemed like an ugly name and
>>> overkill to me. I would just use ByteArray and provide image level
>>> conversion from ByteArray to String, which is what I believe we have anyway.
>>
>> Right, bytes are always uninterpreted, else they would be something else.
>> We got ByteArray>>#decodedWith: and ByteArray>>#utf8Decoded and our ByteArray
>> inspector decodes automatically if it can.
>>
>
> Hi Sven,
>
> I am the author of the getenv primitives, and I am also sadly uninformed
> about matters of character sets and strings in a multilingual environment.
>
> The primitives answer environment variable variable values as ByteString
> rather than ByteArray. This made sense to me at the time that I wrote it,
> because ByteString is easy to display in an inspector, and because it is
> easily converted to ByteArray.
>
> For an American English speaker this seems like a good choice, but I
> wonder now if it is a bad decision. After all, it is also trivially easy
> to convert a ByteArray to ByteString for display in the image.
>
> Would it be helpful to have getenv primitives that answer ByteArray
> instead, and to let all conversion (including in OSProcess) be done in
> the image?
>
> Thanks,
> Dave
Normally, the correct way to represent uninterpreted bytes is with a ByteArray. Decoding these bytes as characters is the specific task of a character encoder/decoder, with a deliberate choice as to which to use.
Since the getenv() system call uses simple C strings, it is understandable that this was carried over. It is probably not worth or too risky to change that - as long as the receiver understands that it is a raw OS string that needs more work.
Like with file path encoding/decoding, environment variable encoding/decoding is plain messy and complex. IMHO it is better to manage that at the image level where we are more agile and can better handle that complexity.
Sven
BTW: using funny Unicode chars, like ð [https://www.fileformat.info/info/unicode/char/1f388/index.htm] is something even English speakers do.
Jan. 18, 2019
[Pharo 7.0] Build #130: 22896-Creating-methods-in-a-subclass-with-a-class-using-a-trait
by ci-pharo-ci-jenkins2@inria.fr
There is a new Pharo build available!
The status of the build #130 was: FAILURE.
The Pull Request #2266 was integrated: "22896-Creating-methods-in-a-subclass-with-a-class-using-a-trait"
Pull request url: https://github.com/pharo-project/pharo/pull/2266
Issue Url: https://pharo.fogbugz.com/f/cases/22896
Build Url: https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%2…
Jan. 18, 2019
Re: [Pharo-dev] Better management of encoding of environment variables
by ducasse
>
> So making the primitives return ByteArray instances instead of ByteString should be safe enough :).
> But this is in my opinion clearly a hack instead of fixing the real problem, and we have to be careful to guard such patterns with comments everywhere explaining why the bytearray conversion is really needed thereâ¦
Guillermo what is the correct way to do it?
> Would it be helpful to have getenv primitives that answer ByteArray
> instead, and to let all conversion (including in OSProcess) be done in
> the image?
>
> Well, personally I would like that getenv/setenv and getcwd setcwd support are not in a plugin but as a basic service provided by the vm.
>
> Cheers,
> Guille
>
>
> Thanks,
> Dave
>
>
>
>
> --
>
> 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
Jan. 18, 2019
Re: [Pharo-dev] Purpose of VM [was: Re: Better management of encoding of environment variables]
by ducasse
> >
> > And if it's in the image you get to do the programming in Smalltalk rather than C or Slang, which is more fun for most of us. And, let's face it, fun is an important metric in an open-source project -- things that are fun are much more likely to get done.
>
> +100
>
> The VM *is* developed in Smalltalk
> https://www.researchgate.net/publication/328509577_Two_Decades_of_Smalltalk… <https://www.researchgate.net/publication/328509577_Two_Decades_of_Smalltalk…>
It is not the point of the message of Martin. I imagine that Martin and Sven understand it perfectly that the VM is written in Slang and that there
is a simulator. Still many of us agree with their analysis. The VM logic should be on execution and try to delegate to the image most of the rest.
Stef
Jan. 18, 2019