comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Alternative syntax for function definitions?
Date: Sat, 27 Oct 2012 09:49:04 +0200
Date: 2012-10-27T09:49:04+02:00	[thread overview]
Message-ID: <op.wmtun2kuule2fv@cardamome> (raw)
In-Reply-To: aofcgnli1bud$.1ieeg4tvf6wt0.dlg@40tude.net

Le Sat, 27 Oct 2012 09:11:28 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:
>> I feel it would be the most relevant when having a list of accessors
>> functions, like in
>>
>>     function P1 (A : A_Type) return T1;
>>     function P2 (A : A_Type) return T2;
>>     function P3 (A : A_Type) return T3;
>>     function P4 (A : A_Type) return T4;
>>     function P5 (A : A_Type) return T5;
>
> The type A_Type should simply implement a record interface:
>
>    type A_Type is ... and record
>       P1 : T1;
>       P2 : T2;
>       ...
>       P5 : T5;
>    end record;
>    ...
> private
>    ... -- functions implementing "components" P1..P5

You got the point (I was precisely thinking of functions define on private  
type, that is, the record is not exposed), but unless I missed it, there  
is nothing like a function implementing the access to a record component  
in Ada. I agree that would be the best, but less likely to be done (we  
already have dotted notation for function designation, but only for tagged  
types).



-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University



  reply	other threads:[~2012-10-29  2:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-27  6:30 Alternative syntax for function definitions? Yannick Duchêne (Hibou57)
2012-10-27  7:11 ` Dmitry A. Kazakov
2012-10-27  7:49   ` Yannick Duchêne (Hibou57) [this message]
2012-10-27  8:37     ` Dmitry A. Kazakov
2012-10-27  9:02       ` Yannick Duchêne (Hibou57)
2012-10-27  9:38         ` Bill Findlay
2012-10-27 11:13           ` Yannick Duchêne (Hibou57)
2012-10-27 23:46             ` Bill Findlay
2012-10-27  9:50         ` Dmitry A. Kazakov
replies disabled

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