comp.lang.ada
 help / color / mirror / Atom feed
* Ada 202x and square brackets
@ 2019-02-19 22:01 Lucretia
  2019-02-19 22:36 ` Lucretia
  2019-02-20 14:32 ` Jere
  0 siblings, 2 replies; 14+ messages in thread
From: Lucretia @ 2019-02-19 22:01 UTC (permalink / raw)


Hi,

I've noticed whilst looking through the grammar of draft 17 there are a lot of new uses of '[' ']' without much explanation. Can someone elaborate?

Ta,
Luke.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-19 22:01 Ada 202x and square brackets Lucretia
@ 2019-02-19 22:36 ` Lucretia
  2019-02-20 14:32 ` Jere
  1 sibling, 0 replies; 14+ messages in thread
From: Lucretia @ 2019-02-19 22:36 UTC (permalink / raw)


Ah found it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-19 22:01 Ada 202x and square brackets Lucretia
  2019-02-19 22:36 ` Lucretia
@ 2019-02-20 14:32 ` Jere
  2019-02-20 14:38   ` Jere
  2019-02-20 14:58   ` Lucretia
  1 sibling, 2 replies; 14+ messages in thread
From: Jere @ 2019-02-20 14:32 UTC (permalink / raw)


On Tuesday, February 19, 2019 at 5:01:05 PM UTC-5, Lucretia wrote:
> Hi,
> 
> I've noticed whilst looking through the grammar of draft 17 there are a lot of new uses of '[' ']' without much explanation. Can someone elaborate?
> 
> Ta,
> Luke.

I know you found it, but for other's benefit, which did you find.  I 
searched through and found them used in "reduction expressions" [1], 
but I don't know if that was the only use

[1]: http://www.ada-auth.org/standards/2xrm/html/RM-4-5-10.html#I3068

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-20 14:32 ` Jere
@ 2019-02-20 14:38   ` Jere
  2019-02-20 14:58   ` Lucretia
  1 sibling, 0 replies; 14+ messages in thread
From: Jere @ 2019-02-20 14:38 UTC (permalink / raw)


On Wednesday, February 20, 2019 at 9:32:14 AM UTC-5, Jere wrote:
> On Tuesday, February 19, 2019 at 5:01:05 PM UTC-5, Lucretia wrote:
> > Hi,
> > 
> > I've noticed whilst looking through the grammar of draft 17 there are a lot of new uses of '[' ']' without much explanation. Can someone elaborate?
> > 
> > Ta,
> > Luke.
> 
> I know you found it, but for other's benefit, which did you find.  I 
> searched through and found them used in "reduction expressions" [1], 
> but I don't know if that was the only use
> 
> [1]: http://www.ada-auth.org/standards/2xrm/html/RM-4-5-10.html#I3068

Sorry, meant "value sequence" of reduction expressions

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-20 14:32 ` Jere
  2019-02-20 14:38   ` Jere
@ 2019-02-20 14:58   ` Lucretia
  2019-02-20 23:47     ` Randy Brukardt
  1 sibling, 1 reply; 14+ messages in thread
From: Lucretia @ 2019-02-20 14:58 UTC (permalink / raw)


On Wednesday, 20 February 2019 14:32:14 UTC, Jere  wrote:
> On Tuesday, February 19, 2019 at 5:01:05 PM UTC-5, Lucretia wrote:
> > Hi,
> > 
> > I've noticed whilst looking through the grammar of draft 17 there are a lot of new uses of '[' ']' without much explanation. Can someone elaborate?
> > 
> > Ta,
> > Luke.
> 
> I know you found it, but for other's benefit, which did you find.  I 
> searched through and found them used in "reduction expressions" [1], 
> but I don't know if that was the only use
> 
> [1]: http://www.ada-auth.org/standards/2xrm/html/RM-4-5-10.html#I3068

It was aggregates for containers, so you can do Set := [1,2,3,4] or something like that. I didn't read the details.

http://www.ada-auth.org/standards/2xaarm/html/AA-4-3-5.html


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-20 14:58   ` Lucretia
@ 2019-02-20 23:47     ` Randy Brukardt
  2019-02-21  4:27       ` Lucretia
  0 siblings, 1 reply; 14+ messages in thread
From: Randy Brukardt @ 2019-02-20 23:47 UTC (permalink / raw)


"Lucretia" <laguest9000@googlemail.com> wrote in message 
news:b773bbfa-9fd0-431a-8ff3-462b2c5ccd15@googlegroups.com...
> On Wednesday, 20 February 2019 14:32:14 UTC, Jere  wrote:
>> On Tuesday, February 19, 2019 at 5:01:05 PM UTC-5, Lucretia wrote:
>> > Hi,
>> >
>> > I've noticed whilst looking through the grammar of draft 17 there are a 
>> > lot of new uses of '[' ']' without much explanation. Can someone 
>> > elaborate?
>> >
>> > Ta,
>> > Luke.
>>
>> I know you found it, but for other's benefit, which did you find.  I
>> searched through and found them used in "reduction expressions" [1],
>> but I don't know if that was the only use
>>
>> [1]: http://www.ada-auth.org/standards/2xrm/html/RM-4-5-10.html#I3068
>
> It was aggregates for containers, so you can do Set := [1,2,3,4] or 
> something like that. I didn't read the details.
>
> http://www.ada-auth.org/standards/2xaarm/html/AA-4-3-5.html

You can also use them around array aggregates, so that you can write a 
single component array aggregate:

             My_Arr : constant Some_Unconstrained_Array_Type := [1];

Container aggregates are roughly user-defined array aggrgeates. 
(Alternatively, you can [maybe should] think of an array as a built-in 
container.)

                                  Randy.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-20 23:47     ` Randy Brukardt
@ 2019-02-21  4:27       ` Lucretia
  2019-02-22  0:24         ` Randy Brukardt
  0 siblings, 1 reply; 14+ messages in thread
From: Lucretia @ 2019-02-21  4:27 UTC (permalink / raw)


On Wednesday, 20 February 2019 23:47:53 UTC, Randy Brukardt  wrote:

>              My_Arr : constant Some_Unconstrained_Array_Type := [1];
> 
> Container aggregates are roughly user-defined array aggrgeates. 
> (Alternatively, you can [maybe should] think of an array as a built-in 
> container.)

Do you think the language is getting a tad too complicated now?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-21  4:27       ` Lucretia
@ 2019-02-22  0:24         ` Randy Brukardt
  2019-02-22 10:34           ` AdaMagica
  0 siblings, 1 reply; 14+ messages in thread
From: Randy Brukardt @ 2019-02-22  0:24 UTC (permalink / raw)


"Lucretia" <laguest9000@googlemail.com> wrote in message 
news:be2e3cf3-e452-4501-a960-822bf6432cd9@googlegroups.com...
> On Wednesday, 20 February 2019 23:47:53 UTC, Randy Brukardt  wrote:
>
>>              My_Arr : constant Some_Unconstrained_Array_Type := [1];
>>
>> Container aggregates are roughly user-defined array aggrgeates.
>> (Alternatively, you can [maybe should] think of an array as a built-in
>> container.)
>
> Do you think the language is getting a tad too complicated now?

How so? The idea has been that an abstract data type should be able to 
declare all of the same capabilities as a built-in type. The main remaining 
holes were literals and aggregates, and those have been addressed now.

