Re: [S] scope rules

Jens Oehlschlaegel (oehl@Psyres-Stuttgart.DE)
Thu, 25 Jun 1998 19:57:50 +0200 (MET DST)


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