From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,83568e4f0ce7998e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.66.77.131 with SMTP id s3mr7932910paw.24.1351321896285; Sat, 27 Oct 2012 00:11:36 -0700 (PDT) Path: s9ni51365pbb.0!nntp.google.com!news.glorb.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Alternative syntax for function definitions? Date: Sat, 27 Oct 2012 09:11:28 +0200 Organization: cbb software GmbH Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: pSb85Ij4EqcuHDcWtw64BQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Date: 2012-10-27T09:11:28+02:00 List-Id: On Sat, 27 Oct 2012 08:30:18 +0200, Yannick Duchêne (Hibou57) wrote: > Just a silly idea I have sometime. > > You know the question of having type at the left or at the right of a > declaration, used to be discussed when comparing Eiffel or Pascal like > syntax, to C like syntax. One argument is that “I : Integer;” is more > natural than “int i;” because it do as a dictionary do, putting the > defined element at the left. I have the feeling the question could > similarly apply to the syntax used for function definition. I feel > sometime, being able to write something as below, could be more readable: > > function P return T of (A1, A2, ...); > > What's your feeling about such an alternative notation? I : Integer; declares an object of type Integer. Function declares an anonymous function type and a singleton object, so the difference. > 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 -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de