comp.lang.ada
 help / color / mirror / Atom feed
From: Stuart Palin <null@0.0>
Subject: Re: Ada to 'C' parameter passing problem
Date: Fri, 21 Feb 2003 09:53:15 +0000
Date: 2003-02-21T09:53:15+00:00	[thread overview]
Message-ID: <3E55F70B.A254EAF@0.0> (raw)
In-Reply-To: x7vr8a2k3qk.fsf@smaug.pushface.org

Simon Wright wrote:

> I recall Robert Dewar saying that he thought that restricting
> functions to "in" (or access) parameters was a Bad Idea -- Ada is a
> programming language, not a mathematical abstraction, and there is
> nothing in Ada to stop a function modifying global state. (Praise be,
> say I). But Robert got outvoted during the Ada 9X process.

I would think that there are [at least] a couple of
conflicting inputs to this.

1) By allowing functions to have side-effects you create
problems related to expression evaluation order - which
introduces an additional source of compiler dependencies.

2) Modifying global state is not prevented by the language
rules.  But this would be so difficult to do within the
constraints (or freedoms) of other language objectives
(principally the separate compilation of specification and
body and the hiding of internal behaviour.  Note that SPARK
addresses the issue of purity by ensuring the effect on
global state is made visible at the specification level).

Point 1 suggests it is a bad idea, point 2 shows the
language can not be entirely pure on this matter.

Would allowing function parameters to be in out/out be
encouraging a risky practice, or a recognition that the
language can not fully police the concept.

I favour the existing language rules which at least do not
'encourage' the risks that might arise through functions
with side-effects.

[RD does not usually make unconsidered statements, so I
would be interested in reading his line of arguments.  Is it
available somewhere convenient?]

--
Stuart Palin



  reply	other threads:[~2003-02-21  9:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-18 15:39 Ada to 'C' parameter passing problem Patrick
2003-02-18 16:47 ` Jeffrey Carter
2003-02-18 19:50 ` Rod Chapman
2003-02-20  2:36   ` Matthew Heaney
2003-02-20  9:18     ` Rod Chapman
2003-02-20  9:43       ` Dmitry A. Kazakov
2003-02-20 22:05       ` Simon Wright
2003-02-21  9:53         ` Stuart Palin [this message]
2003-02-21 17:39           ` Jeffrey Carter
2003-02-21 18:12           ` Warren W. Gay VE3WWG
2003-02-21 20:25           ` Randy Brukardt
2003-02-24 23:53       ` Matthew Heaney
2003-02-25 17:21         ` Rod Chapman
  -- strict thread matches above, loose matches on Subject: below --
2003-02-21 16:52 Lionel.DRAGHI
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox