comp.lang.ada
 help / color / mirror / Atom feed
From: Natasha Kerensikova <lithiumcat@gmail.com>
Subject: Re: Starter project: getopt_long in Ada
Date: Sun, 27 Nov 2011 12:30:28 +0000 (UTC)
Date: 2011-11-27T12:30:28+00:00	[thread overview]
Message-ID: <slrnjd4bar.vl6.lithiumcat@sigil.instinctive.eu> (raw)
In-Reply-To: op.v5lityfgule2fv@douda-yannick

Hello,

On 2011-11-27, Yannick Duchêne <yannick_duchene@yahoo.fr> 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



  reply	other threads:[~2011-11-27 12:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-25 10:47 Starter project: getopt_long in Ada Natasha Kerensikova
2011-11-25 16:39 ` Georg Bauhaus
2011-11-26 18:13   ` Natasha Kerensikova
2011-11-26 20:47     ` Jeffrey Carter
2011-11-28 15:49     ` Georg Bauhaus
2011-11-28 17:18       ` Natasha Kerensikova
2011-11-27  8:21   ` Yannick Duchêne (Hibou57)
2011-11-27 12:30     ` Natasha Kerensikova [this message]
2011-11-27 15:11       ` Yannick Duchêne (Hibou57)
2011-11-28  8:21         ` Natasha Kerensikova
2011-11-28 13:02           ` Yannick Duchêne (Hibou57)
2011-11-27  8:05 ` Yannick Duchêne (Hibou57)
2011-11-27 12:39   ` Natasha Kerensikova
2011-11-27 14:52     ` Yannick Duchêne (Hibou57)
2011-11-27  8:09 ` Yannick Duchêne (Hibou57)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox