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!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: 4 beginner's questions on the PL Ada Date: Fri, 09 Aug 2013 12:05:33 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: <87ob96ajv6.fsf@VLAN-3434.student.uu.se> <7a225028-f210-44c5-bd02-0d0eabaebc80@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 9 Aug 2013 19:05:35 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="da68e1c0dc00d4aa5d0283c494e3a17a"; logging-data="2288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+07LCKJ1DRd6YcVNBwPKJRPYaYbauVzOg=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <7a225028-f210-44c5-bd02-0d0eabaebc80@googlegroups.com> Cancel-Lock: sha1:2PrB+arkUhaijy4qqGwOoCu++fU= Xref: news.eternal-september.org comp.lang.ada:16734 Date: 2013-08-09T12:05:33-07:00 List-Id: On 08/09/2013 11:51 AM, Adam Beneschan wrote: > On Friday, August 9, 2013 11:29:31 AM UTC-7, Jeffrey Carter wrote: >> On 08/09/2013 09:50 AM, Emanuel Berg wrote: >> >>> 3. Is it possible to get the task *name* (from the code) into a string, >>> programatically? That way, a generic procedure could be used to >>> communicate from tasks, with Put_Line, and without having to hard code >>> the task name every time. >> >> It's possible to get a name using Ada.Tags.Expanded_Name. > > Unless he's declaring a tagged task type (which is possible only by deriving > it from an interface), there's nothing you can pass as a parameter to > Expanded_Name. If he's declaring a standalone task object (with an anonymous > type), then I don't think there's a way to do this even if the task is > derived from an interface. You can declare a tagged type T in the task, and pass T'Tag to Expanded_Name. The task "name" is embedded in the resulting string, and is easy to isolate. -- Jeff Carter "Well, a gala day is enough for me. I don't think I can handle any more." Duck Soup 93