It can be complicated to build such an ADT, but that's not something that is 
done often (much like with generics). OTOH, the user experience should be 
fairly seamless -- you can write the same thing whether or not the type is 
built-in or user-defined, and (if properly defined), they'll mean the same 
thing. Most people won't care how a user-defined aggregate is constructed 
any more than they care how a vector container supports indexing. (At least, 
that's the goal.)

                           Randy.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-22  0:24         ` Randy Brukardt
@ 2019-02-22 10:34           ` AdaMagica
  2019-02-22 11:53             ` J-P. Rosen
  2019-02-22 22:18             ` Randy Brukardt
  0 siblings, 2 replies; 14+ messages in thread
From: AdaMagica @ 2019-02-22 10:34 UTC (permalink / raw)


So we can now mix () and [] at will?

([1,2,3], (7,8,9)) for a two-dim. array.

[1,2,3] & (7,8,9) for concatenation.

At least (a,b,c] is not allowed.

I'd say a rule to not mix them in an expression is due.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-22 10:34           ` AdaMagica
@ 2019-02-22 11:53             ` J-P. Rosen
  2019-02-22 12:37               ` AdaMagica
  2019-02-22 22:18             ` Randy Brukardt
  1 sibling, 1 reply; 14+ messages in thread
From: J-P. Rosen @ 2019-02-22 11:53 UTC (permalink / raw)


Le 22/02/2019 à 11:34, AdaMagica a écrit :
> So we can now mix () and [] at will?
> 
> ([1,2,3], (7,8,9)) for a two-dim. array.
> 
> [1,2,3] & (7,8,9) for concatenation.
> 
> At least (a,b,c] is not allowed.
> 
> I'd say a rule to not mix them in an expression is due.
> 
There are cases where you want to mix for clarity:
([1,2], [3,4])

So what would your rule be?

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-22 11:53             ` J-P. Rosen
@ 2019-02-22 12:37               ` AdaMagica
  2019-02-22 16:56                 ` J-P. Rosen
  0 siblings, 1 reply; 14+ messages in thread
From: AdaMagica @ 2019-02-22 12:37 UTC (permalink / raw)


Am Freitag, 22. Februar 2019 12:53:00 UTC+1 schrieb J-P. Rosen:
> There are cases where you want to mix for clarity:
> ([1,2], [3,4])
I do not see that this enhances clarity, but rather raises questions about the difference.
I see new coding standards emerge saying: Use [] only for containers, not arrays. (I've seen lots of stupid rules in such coding standards.) So this would then be an array aggregate of container subaggregates.

> So what would your rule be?
Prhaps something like J.2(4)?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-22 12:37               ` AdaMagica
@ 2019-02-22 16:56                 ` J-P. Rosen
  2019-02-22 17:09                   ` AdaMagica
  0 siblings, 1 reply; 14+ messages in thread
From: J-P. Rosen @ 2019-02-22 16:56 UTC (permalink / raw)


Le 22/02/2019 à 13:37, AdaMagica a écrit :
> Am Freitag, 22. Februar 2019 12:53:00 UTC+1 schrieb J-P. Rosen:
>> There are cases where you want to mix for clarity: ([1,2], [3,4])
> I do not see that this enhances clarity, but rather raises questions
> about the difference. I see new coding standards emerge saying: Use
> [] only for containers, not arrays. (I've seen lots of stupid rules
> in such coding standards.) So this would then be an array aggregate
> of container subaggregates.
A possible rule would be, when you have nested aggregates, to alternate
between parentheses and brackets. Or the rule you suggest. Or whatever
people find useful - i.e. better not put "good taste" rules, leave that
to tools.

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-22 16:56                 ` J-P. Rosen
@ 2019-02-22 17:09                   ` AdaMagica
  0 siblings, 0 replies; 14+ messages in thread
From: AdaMagica @ 2019-02-22 17:09 UTC (permalink / raw)


Am Freitag, 22. Februar 2019 17:56:56 UTC+1 schrieb J-P. Rosen:
> A possible rule would be, when you have nested aggregates, to alternate
> between parentheses and brackets. Or the rule you suggest. Or whatever
> people find useful - i.e. better not put "good taste" rules, leave that
> to tools.

You're right, the RM is not about taste.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ada 202x and square brackets
  2019-02-22 10:34           ` AdaMagica
  2019-02-22 11:53             ` J-P. Rosen
@ 2019-02-22 22:18             ` Randy Brukardt
  1 sibling, 0 replies; 14+ messages in thread
From: Randy Brukardt @ 2019-02-22 22:18 UTC (permalink / raw)


"AdaMagica" <christ-usch.grein@t-online.de> wrote in message 
news:e5f7df5a-4e83-4c1f-82ad-ee286627ffbc@googlegroups.com...
> So we can now mix () and [] at will?
>
> ([1,2,3], (7,8,9)) for a two-dim. array.
>
> [1,2,3] & (7,8,9) for concatenation.
>
> At least (a,b,c] is not allowed.
>
> I'd say a rule to not mix them in an expression is due.

I raised that argument, and found out I was literally the only one that 
thought that was a good idea. I'm happy to hear that I'm not 100% alone, but 
it's not happening in the Standard.

Indeed, it's been suggested that:

([1,2,3], [7,8,9]) is a good idea a two-dim. array.

Supposedly, this will be the provence of style tools and rules.

                         Randy.



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-02-22 22:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 22:01 Ada 202x and square brackets Lucretia
2019-02-19 22:36 ` Lucretia
2019-02-20 14:32 ` Jere
2019-02-20 14:38   ` Jere
2019-02-20 14:58   ` Lucretia
2019-02-20 23:47     ` Randy Brukardt
2019-02-21  4:27       ` Lucretia
2019-02-22  0:24         ` Randy Brukardt
2019-02-22 10:34           ` AdaMagica
2019-02-22 11:53             ` J-P. Rosen
2019-02-22 12:37               ` AdaMagica
2019-02-22 16:56                 ` J-P. Rosen
2019-02-22 17:09                   ` AdaMagica
2019-02-22 22:18             ` Randy Brukardt

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