🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #308

Re: Can you nest subroutines in C?

#308
From: Marco Papa
Date: Sun, 02 Jul 1989 19:44
56 lines
3592 bytes
In article <4525@crash.cts.com> wade@pnet01.cts.com (Wade Bickel) writes:
>mwm@eris.berkeley.edu (Mike (I'll think of something yet) writes:
>>In article <4495@crash.cts.com> wade@pnet01.cts.com (Wade Bickel) writes:
>><        So far I have found nothing I could do in C that I could not do in
>><M2.  To me this is the test of a Language.
>>
>>You're not looking very hard. Please translate the following C
>>construct into M2:
>>	short main[] = {1, 2, 3} ;
>
>Sure,
>        main : ARRAY[0..2] OF INTEGER;
>        main[0] := 1; main[1] := 2; main[3] := 3;
>
>Pre-initialization is a nicety, not allowed in M2 because there is no way to
>type the data.  This is a restriction that I understand will be/has been
>lifted.  However, pre-initailization is not a conceptual tool.  It can always
>be translated to a series of assignments, or a number of other methods can
							  ^^^^^^^^^^^^^
>be used to init data.

C'mon. SURE you say. The answer is NO, you can't do it.  And the result of this
can be devastating for a large project.  M2 like Pascal REQUIRES you to write 
CODE to initialize all your variables that need initialization.  Think for 
example of all the menus in a program: you'll need one line of code (that
dereferences a pointer or accesses a field) for EACH field in EACH of the 
Menu item. If you have ever seen a "large" PASCAL program there is ALWAYS a 
HUGE file with all the initializations.  This is enough a reason to not make 
me consider M2 for any serious programming.  I can't understand how you
can call this a 'nicety'. Lack of it is just dreadful. The fact that MAYBE/
WILLBE/HAS BEEN/IT IS POSSIBLE that some M2 compilers allow pre-initialization
is irrelevant, because those programs will be totally 'unportable'. 

And what are the "number of other methods [that] can be used to init the data"
besides pre-initialization and assignement?

>PS:  Please, send me Email if you do not have a solution to the problem I
>        posted, i.e. a lack of the ability to nest subroutines in C.  I had
>        hoped it would be possible, and am quite dissapointed that it is not.
>        At this point I am more interested in how to introduce it into the
>        C language than arguing whether C is better or worse than M2.  How
>        do I make a request to the ANSI commitee?

Forget it. The ANSI committe has JUST approved the new ANSI C standard after
YEARS of debate.  You won't see ANY major change made to it for at least the
next 5 years (when something becomes an ANSI standard, it is ever more 
difficult to change).  Also note that "nested subroutines" were proposed and 
struck down during the process of standardization. Lattice was at the forefront
of the ANSI committe.  Maybe John Toebes VIII could enlighten us about why
this feature wasn't included.

-- Marco Papa 'Doc'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
"There's Alpha, Beta, Gamma, Diga and Caligari!" -- Rick Unland
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <18215@usc.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!pollux.usc.edu!papa
References: <4525@crash.cts.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!pollux.usc.edu!papa
From: papa@pollux.usc.edu (Marco Papa)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Can you nest subroutines in C?
Message-ID: <18215@usc.edu>
Date: 2 Jul 89 19:44:50 GMT
References: <4525@crash.cts.com>
Sender: news@usc.edu
Reply-To: papa@pollux.usc.edu (Marco Papa)
Organization: Felsina Software, Los Angeles, CA
Lines: 56