From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: First and Next vs Has_Element
Date: Thu, 17 Nov 2016 15:43:27 -0600
Date: 2016-11-17T15:43:27-06:00 [thread overview]
Message-ID: <o0l88e$q6h$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: o0kf8e$pct$1@gioia.aioe.org
"Victor Porton" <porton@narod.ru> wrote in message
news:o0kf8e$pct$1@gioia.aioe.org...
> Why in "5.5.1 User-Defined Iterator Types" First and Next are regular
> routines but Has_Element is generic formal parameter?
Has_Element is strictly a function of the Cursor type (it serves the same
purpose as comparing a pointer to null). First and Next are functions of the
iterator - that is the state of the iterator can have an effect on their
results. (Typically, in fact, the iterator will contain a reference to the
container being iterated, so such state is necessary).
We could have included Has_Element in the interfaces, but that would have
been artifical, as it should not reference the iterator state at all.
Note that there aren't any "regular routines" here; First and Next are
abstract routines that have to be implemented by the type derived from the
interface.
Also, as a practical matter, we wanted the Has_Element here to match the
profile of the one in each of the container's packages. And those only take
a cursor parameter.
Randy.
prev parent reply other threads:[~2016-11-17 21:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-17 14:35 First and Next vs Has_Element Victor Porton
2016-11-17 21:43 ` Randy Brukardt [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox