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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,cfb2002511b830ab X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.39.100 with SMTP id o4mr20173905pbk.0.1322397029259; Sun, 27 Nov 2011 04:30:29 -0800 (PST) Path: lh20ni23853pbb.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: Starter project: getopt_long in Ada Date: Sun, 27 Nov 2011 12:30:28 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <4ecfc4c4$0$6579$9b4e6d93@newsspool3.arcor-online.net> Mime-Version: 1.0 Injection-Date: Sun, 27 Nov 2011 12:30:28 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="Mda950WjNwNLAFOE7yJXQw"; logging-data="5352"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//226+Jr7XvFoeHFrMUxLK" User-Agent: slrn/0.9.9p1 (FreeBSD) Cancel-Lock: sha1:w5xIB+pDE2DkiQ9C9uZ5R2dgFXM= Xref: news1.google.com comp.lang.ada:19193 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Date: 2011-11-27T12:30:28+00:00 List-Id: Hello, On 2011-11-27, Yannick DuchĂȘne wrote: > I had the same question in my mind too. I am in favor of tagged type above > access to subprogram, but was thinking this was perhaps just a matter of > personal preferences. That does not answer to your question below, but just for clarification, don't really have a strong preference for access to subprograms over tagged types, but I do admit that my heavy C background makes have absolutely nothing against access types, especially access to subprograms (which are immune to most of access types problems like dangling stuff or leaks). It's just that I don't like at all having a tagged type for only one dispatching operation (and no obvious need for internal state). I have mixed feelings for two operations, but starting from three I do prefer grouping them in a tagged type. I didn't do that there for various human reasons, and I do regret it. Of course that's only when considering related operations. In another project that I will publish soon (still needs a bit of polishing), I use two access-to-subprograms, but they are really meant to be completely different sources (one creates tokens from input while the other outputs the token, and the whole point of the separation is to have different input-analysis and output-generation that can plugged together). So in that case, I count them as two independant single-operation cases. > Do someone know about some on-line papers talking in > deep about tagged types vs access to subprograms ? I don't know anything like that, and I would also be really interested in reading one (assuming it exists). My wild guess is that tagged types would need two dereferences while access to subprogram only one, but that might end up being optimized into the same thing, and it's probably too little a performance difference to matter in most situations. I guess tagged types are more readable than not null anonymous access to subprogram, due to the lower amount of text. For named access to subprogram, I don't expect much of a difference. Natasha