comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Attribute denoting a subprogram : no named parameter associations allowed
Date: Tue, 27 Oct 2009 16:00:19 -0500
Date: 2009-10-27T16:00:19-05:00	[thread overview]
Message-ID: <hc7n14$6ik$1@munin.nbi.dk> (raw)
In-Reply-To: 26d15919-f609-4878-8960-61bc87913cca@p23g2000vbl.googlegroups.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

"Hibou57 (Yannick Duch�ne)" <yannick_duchene@yahoo.fr> wrote in message 
news:26d15919-f609-4878-8960-
> The important thing is the � Named associations are not allowed if the
> prefix in a subprogram call is an attribute_reference. �, and indeed,
> the compiler don't want it.
>
> But why this restriction ? What is the rational for this restriction ?
>
> I do not see a reason why this may be a bad practice to use named
> parameter associations when the subprogram is denoted by an attribute.

Most attributes that represent subprograms don't have names for their 
parameters. That's a carry over from Ada 83, where attributes were magic 
things, not subprograms.

The main reason for the restriction is that redesigning Ada 83 compilers to 
allow calls of attributes with parameters out of order and the like would 
have required major surgery. For instance, in Janus/Ada, attributes are 
evaluated with their own separate code; nothing whatsoever is shared with 
calls. That's about 4000 lines of compiler code, all of which would have to 
totally written to make these first-class calls. And then the generated code 
would be much worse, as well.

The point is that attributes are built-in things that the compiler is 
expected to know about and generate the best possible code. Trying to 
support very general syntax and semantics with them would be detremental to 
the goal.

This is the same reason why we don't allow user-defined attributes. (The 
whole reason that Ada 95 changed these things to be officially subprograms 
was as part of a later dropped proposal to allow user-defined attributes. 
Personally, I don't think they every should have been changed from their Ada 
83 definition.)

                                                           Randy.





  reply	other threads:[~2009-10-27 21:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-25  6:27 Attribute denoting a subprogram : no named parameter associations allowed Hibou57 (Yannick Duchêne)
2009-10-27 21:00 ` Randy Brukardt [this message]
2009-10-27 22:36   ` Adam Beneschan
2009-10-27 23:47     ` Hibou57 (Yannick Duchêne)
2009-10-28 19:03       ` 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