From malcolm@nag.co.uk  Wed Jul  9 13:04:03 1997
Received: from red.nag.co.uk (red.nag.co.uk [192.156.217.2]) by dkuug.dk (8.6.12/8.6.12) with SMTP id NAA05623 for <sc22wg5@dkuug.dk>; Wed, 9 Jul 1997 13:03:58 +0200
Received: from sedi8.nag.co.uk by red.nag.co.uk via SMTP (920330.SGI/920502.SGI)
	for sc22wg5@dkuug.dk id AA03412; Wed, 9 Jul 97 12:04:41 +0100
Received: by sedi8.nag.co.uk (920330.SGI/920502.SGI)
	for @red.nag.co.uk:sc22wg5@dkuug.dk id AA26054; Wed, 9 Jul 97 12:04:28 +0100
From: malcolm@nag.co.uk (Malcolm Cohen)
Message-Id: <9707091104.AA26054@sedi8.nag.co.uk>
Subject: Re: Varying string standard (actually ELEMENTAL constraints)
To: sc22wg5@dkuug.dk
Date: Wed, 9 Jul 1997 12:04:24 +0000 (BST)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1790      

re: dummy arguments of elemental procedures not allowed in specification
expressions (except as arguments to a few enquiry functions)

Lawrie Schonfelder said:
> Why was this constraint not phrased in terms of specification functions, in 
> fact why is this constraint needed at all?

As it happens, the intent of this constraint is indeed to scupper procedures
doing what you want to do...

The thought was that it might often be more efficient to compile an elemental
procedure into a special form where it took dope vectors for all the arguments
and traversed the array(s) within the procedure.  This means that the
procedure-call overhead would only be paid once per reference instead of once
per array element.  This optimisation is impossible if a dummy argument appears
in a specification expression, because its value may be different (and thus the
size of a local automatic array may be different) for each element of the dummy
array.  (Well ok, not quite impossible, but much more difficult and it no
longer yields such an improvement in performance).

In my opinion the constraint is a mistake - its removal would not (I believe)
impede the optimisation on those procedures which are currently legal, and even
if the "bad" procedures ran a bit slow it would be better than not running at
all!

In the CD ballot (I think it was - whatever was followed by the San Diego
meeting) the UK asked for this constraint to be removed; this request was
not acceded to, but the exception for the enquiry functions was added
(prior to this they were not even allowed when they were arguments to the
enquiry functions - and everyone agreed that this was unnecessary).

Cheers,
-- 
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
                           (malcolm@nag.co.uk)


