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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Basics : many way to use a Procedure Date: Fri, 11 Dec 2015 17:00:00 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <6caaac83-bca4-4b75-a4b3-47189e281c1a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 11 Dec 2015 23:57:34 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="caa759af2a9c666aec02942f6fe5abd6"; logging-data="14155"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+ECj+mXytVz/kaFwUD/dYSaISd0tuEpQ=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: <6caaac83-bca4-4b75-a4b3-47189e281c1a@googlegroups.com> Cancel-Lock: sha1:i2+h3mFw7dNigy2la0hMJX0Os8g= X-Enigmail-Draft-Status: N1110 Xref: news.eternal-september.org comp.lang.ada:28779 Date: 2015-12-11T17:00:00-07:00 List-Id: On 12/11/2015 03:19 PM, comicfanzine@gmail.com wrote: > > Ada.Text_IO.Create ( > File => Log_File, > Name => "my_log_file.txt", > Mode => Ada.Text_IO.Out_File); > > which is very similar to the prototype : > > procedure Open > (File : in out File_Type; > Mode : File_Mode; > Name : String; > Form : String := ""); This is a procedure declaration. Ada doesn't have prototypes. Also, this is the declaration for Open, not Create. This is an example of named parameter associations, often called named notation for short; the other way is positional notation. They have the form Formal_Parameter => Actual_Parameter See ARM 6.4: http://www.adaic.org/resources/add_content/standards/12rm/html/RM-6-4.html Named notation is often used for procedure calls. They can make the call easier to understand, and allow the order of the parameters to differ from those in the declaration, as in your example. For function calls, it's usually clearer to use positional notation for the 1st parameter, IMO: Image (Some_Value); rather than Image (Item => Some_Value); > Also , is it possible to apply this kind of writing for this procedure ? = > > procedure Gtk_New > (Window : out Gtk_Window; > The_Type : Gtk.Enums.Gtk_Window_Type := Gtk.Enums.Window_Toplevel); Of course: Gtk.Something.Gtk_New (Window => Msg_Window[, The_Type => Gtk.Enums.Some_Value]); -- Jeff Carter "I like it when the support group complains that they have insufficient data on mean time to repair bugs in Ada software." Robert I. Eachus 91