From owner-sc22wg5@open-std.org  Thu Nov 13 08:22:05 2008
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom7
Delivered-To: sc22wg5-dom7@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 69254CA343B; Thu, 13 Nov 2008 08:22:05 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from ns.nag-j.co.jp (218-42-159-107.cust.bit-drive.ne.jp [218.42.159.107])
	by www2.open-std.org (Postfix) with ESMTP id 69B07C178D9
	for <sc22wg5@open-std.org>; Thu, 13 Nov 2008 08:22:03 +0100 (CET)
Received: from 218-42-159-108.cust.bit-drive.ne.jp ([218.42.159.108] helo=[127.0.0.1])
	by ns.nag-j.co.jp with esmtp (Exim 4.50)
	id 1L0WWV-0002hQ-4u
	for sc22wg5@open-std.org; Thu, 13 Nov 2008 16:21:51 +0900
Message-ID: <491BD5A7.8020104@nag-j.co.jp>
Date: Thu, 13 Nov 2008 16:22:15 +0900
From: Malcolm Cohen <malcolm@nag-j.co.jp>
User-Agent: Thunderbird 3.0a1pre (Windows/2008022014)
MIME-Version: 1.0
To: WG5 <sc22wg5@open-std.org>
Subject: Re: (j3.2006) (SC22WG5.3667) [ukfortran] N1755: Request	for	new	features
 from MPI Forum
References: <49137AD3.1070402@lrz.de>	<20081111224927.8201CC178D9@www2.open-std.org>	<20081111234923.517C5C178D6@www2.open-std.org>	<20081112001017.26EB3C178D6@www2.open-std.org>	<20081112091351.6581CC178D9@www2.open-std.org> <491BCB6F.8040406@sun.com>
In-Reply-To: <491BCB6F.8040406@sun.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

J3 readers, please remember to change your reply to WG5 when it's a WG5 
message, otherwise it won't get through...

Robert Corbett wrote:
> N.M. Maclaren wrote:
>   
>> Aargh!  No!  C 'const'!  It has NOT been a success - in fact, to describe
>> it as a paving slab on the road to hell would be fair. [ Yes, I am referring
>> to the saying that the road to hell is paved with good intentions. ]
>>     
>
> The best example of that in Fortran 2003 is the PROTECTED attribute.
> A casual reader of the standard is likely to believe that a variable
> with the PROTECTED attribute cannot be modified outside of the module
> in which it is contained.  A careful reading and the interps that
> have been issued make it clear that PROTECTED is a promise made by
> the programmer that he doesn't modifiy the variable outside of the
> module
This is not correct;  to call it a "promise made by the programmer" is 
not even remotely accurate.

PROTECTED is subject to almost precisely the same restrictions in use, 
and the same pitfalls in the guarantees, as INTENT(IN) - it's not quite 
a guarantee because we actually wanted INTENT(IN) to be easy to use in a 
world that includes things like old procedure libraries that lack INTENT 
specs.  There are some subtle differences because one is a module 
variable and the other is a dummy variable, but those aside, almost 
exactly the same.

Now it could be argued that we were trying to be "too nice" to the 
casual programmer back in Fortran 8X design days, and that is a 
reasonable argument: there is a tension between ease of use and 
guaranteed safety here.  Perhaps we got that wrong (i.e. the guarantees 
are too weak).  I might (not?) disagree, but it's nearly 20 years too 
late for that debate though.

But if one accepts the INTENT(IN) facility with its minor warts, one 
cannot then argue against what we did for PROTECTED since that is not in 
practice any more open to abuse.

Cheers,
-- 
.....................Malcolm Cohen, Nihon NAG, Tokyo.


