× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Scope of variables and subprocedures.
  • From: Colin Williams <Williamsc@xxxxxxxxxxxxxxxxx>
  • Date: Mon, 13 Dec 1999 16:34:01 -0000

Barbara,  what other things that you think RPG needs, out of interest?

>-----Original Message-----
>From: bmorris@ca.ibm.com [mailto:bmorris@ca.ibm.com]
>Sent: Monday, December 13, 1999 3:59 PM
>To: RPG400-L@midrange.com
>Subject: Scope of variables and subprocedures.
>
>
>
>
>
>>Date: Sat, 11 Dec 1999 20:56:26 -0700
>>From: Alan Campin <Alan.Campin@CaseLogic.com>
>>
>>The problem concerns the scope of variables. In language like "C" or
>"Java"
>>or "Pascal", I can do the following:
>> ... example of nested subprocedures
>> ...
>> To get around this, I have three choices that I can see.
>>
>> 1. Pass every variable needed by anyone of the procedures to each
>> procedure.
>> ...
>> 2. Make any variable needed by different subprocedures global.
>> ...
>> 3. Use subroutines.
>> ...
>
>Alan, you are right that you can do this in Pascal, but 
>neither C nor Java
>supports nested procedures.  It's true that you can sort of do 
>this in Java
>with nested classes. C and Java do allow you to have variables 
>scoped to a
>block within a procedure, but the block isn't callable from within the
>procedure.
>
>I realize that C's deficiency doesn't mean RPG isn't 
>deficient.  I agree
>that nested subprocedures would be nice to have, but I can't 
>say that it
>will happen in my "lifetime" since there are other things that 
>RPG needs
>that are more important (in my opinion anyway).
>
>One solution that you haven't mentioned is moving the procedure that
>requires nested subprocedures into another module, and making those
>variables global within that module, but not visible outside 
>the module.
>(Of course, this solution only works if the procedures don't need other
>global variables.)
>
>Barbara Morris, IBM Toronto Lab, RPG Compiler Development
>
>
>+---
>| This is the RPG/400 Mailing List!
>| To submit a new message, send your mail to RPG400-L@midrange.com.
>| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
>| To unsubscribe from this list send email to 
>RPG400-L-UNSUB@midrange.com.
>| Questions should be directed to the list owner/operator: 
>david@midrange.com
>+---
>
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.