🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1134

Re: C++ already *has* nested functions SO WHAT'S THE BEEF?

#1134
From: David Chase
Date: Tue, 22 Dec 1992 00:49
60 lines
3048 bytes
rfg@netcom.com (Ronald F. Guilmette) writes:
>So what is it that people are complaining about?

>	o	[fake] nested functions ... cannot access `auto' and
>		`register' *objects* declared within a containing local
>		scope.  

>I believe that it is this last item that concerns people the most.

This is true.  The rest is all largely syntatic fluff.  Fluff is nice,
but that is not what people are asking for here.

> ... when I hear about
>all of these complicated schemes for supporting dynamic "up-level addressing"

It was easy.  We did it for Modula-3, two different ways.

>and also such things as "special" kinds of function pointers for holding
>pointers to nested function

This is not necessary at all.  See previous post for details on how to
avoid special function pointer representations for nested functions.

>(and a special new syntax for declaring such things) 

Not necessary.

>Haven't the implementors already got enough to do??  

Yes, we do.  On the other hand, if you look at in terms of costs and
benefits, especially in comparision to the rest of the language, this
is a relative win.  If you look at it in terms of percentage of total
work, this is also not a big deal.

>Can't people figure out how to simply pass any needed `auto' variables
>which are local to the containing function as additional actual
>argument to the nested (called) function on those very rare occasions
>when this is actually necessary??  I mean what the devil is the
>problem here?

You're not getting the picture here.  If I declare (to choose a common
and perhaps over-simple example) a bag-object with an iterator
interface that takes a function-to-be-applied-to-each as a parameter,
then it just takes a function, period.  It doesn't matter if it needs
0, 1, 2, or many pointers to auto variables passed to it.  This
simplifies the interface, and has the advantage of not adding clutter
(e.g., explicit state variables to be passed in and out of the
function) where it is not needed.

>I mean c'mon folks... This endless "featurism" has got to stop somewhere!

I agree, but I think we mean different things.  C++ has many features
that I still haven't figured out how to use, or even if they are in
fact useful.  It has many of other features that I put in the "plenty
of rope" category (be careful not to wrap it round your neck).  Nested
functions, I know how to use, and I know how they can be used to
simplify interfaces, and they are not especially "dangerous".

David Chase
Sun
Technical Details
Message-ID: <ljcpgiINNpdg@exodus.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!exodus.Eng.Sun.COM!rbbb.Eng.Sun.COM!chased
References: <1992Dec21.080952.15309@netcom.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!exodus.Eng.Sun.COM!rbbb.Eng.Sun.COM!chased
From: chased@rbbb.Eng.Sun.COM (David Chase)
Newsgroups: comp.std.c++
Subject: Re: C++ already *has* nested functions SO WHAT'S THE BEEF?
Date: 22 Dec 1992 00:49:22 GMT
Organization: Sun
Lines: 60
Message-ID: <ljcpgiINNpdg@exodus.Eng.Sun.COM>
References: <1992Dec21.080952.15309@netcom.com>
NNTP-Posting-Host: rbbb
Keywords: nested functions, dumb ideas