comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: ADA.STRINGS.INDEX_ERROR : a-strunb.adb:782
Date: Sat, 20 Jan 2018 10:47:19 +0100
Date: 2018-01-20T10:47:19+01:00	[thread overview]
Message-ID: <p3v378$1mqo$1@gioia.aioe.org> (raw)
In-Reply-To: p3u3aj$l64$1@franka.jacob-sparre.dk

On 2018-01-20 01:42, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:p3sbkb$1msl$1@gioia.aioe.org...
>> On 19/01/2018 02:10, Randy Brukardt wrote:
> ...
>>> The benefit is that these things can express ideas that aren't possible
>>> for
>>> ordinary subprogram calls.
>>
>> That does not justify special syntax. E.g. initialization cannot be
>> expressed as a subprogram call either, nevertheless there is no special
>> syntax for declaration of objects with non-null initialization.
> 
> ??? ":=" is the special syntax of initialization (it's not the syntax of a
> subprogram call!). Your example seems to prove my point. :-)

I meant rather this:

    type T is new Ada.Finalization.Controlled with ...

    X : T;
    Y : Integer;

>>> To express Subtype'First as a function, one would
>>> have to have some sort of meta-type (a subtype parameter).
>>
>> I don't think this is related.
>>
>> (However I am glad that you begin to see subtypes as proper types. (:-))
> 
> A type parameter clearly would have to pass the subtype information as well,

Yes, like it does with array bounds, *if* it were a subprogram proper. 
This is irrelevant because it is not a subprogram, it only has a syntax 
of a subprogram call. But for the compiler it is a special case exactly 
like it is when the attribute syntax is used, or any other syntax. The 
detection does not require special syntax, that is the point. Once the 
compiler detects the case, the magic starts to work.

> since Ada does not allow naming of types. In this case, it is the subtype
> information that is most relevant. So I don't see your point or joke.

It was frequently argued that subtypes are not types but something, 
well, something...

> (And I
> don't see why you don't think it is related, either. One has to have some
> mechanism for getting this information, and if you eliminate the special
> mechanism for that, some replacement is needed. In the proposed language,
> only a subprogram call is available, unless some other special syntax is
> invented, which is just kicking the can.)

It is the same mechanism used to pass/eliminate array bounds. It could 
be generalized for all types including non-tagged classes. The type tag 
of a non-tagged type is a [sub]type constraint to be passed or not. The 
same case is represented by dimensioned values. The dimension is a 
constraint, again passed or not down to the subprogram, kept or not in 
an instance.

I think it is possible to design common rules for all this and make the 
language quite simple.

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

  reply	other threads:[~2018-01-20  9:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15  1:18 ADA.STRINGS.INDEX_ERROR : a-strunb.adb:782 Mehdi Saada
2018-01-15  3:23 ` Niklas Holsti
2018-01-15  8:29 ` Dmitry A. Kazakov
2018-01-15 10:49   ` Simon Wright
2018-01-15 11:51     ` Mehdi Saada
2018-01-15 12:00       ` Mehdi Saada
2018-01-15 13:32         ` Dmitry A. Kazakov
2018-01-15 18:55         ` Shark8
2018-01-15 13:51       ` Simon Wright
2018-01-15 15:18         ` Mehdi Saada
2018-01-15 15:29           ` Mehdi Saada
2018-01-15 15:50             ` Mehdi Saada
2018-01-15 17:53               ` Simon Wright
2018-01-15 17:22   ` Anh Vo
2018-01-15 17:48     ` Dmitry A. Kazakov
2018-01-15 19:56       ` Anh Vo
2018-01-16 16:06     ` Brian Drummond
2018-01-16 17:21       ` Anh Vo
2018-01-15 10:37 ` Simon Wright
2018-01-15 16:06 ` Mehdi Saada
2018-01-17 19:23   ` Niklas Holsti
2018-01-16 16:24 ` Mehdi Saada
2018-01-16 18:20   ` Jacob Sparre Andersen
2018-01-16 20:00     ` Mehdi Saada
2018-01-17 15:45 ` Mehdi Saada
2018-01-17 16:30   ` Dmitry A. Kazakov
2018-01-17 22:50     ` Mehdi Saada
2018-01-18  8:34       ` Dmitry A. Kazakov
2018-01-18 11:14         ` Simon Wright
2018-01-18 11:55           ` Dmitry A. Kazakov
2018-01-18 12:21             ` Mehdi Saada
2018-01-18 13:08               ` J-P. Rosen
2018-01-18 15:23                 ` Dmitry A. Kazakov
2018-01-19  1:10                   ` Randy Brukardt
2018-01-19  8:52                     ` Dmitry A. Kazakov
2018-01-20  0:42                       ` Randy Brukardt
2018-01-20  9:47                         ` Dmitry A. Kazakov [this message]
2018-01-23  0:44                           ` Randy Brukardt
2018-01-18 14:05         ` AdaMagica
2018-01-18 14:17           ` Mehdi Saada
2018-01-18 14:56             ` J-P. Rosen
2018-01-18 15:38               ` Mehdi Saada
2018-01-19  1:13                 ` Randy Brukardt
2018-01-18 16:48             ` AdaMagica
2018-01-18 16:59               ` Dmitry A. Kazakov
2018-01-18 19:36                 ` Mehdi Saada
2018-01-19  1:21                   ` Randy Brukardt
2018-01-19 16:15                 ` AdaMagica
2018-01-19 16:58                   ` Dmitry A. Kazakov
2018-01-21 23:27             ` G.B.
replies disabled

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