comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: strange behaviour of utf-8 files
Date: Mon, 18 Nov 2013 18:34:08 +0100
Date: 2013-11-18T18:34:08+01:00	[thread overview]
Message-ID: <1x6cdio4omkep.14oukmbw0ux7q$.dlg@40tude.net> (raw)
In-Reply-To: 528a3796$0$6635$9b4e6d93@newsspool2.arcor-online.net

On Mon, 18 Nov 2013 16:51:50 +0100, G.B. wrote:

> On 18.11.13 16:25, Dmitry A. Kazakov wrote:
>> Compare:
>>
>> 123 is a literal of Integer, mod 341, Unsigned_16, ... types
> 
> Compare
> 
>    type My_Int is range 1 .. 10
>      with Size => 16;
> 
> to
> 
>    type My_Int is range 1 .. 10
>      with Size => 32;
> 
> 
> Now
> 
>    type My_Char is range 'A' .. 'Z'
>      with size => 31;
> 
> to
> 
>    type My_Char is range 'A' .. 'Z'
>      with size => 15;
> 
> 
> And
> 
>    type My_Float is digits 6 range 0.0 .. 1_000.0
>      with Mode => Round_To_Nearest_Even;
> 
> These are representation issues.

Representation is a property of a type. Whether representation is relevant
to the semantics of the type depends on the domain space. The type
determines the semantics and relevant aspects of the representation. Not
otherwise.

> I guess there is a view that says rounding is a type?

Certainly. Rounding behavior is determined by the semantics of some type
operations.

> So what:
> 
> An encoding aspect would just be a means that allows programmers
> to say what they mean.

If aspect maps to a distinct type then yes. But it is futile to talk about
aspects as "Ada's RM aspects" because it is unclear whether they are
related to the semantics or are implementation artefacts. Ada 2012 blurred
it beyond recognition.

> After all, this is about interpreting a bit pattern at compile
> time,

No. There is no bit patterns at compile time. The compiler operates on an
alphabet. Ada's alphabet in unambiguous: RM 2.1.

Consider an Ada source packed using LZH. Does that produce another program?
No, the program is same. You can use punched cards instead, or write it
down on a coaster, it is still the same program.

> Even when using 7bit ASCII, there is *no* information in the
> source that explicitly states what is meant in a given ASCII
> String literal.

Again, it has nothing to do with encoding. Which is why errors here are so
dangerous.

> So, saying that ASCII works is just accidentally
> right.

Nothing accidental in the case of UTF-8 reinterpreted as Latin1 and
conversely. It works because ASCII is an integral part of either. Thus an
Ada program written in ASCII is invariant to UTF-8, Latin1 and many other
8-bit encodings.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2013-11-18 17:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-16 13:12 strange behaviour of utf-8 files Stoik
2013-11-16 13:34 ` Dmitry A. Kazakov
2013-11-16 15:09   ` Stoik
2013-11-16 15:55     ` Dmitry A. Kazakov
2013-11-17 13:32       ` Georg Bauhaus
2013-11-17 14:07         ` Dmitry A. Kazakov
2013-11-17 17:19           ` Dennis Lee Bieber
2013-11-17 18:07             ` Dmitry A. Kazakov
2013-11-17 19:05           ` Georg Bauhaus
2013-11-17 20:38             ` Dmitry A. Kazakov
2013-11-18  8:38               ` Georg Bauhaus
2013-11-18  9:01                 ` Dmitry A. Kazakov
2013-11-18 10:06                   ` Georg Bauhaus
2013-11-18  8:44               ` Georg Bauhaus
2013-11-18 10:24                 ` Dmitry A. Kazakov
2013-11-18 13:05                   ` G.B.
2013-11-18 15:25                     ` Dmitry A. Kazakov
2013-11-18 15:51                       ` G.B.
2013-11-18 17:34                         ` Dmitry A. Kazakov [this message]
2013-11-18  0:34           ` Stoik
2013-11-16 17:01     ` Georg Bauhaus
2013-11-17 10:38       ` Stoik
2013-11-16 15:12   ` Stoik
2013-11-16 15:57     ` Dmitry A. Kazakov
2013-11-17 11:12       ` Stoik
2013-11-22  1:03         ` Randy Brukardt
2013-11-22  3:02           ` Shark8
2013-11-22 11:54             ` Georg Bauhaus
2013-11-23  4:14             ` Randy Brukardt
2013-12-06  2:17               ` Georg Bauhaus
2013-11-16 20:06     ` Peter C. Chapin
2013-11-17 10:34       ` Stoik
2013-11-22  0:53       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox