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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.47.8 with SMTP id l8mr228252qaf.1.1376329171734; Mon, 12 Aug 2013 10:39:31 -0700 (PDT) X-Received: by 10.50.98.4 with SMTP id ee4mr5111igb.5.1376329171519; Mon, 12 Aug 2013 10:39:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder02.blueworldhosting.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!fx3no2148623qab.0!news-out.google.com!he10ni1415qab.0!nntp.google.com!fx3no2148622qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 12 Aug 2013 10:39:31 -0700 (PDT) In-Reply-To: <87mwoqbao2.fsf@VLAN-3434.student.uu.se> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=149.32.224.34; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 149.32.224.34 References: <87ob96ajv6.fsf@VLAN-3434.student.uu.se> <03ea570b-e45f-4694-ab9b-3413c4770379@googlegroups.com> <878v0aee8i.fsf@VLAN-3434.student.uu.se> <87txiycxx9.fsf@VLAN-3434.student.uu.se> <2531ecb1-4ac0-404a-8229-3110d4268374@googlegroups.com> <87mwoqbao2.fsf@VLAN-3434.student.uu.se> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8c8d6ec3-aabb-4bf0-80bf-354f63e574eb@googlegroups.com> Subject: Re: 4 beginner's questions on the PL Ada From: Anh Vo Injection-Date: Mon, 12 Aug 2013 17:39:31 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 3969 Xref: news.eternal-september.org comp.lang.ada:16827 Date: 2013-08-12T10:39:31-07:00 List-Id: On Friday, August 9, 2013 6:24:13 PM UTC-7, Emanuel Berg wrote: > Anh Vo writes: > > You guys should do a field trip to gnu.emacs.help - there, we just > post code all days! It is much better. Code speaks louder than > words. It is very difficult to follow all this discussion on > memory allocation etc., but the few times you posted code there > wasn't a letter I didn't understand immediately. > > And isn't that the same way with you? If you were to explain the C > for loop to another programmer, would you not just write > > for (i = 0; i < STOP; i++) { printf("Pretty clear, huh?\n"); } > > But I don't doubt your Ada knowledge, or you helpful attitude. Hmmmm... These have nothing to do with how a task name implemented with respect to portability. >> You can give/assign a name to a task the way you like by using >> predefined package Ada.Task_Attributes. In this case you most >> likely instantiate it with String subtype. Therefore, it is will >> be completely portable. > > And (drumroll...) how would that look? Here is how a task name is consistently implemented across different compilers. By the way, this is a complete running program. with Ada.Exceptions; with Ada.Text_Io; with Ada.Task_Attributes; with Ada.Task_Identification; with GNAT.Traceback.Symbolic; use Ada; procedure Task_Name_Test is use Text_Io; type Name is access String; Default_Name : constant Name := new String'("Generic task name"); Package Task_Manager is new Task_Attributes (Name, Default_Name); task Gentleman is entry Hello; entry Goodbye; end Gentleman; task body Gentleman is begin accept Hello; Put_Line ("My name is " & Task_Manager.Value (Task_Identification.Current_Task).all & ". It's my pleasure to meeting you"); accept Goodbye; Put_Line ("Hopefully, we will meet again in the future."); end Gentleman; Gentleman_Name : Name := new String'("Gentleman"); begin Put_Line ("Task_Name_Test starts"); Task_Manager.Set_Value (Val => Gentleman_Name, T => Gentleman'Identity); Gentleman.Hello; Gentleman.Goodbye; Put_Line ("Task_Name_Test starts"); exception when Err : others => Put_Line (Exceptions.Exception_Name(Err) & " was raised"); Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback(Err)); end Task_Name_Test; Once again, it is about task name. If it is not, it should not belong here. Anh Vo.