From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada case-statement
Date: Sat, 17 Mar 2018 08:59:52 +0100
Date: 2018-03-17T08:59:52+01:00 [thread overview]
Message-ID: <p8ihto$1ia2$1@gioia.aioe.org> (raw)
In-Reply-To: p8hl6j$1i5$1@franka.jacob-sparre.dk
On 2018-03-17 00:49, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:p8g0om$1gpe$1@gioia.aioe.org...
>> On 15/03/2018 23:20, Randy Brukardt wrote:
>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>>> news:p8dbcp$11bc$1@gioia.aioe.org...
>>
>>>> I don't see how giving a name could add anything to the semantics. Each
>>>> alternative exhaustively defines a constraint. No reason to contaminate
>>>> the name space.
>>>
>>> How does
>>> when Today: Thurs =>
>>> exhaustively define anything? It just defines a constraint, but there is
>>> not
>>> way to know of what. > You have to look at the selecting_expression to
>>> find
>>> the type -- but it doesn't show it either.
>>
>> This applies to everything:
>>
>> when Thurs =>
>>
>> What is the type of Thurs? I either know or in most cases simply do not
>> care.
>
> You have to know, and you usually do with a commonly used enumeration.
Enumeration literals overloading works just fine. And it is really so
that I frequently don't know the types of enumeration literals and have
to search for in the sources.
> And
> at the same time it isn't as important to know - you almost never are going
> to use any overloaded operators (which often require qualifying something)
> in a case limb.
>
> Once you have a general name for something, you can (and do) use it in many
> contexts, and then the type (and its name) become necessary: for "use type",
> for qualifications, for type conversions, and so on.
Literals (all of them: enumerations, numeric, strings) are
self-contained, you don't need their types in most cases. Adding type
specification to a literal or a set of literals is just noise, most of
the time. [*]
>> In any case this is no change of the semantics. Today has the semantics of
>> the case statement argument. You didn't specify the type there, why should
>> you do here?
>
> You're not declaring an object for the case selector; that's "consuming" a
> value rather than creating one. All objects should have their type defined
> directly next to the declaration.
Maybe, though some trivial type inference is OK. And I see nothing wrong
when the type is specified as "same as above".
------------------
* Literal values, literal ranges, literal sets, literal arrays is one of
few cases where structural type equivalence works far better than the
named one.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2018-03-17 7:59 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 17:35 Ada case-statement Stephen Davies
2018-03-14 17:49 ` Dmitry A. Kazakov
2018-03-15 0:57 ` Robert I. Eachus
2018-03-15 3:10 ` Dan'l Miller
2018-03-15 5:54 ` J-P. Rosen
2018-03-15 7:56 ` Niklas Holsti
2018-03-15 12:21 ` Dan'l Miller
2018-03-15 17:22 ` Mill processor (Was: Re: Ada case-statement) Niklas Holsti
2018-03-15 21:50 ` Ada case-statement Randy Brukardt
2018-03-14 22:22 ` Mehdi Saada
2018-03-14 23:16 ` Randy Brukardt
2018-03-15 5:04 ` gautier_niouzes
2018-03-15 7:50 ` Jacob Sparre Andersen
2018-03-15 22:05 ` Randy Brukardt
2018-03-15 8:37 ` Dmitry A. Kazakov
2018-03-15 22:20 ` Randy Brukardt
2018-03-16 8:54 ` Dmitry A. Kazakov
2018-03-16 23:49 ` Randy Brukardt
2018-03-17 7:59 ` Dmitry A. Kazakov [this message]
2018-03-15 15:37 ` Stephen Davies
2018-03-15 16:33 ` J-P. Rosen
2018-03-15 17:01 ` Dmitry A. Kazakov
2018-03-15 18:41 ` Shark8
2018-03-15 21:12 ` Jeffrey R. Carter
2018-03-18 5:41 ` Robert I. Eachus
2018-03-18 6:57 ` Spiros Bousbouras
2018-03-18 9:17 ` Jeffrey R. Carter
2018-03-18 12:53 ` Simon Wright
2018-03-15 18:50 ` Jere
2018-03-15 20:40 ` Anh Vo
2018-03-15 22:24 ` Randy Brukardt
2018-03-16 9:53 ` Stephen Davies
2018-04-03 17:56 ` marciant
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox