Re: defining an arbitrary type in your newer Fortrans
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Tue, 28 Nov 2006 10:14:51 -0800
Ancient_Hacker <grg2@xxxxxxxxxxx> wrote:
Jan, I'm no fan of C, but "typedef" is (slightly) more than a #define,
there is a little bit of compiler intelligence. Not much, but enough
to (barely) do the job.
I don't see anything directly comparable in Fortran.
A typealias feature like this was proposed for f2003. Not only was it
proposed, it was accepted. I was even a fairly big fan of it for a
while. But I backed off and supported pulling it out of the drafts... as
did a majority. The main reason (anyway my main reason, and it seemed to
be the telling argument for many in my judgement) was that typealias
didn't do enough to actually achieve the stated objective.
Yes, it would be nice to be able to say HighPrecisionFloatingType (or
something a bit shorter :-)). I had some vision that this would allow
you to write code, the bulk of which was independent of whether this was
an alias for an intrinsic real kind or, on a machine that lacked native
support for enough precision, a derived type.
But the feature just doesn't come close to achieving that. As you say,
C's typedef has a slight bit more "intelligence", but it still isn't
really enough. I don't recall the list of things that don't work out,
but it was pretty long. Basically the feature completely fails in the
goal of looking like a separate type instead of like a macro with a few
small smarts.
Start with literal constants. I/O in general. Generic disambiguation.
And lots of other things.
I wanted this feature, but I couldn't even come close to seeing how to
make it actually work as other than an incomplete kludge. Might about as
well go the preprocessor route. The smarts thatmight be sad, as you do
above, to barely do the job in C, are not adequate to do it in Fortran.
I might elaborate on why I think there is a difference, but I'll steer
clear of that direction.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- Follow-Ups:
- Re: defining an arbitrary type in your newer Fortrans
- From: Ancient_Hacker
- Re: defining an arbitrary type in your newer Fortrans
- From: PJH
- Re: defining an arbitrary type in your newer Fortrans
- References:
- defining an arbitrary type in your newer Fortrans
- From: Ancient_Hacker
- Re: defining an arbitrary type in your newer Fortrans
- From: Jan Vorbrüggen
- Re: defining an arbitrary type in your newer Fortrans
- From: Ancient_Hacker
- defining an arbitrary type in your newer Fortrans
- Prev by Date: Re: defining an arbitrary type in your newer Fortrans
- Next by Date: Re: defining an arbitrary type in your newer Fortrans
- Previous by thread: Re: defining an arbitrary type in your newer Fortrans
- Next by thread: Re: defining an arbitrary type in your newer Fortrans
- Index(es):
Relevant Pages
|