comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Comments requested for a couple of Ada-Comments submissions
Date: Fri, 11 Jul 2014 15:46:33 -0600
Date: 2014-07-11T15:46:33-06:00	[thread overview]
Message-ID: <XWYvv.380837$OF6.324701@fx19.iad> (raw)
In-Reply-To: <lppklk$rek$1@loke.gir.dk>

On 11-Jul-14 15:24, Randy Brukardt wrote:
> This is roughly what GNAT is doing, and I think this is horrible. An
> attribute is some sort of function, and it would never be possible to write
> a function that works like this. I don't want more magic in the language if
> we can help it. Moreover, this ought to have the semantics of an aggregate
> (vis-a-vis temporaries, build-in-place, and the like), and as such it ought
> to look like an aggregate.

I agree -- I think this should not be an attribute, nor the addition of 
new keywords.

Perhaps something along the lines of Extension Aggregates [ref 4.3.2].
-- Reminder --

extension_aggregate ::=
     (ancestor_part with record_component_association_list)

ancestor_part ::= expression | subtype_mark

-- New Syntax --
partial_aggregate ::=
     (modified_part with all others => <>)

where modified_part denotes the portion being updated, in list/alternate 
form...
-- Given record a containing integer fields B, C, D:
A:= (B => 1, D => 2 with all others => <>);
-- Given bit-array A with indices 1..16:
A:= (1..4 => 1, 9..16 => 0 with all others => <>);

It obviously wouldn't work on a unconstrained array-type initialization, 
where the variable would try to get its constraints from the right-hand 
side, but considering the intended use I don't see why that would be a 
bad thing.
Just an idea.

  reply	other threads:[~2014-07-11 21:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11  0:02 Comments requested for a couple of Ada-Comments submissions Simon Clubley
2014-07-11  0:30 ` Jeffrey Carter
2014-07-11  4:16   ` Randy Brukardt
2014-07-11 16:04     ` Niklas Holsti
2014-07-11 16:24       ` Dan'l Miller
2014-07-11 20:02       ` Simon Clubley
2014-07-12  5:52         ` Niklas Holsti
2014-07-11  4:26 ` Randy Brukardt
2014-07-11  7:05   ` Simon Clubley
2014-07-11  4:56 ` Shark8
2014-07-11 15:35   ` Adam Beneschan
2014-07-11 17:26     ` Niklas Holsti
2014-07-11 17:55       ` Adam Beneschan
2014-07-11 18:00         ` Simon Wright
2014-07-11 19:07           ` Georg Bauhaus
2014-07-11 19:10           ` Dmitry A. Kazakov
2014-07-11 19:16             ` Niklas Holsti
2014-07-11 19:35               ` Dmitry A. Kazakov
2014-07-11 21:24             ` Randy Brukardt
2014-07-11 21:46               ` Shark8 [this message]
2014-07-11 19:30       ` Simon Clubley
replies disabled

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