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,a92e43963a6b930f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.mixmin.net!aioe.org!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: N best things about Ada? Date: Mon, 12 Jul 2010 14:06:59 -0700 Organization: Aioe.org NNTP Server Message-ID: References: <97691fd2-7411-4ccc-bc7b-290aca633cd5@z30g2000prg.googlegroups.com> Reply-To: nma@12000.org NNTP-Posting-Host: c00eBs/j4mUkprxQFmXQpg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 Xref: g2news1.google.com comp.lang.ada:12357 Date: 2010-07-12T14:06:59-07:00 List-Id: On 7/12/2010 7:05 AM, Shark8 wrote: > People have mentioned packages, non-textual-substitution generics, and > such. > But one thing that could come in handy is the named parameters, and it > is something I like; one of those "little things." > > "Circle( Radius => 23, X => 28, Y => 14 );" will always be more > readable than "Circle( 23, 28, 14 );" plus, there's the added benefit > that 1) changes in parameter-ordering will not impact calls of this > sort,& 2) the users of the functions/procedures can place the more > pertinent parameters [to their task] more prominently [e.g. first]. Yes. One way to simulate the above when using languages that do not have named parameters but do have records or struct, is by passing a record, and stick the parameters in the record as fields. The caller will read the parameters out by the _name_ of the record field. So, one can change a position of a field in the record, and the called function do not have to change, since it is reading the data by the field name. It is not as good as named parameters, but one way around it. This worked in Matlab, which is interpreted. One nice side benefit is that if one has large number of parameters in the call, they now all collapse to just one parameter (the record) which holds everything. One might have to compile everything in other stronger typed static languages? but the called function code should not have to change. --Nasser