comp.lang.ada
 help / color / mirror / Atom feed
From: "Chad R. Meiners" <crmeiners@hotmail.com>
Subject: Re: What evil would happen?
Date: Mon, 14 Jul 2003 13:44:26 -0400
Date: 2003-07-14T13:44:26-04:00	[thread overview]
Message-ID: <beuq6i$1a7v$1@msunews.cl.msu.edu> (raw)
In-Reply-To: o9s4hvofb2mtn8ga9ahf7uu530pfacald8@4ax.com


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:o9s4hvofb2mtn8ga9ahf7uu530pfacald8@4ax.com...
> On Sun, 13 Jul 2003 13:28:54 -0400, "Chad R. Meiners"
> <crmeiners@hotmail.com> wrote:
>
> >"Wojtek Narczynski" <wojtek@power.com.pl> wrote in message
> >news:5ad0dd8a.0307130417.41548778@posting.google.com...
> >> Preben Randhol <randhol+abuse@pvv.org> wrote in message
> >news:<slrnbh02sj.4kj.randhol+abuse@kiuk0152.chembio.ntnu.no>...
> >>
> >> > Well then functions with side effects should be more resonable
> >>
> >> "Functions" with side effects can only inject their side effect into
> >> where they have been hardcoded to.
> >This is wrong.  Function have the capability to randomly introduce side
> >effects just like any other section of code.
>
> So what is the point?

The point is that the statement was wrong.  It was a statement of fact.

> >>This is a serious limitation.
> >If it were true, I doubt it.  In my experience, functions are more useful
> >when they are pure.  Sure there are times when a function cannot be pure,
> >but sub-routine with a side-effect should be made a procedure in most
cases.
>
> It is also my view. But I see rather other consecuences from this:
>
> 1. All functions are pure. So no access parameters allowed, no access
> to global data from the body is allowed etc.
>
> 2. But procedures are allowed to have a result.
>
> This would be perfectly consistent and as safe as possible.

I prefer SPARK's rules on functions, but I think that we should just allow
in out parameters for our unpure functions since passing access parameters
can be ugly.  I really do not see the harm in allowing unpure functions
because good modularity usually nudges the programmer towards writing pure
functions.  However, when an exception is needed being able to write unpure
function should be straight forward and easy to detect at the specification
level.

> >In mathematics, functions only return single elements, which may be a
> >composite of some sort.
>
> In mathematics you can encapsulate all side effects in objects of
> unlimited complexity. It is not the case for programming languages.
> Especially ones with weak type inference capability.
True, I was only stating inspiration for using records to return multiple
values.

> ---
> Regards,
> Dmitry Kazakov
> www.dmitry-kazakov.de
-CRM





  reply	other threads:[~2003-07-14 17:44 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-11 19:51 What evil would happen? Wojtek Narczynski
2003-07-11 20:07 ` Hyman Rosen
2003-07-12 12:30   ` Wojtek Narczynski
2003-07-12 17:17     ` Martin Dowie
2003-07-13  1:46     ` Hyman Rosen
2003-07-13 15:29       ` Wojtek Narczynski
2003-07-11 20:08 ` chris.danx
2003-07-12  4:31   ` Nick Roberts
2003-07-12 12:26     ` Wojtek Narczynski
2003-07-12 12:39       ` Preben Randhol
2003-07-12 13:11         ` Larry Kilgallen
2003-07-12 13:22           ` Preben Randhol
2003-07-12 19:04             ` Larry Kilgallen
2003-07-14  8:43               ` Preben Randhol
2003-07-14 10:32                 ` Larry Kilgallen
2003-07-14 11:05                   ` Preben Randhol
2003-07-14 11:31                   ` Larry Kilgallen
     [not found]                   ` <slrnbh53ir.48d.Organization: LJK Software <zSeTW0M3CTPU@eisner.encompasserve.org>
2003-07-14 17:31                     ` Wojtek Narczynski
2003-07-13 15:26             ` Wojtek Narczynski
2003-07-13 17:28               ` Chad R. Meiners
2003-07-13 22:35                 ` Wojtek Narczynski
2003-07-14  0:06                   ` Chad R. Meiners
2003-07-13 22:36                 ` Wojtek Narczynski
2003-07-14  3:01                 ` Hyman Rosen
2003-07-14  4:41                   ` Chad R. Meiners
2003-07-14 23:32                   ` [ot] languages & academia was " chris.danx
2003-07-14  9:09                 ` Dmitry A. Kazakov
2003-07-14 17:44                   ` Chad R. Meiners [this message]
2003-07-14 18:15                     ` tmoran
2003-07-15  8:06                     ` Dmitry A. Kazakov
2003-07-11 21:26 ` Robert I. Eachus
2003-07-12 12:38   ` Wojtek Narczynski
2003-07-16  0:07     ` Robert I. Eachus
2003-07-16  8:11       ` Preben Randhol
2003-07-14 18:52 ` Randy Brukardt
2003-07-14 20:12   ` Hyman Rosen
2003-07-15  2:32   ` Alexander Kopilovitch
2003-07-15  8:19   ` Wojtek Narczynski
2003-07-15 17:33     ` Randy Brukardt
2003-07-16  0:22       ` Robert I. Eachus
2003-07-16  8:36       ` Dmitry A. Kazakov
2003-07-15  5:16 ` Kenneth Almquist
2003-07-15 11:31   ` Wojtek Narczynski
2003-07-18  8:23 ` Wojtek Narczynski
2003-07-18 14:45   ` Hyman Rosen
2003-07-19  0:55   ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
2003-07-11 23:04 Beard, Frank Randolph CIV
2003-07-12 12:46 ` Wojtek Narczynski
replies disabled

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