From: Shark8 <onewingedshark@gmail.com>
Subject: Re: N best things about Ada?
Date: Mon, 12 Jul 2010 09:14:54 -0700 (PDT)
Date: 2010-07-12T09:14:54-07:00 [thread overview]
Message-ID: <cfe6993b-d04c-4398-b073-04ed5ed0a205@z8g2000yqz.googlegroups.com> (raw)
In-Reply-To: wccaapw3f87.fsf@shell01.TheWorld.com
On Jul 12, 9:13 am, Robert A Duff <bobd...@shell01.TheWorld.com>
wrote:
> Shark8 <onewingedsh...@gmail.com> writes:
> > 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."
>
> Yes. It's such a small feature, yet has a huge benefit.
> People should use it more often.
>
> Another small feature: underscores in numeric literals.
> One of my pet peeves is when I have to carefully
> count the zeroes in 10000000, when it's so easy
> to write 10_000_000.
>
> > "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].
>
> Do you have any examples of that last part? That is, examples
> where using different parameter orders in different calls
> makes the code more readable?
>
> I think that sort of inconsistency usually makes the code less readable.
> I wouldn't mind a rule that says the parameter order has to match
> the declaration. (A Legality Rule, not a Name Resolution Rule!)
>
> - Bob
Well, in image-manipulation there are a number of formats that store
their information Y, then X. (That is they use column-major order
instead of row-major order.)
Given a call:
"Get_Pixel(K,J);"
Is that in familiar X-Y space, or in the image's native Y-X space?
Get_Pixel( X=> K, Y=> J);
and
Get_Pixel( Y=> J, X=> K);
are unambiguous, and given the situation/problem you may be thinking
in
one or the other.
Let's say you were to want to extend/overload Get_Pixel for a Point-
type:
Type Point_Type is record
Y, X : Integer;
end record;
You could write it as:
Function Get_Pixel( Point : Point_Type ) return Pixel_Value is
begin
Return Get_Pixel( X=> Point.X, Y=> Point.Y);
end;
next prev parent reply other threads:[~2010-07-12 16:14 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-09 0:52 N best things about Ada? usenet
2010-07-09 1:23 ` Britt Snodgrass
2010-07-13 19:05 ` Pascal Obry
2010-07-13 19:26 ` Nasser M. Abbasi
2010-07-14 1:12 ` BrianG
2010-07-14 3:00 ` Britt Snodgrass
2010-07-14 3:52 ` Shark8
2010-07-14 19:08 ` Simon Wright
2010-07-09 2:19 ` Jeffrey R. Carter
2010-07-09 3:08 ` anon
2010-07-09 8:29 ` tonyg
2010-07-10 5:14 ` anon
2010-07-09 9:18 ` Alex R. Mosteo
2010-07-09 11:52 ` John McCormick
2010-07-09 17:27 ` (see below)
2010-07-12 14:05 ` Shark8
2010-07-12 15:13 ` Robert A Duff
2010-07-12 16:14 ` Shark8 [this message]
2010-07-12 19:44 ` Simon Wright
2010-07-12 21:06 ` Nasser M. Abbasi
2010-07-13 16:18 ` Warren
2010-07-13 17:21 ` Georg Bauhaus
2010-07-13 17:34 ` Warren
2010-07-13 17:51 ` Jeffrey R. Carter
2010-07-14 18:46 ` Georg Bauhaus
2010-07-14 4:11 ` usenet
2010-07-17 1:18 ` Gautier write-only
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox