s-news
[Top] [All Lists]

Re: [S] scope rules

To: John Thaden <jjthaden@life.uams.edu>
Subject: Re: [S] scope rules
From: Jens Oehlschlaegel <oehl@Psyres-Stuttgart.DE>
Date: Thu, 25 Jun 1998 19:57:50 +0200 (MET DST)
Cc: S+ list <s-news@wubios.wustl.edu>
In-reply-to: <3.0.3.32.19980625115126.0070c8c4@life.uams.edu>
Sender: owner-s-news@wubios.wustl.edu

John,

in S+ no function has automatic access to any local variables of any
parent functions FOR SECURITY REASONS (except for objects in frames 0+1). 
The whole thing belongs to structured programming, the standard
programming paradigm (demonstrated in modula and pascal) before object
oriented programming became popular.

However, the idea is interesting: having a different behaviour if a
function is defined within another one. But since this nice idea was not
implemented into S+, I supppose nobody would dare to
change this, because this could affect the behaviour of hundreds of old
functions using their sub-functions as if those where defined outside. 

If you search old s-news for "Mark Bravington" you will encounter some
functions he suggested to allow for subfunctions which have access to
parent locals. As far as I remember, there was a lot of copying between
frames and one had to be careful with something, ...

Best regards


Jens Oehlschlaegel-Akiyoshi








On Thu, 25 Jun 1998, John Thaden wrote:

> Can anyone give me one advantage afforded by the following scope rule of S?
> 
> >Functions defined within functions do not have automatic access to
> > local variables of the parent.
> 
> Is this a historical relic?
> 
> Also, why doesn't a concept as important as scope have an entry in the
> index of either the S-Plus Programmer's Guide or the User's Guide?
> 
> John Thaden
> Department of Geriatrics
> University of Arkansas for Medical Sciences
> Little Rock, AR
> 
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message:  unsubscribe s-news
> 

--
Jens Oehlschlaegel-Akiyoshi
Psychologist/Statistician

CURRENT ADDRESS (until 12/98) | PERMANENT VIRTUAL ADDRESS
------------------------------------------------------------------------
                              | http://www.geocities.com/Tokyo/Bay/5663/
oehl@psyres-stuttgart.de      | oehl@geocities.com 
+49 711 6781-408 (phone)      |
+49 711 6876902    (fax)      |

Center for Psychotherapy Research |
Christian-Belser-Strasse 79a      |
D-70597 Stuttgart Germany         |

(general disclaimer)

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>