From: helvio on
On Oct 1, 1:59 am, nos...(a)see.signature (Richard Maine) wrote:

> I will continue to insist that
> this does not "rename" the function. This gives the function a generic
> name in addition to its specific one. That is not the same thing as
> renaming. It can seem similar on the surface in limited circumstances. I
> do see that you quoted "rename". I'm just emphasizing that the quotes
> are very much needed. I don't like referring to it that way because as
> soon as you do so, someone will ignore the quotes and think it really is
> a renaming... and then they will wonder why it doesn't work like they
> would expect.

Oh, that's true... I already knew that generic interfaces only give
you aliases for the original procedures, which can still be called by
their original names, but somehow I forgot that. So then it's very
different from the true renaming that happens with '=>' in USE
statements. So, if I understood everything correctly: I'm perfectly
allowed to construct a generic INTERFACE to a given MODULE PROCEDURE
(PROC1) inside another of the same scope (PROC2) -- modulo compiler
bugs --, but I cannot re-use its original name (PROC1) to any other
purpose than to call the very same procedure?

In fact, that sounds reasonable. But is there a fundamental reason why
truly renaming a procedure inside another of the same scope should not
be allowed by a compiler? Something like a generalized USE? I know
that it can't be done with actual compilers conforming the actual
standards, but is there any fundamental logical obstruction for it to
be a future standard feature of Fortran? This is just an academic
question, I just want to understand how the compiling works, for this
case.

-- helvio
From: Richard Maine on
helvio <helvio.vairinhos(a)googlemail.com> wrote:

> In fact, that sounds reasonable. But is there a fundamental reason why
> truly renaming a procedure inside another of the same scope should not
> be allowed by a compiler? Something like a generalized USE? I know
> that it can't be done with actual compilers conforming the actual
> standards, but is there any fundamental logical obstruction for it to
> be a future standard feature of Fortran? This is just an academic
> question, I just want to understand how the compiling works, for this
> case.

I can't think of any fundamental reason why there couldn't be such a
feature. I'm not a compiler writer, so I'm certainly not the one to say
definitively, but it doesn't even seem to me like it would necessarily
be particularly difficult. There is already a separate scope for names
in a module procedure. There are already ways that a name can be
"blocked" from host association into that scope. I don't see anything
here that seems like it would greatly upset existing ways of doing
things or introduce particularly new concepts.

That doesn't mean I think such a feature is particularly likely to come
about, though. I suspect it would be on the wrong end of a lot of the
tradeoffs for new features. There are always zillions of new features
that people are asking for, but there are finite resources to do them.
Plus, even if resources weren't an issue, adding every feature that
anyone asks for would make the language a huge mess that nobody could
fully understand. Some criticise it as being too much that way already.

So one tends to need to show fairly strong justification for new
features. That it might prove handy in a few special cases usually isn't
enough justification.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: Richard Maine on
helvio <helvio.vairinhos(a)googlemail.com> wrote:

> On Oct 1, 1:59 am, nos...(a)see.signature (Richard Maine) wrote:
>
> > I will continue to insist that
> > this does not "rename" the function.

> Oh, that's true... I already knew that generic interfaces only give
> you aliases for the original procedures, which can still be called by
> their original names, but somehow I forgot that.

It is more than that. A generic name is not just an alias. It is a
different kind of thing. There are places where you can use a specific
name, but you can't use the generic name. I already mentioned one: you
can't pass a generic as an actual argument. There are others.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
First  |  Prev  | 
Pages: 1 2 3 4
Prev: ENTRY statement
Next: Namelist/module-question