[M3devel] Simple change to WIDECHAR type
Daniel Alejandro Benavides D.
dabenavidesd at yahoo.es
Fri Jul 6 19:08:25 CEST 2012
Hi all:
I think the problem is how to encode but not to REVEAL (which would need machine identification, so a generic target is my preferred abstraction as CM3 tried to do) the language encoding explicitly (we don't like to reveal anything of the machine from Modula-3 sense standard point of view you might need a language redefinition), I think if one needs that is because is on a machine like that.
So, in a given platform you might know the encoding and that's all. The other approach is just very hard to use, to put burden of choice, my thinking is that if you need that you might end needing generics that tell at compile time what to use. Of course Type checking methods are done at instantiation time, but nevertheless is helpful that these other settings are done at compile time (which make sense for the question why do I need to compile this code).
That's because in other machines you might need to exploit three times the needed time to encode, decode and encode again (cost affects if you think in changing parameters so you might not touch that for the benefit of third parties as a default). This matters in phones where you don't have time to do that, and generally any type of type machine, so in a hard-coded way this is not helpful option for everybody at all as well.
The machine-dependent solution helps if you can't compile the thing there (cross-compilations or pre-compiled binaries), but anyway I guess if we want Java compatibility (I do as a platform for binary compatibility but just when it's needed not in every execution environment, say a real HW implemented JVMs). So basically the language implementation needs to know that nobody else means that module wise model might need to be introduced, which is not something we have now.
Thanks in advance
--- El vie, 6/7/12, Rodney M. Bates <rodney_bates at lcwb.coop> escribió:
De: Rodney M. Bates <rodney_bates at lcwb.coop>
Asunto: Re: [M3devel] Simple change to WIDECHAR type
Para: m3devel at elegosoft.com
Fecha: viernes, 6 de julio, 2012 11:28
This is the result of the fact that your editor is writing UTF-8, while
the compiler is reading in ISO-latin-1, as the language specifies. This
was sensible at the time it was defined, but has been overcome by the
advent and proliferation of Unicode.
The abstract code point values in the range 16_80..16_FF are indeed the same in
Unicode and ISO-latin-1, but the bit encoding rules are different.
The simple and correct solution is to fix the compiler so that, like many
programs today, it can be told to use one of several encodings when interpreting
its input. Then set it the same as you set your editor.
On 07/01/2012 03:52 AM, Dragiša Durić wrote:
> Text.Length(Dragiša Durić)= 15
>
> out from:
> WITH me = W"Dragiša Durić" DO
> IO.Put("Text.Length("& me& ")= "& Fmt.Int(Text.Length(me))& "\n");
> END;
>
> On Jun 30, 2012, at 8:12 PM, Dragiša Durić wrote:
>
>> Jay, please explain this to me. My editor creates UTF8 files, for example. What cm3 expects after W" ?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120706/9e2b85ef/attachment-0002.html>
More information about the M3devel
mailing list