From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Re: Ada syntax questions Date: Fri, 18 Dec 2020 17:55:56 +0100 Message-ID: <87y2hv834z.fsf@gaheris.vdwege.eu> References: <5fdbde31$0$6455$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain X-Trace: individual.net HXnayH4kpocveWXNrujiRw82/QUQXDjsVzJh0QmdSq+hJJdtG+ X-Orig-Path: gaheris.vdwege.eu!not-for-mail Cancel-Lock: sha1:BeVnrNnSOd4P5+QFTm2YC3doiRw= sha1:uVBjsvxBta8dMh+gVdY7G3AQuU4= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Xref: reader02.eternal-september.org comp.lang.ada:60881 List-Id: DrPi <314@drpi.fr> writes: > Hi, > > Ada claims to have a better syntax than other languages. > I'm fine with with, but... > > 1) What about array indexing ? > In some other languages, arrays are indexed using square brackets. In > Ada, parentheses are used for function calls and for array indexing. > In the code "status := NewStatus(some_var);", you can't tell if > NewStatus is a function or an array. > Why would you care? It is obvious that NewStatus will return something based on the value of some_var. How it does that, by array dereference or function call should make no difference to the caller; they are only interested in the final value of status. Or another look at it: array indexing is effectively a function call anyway. It is "return value of array_base + index". > 2) In Ada, a function without arguments is called without any parentheses. > In the code "status := NewStatus;", you can't tell if NewStatus is a > function or a variable. > Again, why would you care how NewStatus returns a value? Either by returning the value of a function or by dereferencing a variable, all you're interested in is the value assigned to status. Mart -- "We will need a longer wall when the revolution comes." --- AJS, quoting an uncertain source.