|
"Eric N. Wilson" <doulos1@home.com> wrote: > > Having the service program manage storage and what have you for a li > of "objects". You could simulate Polymorphism and Encapsulation > which are the other two tenants of OO. Yes this is not ideal but I >just thought I would throw to see how well it stuck :-) > > You know two out of three aint bad :-) > > Oh and this could be VERY UGLY :-) Especially if you had the Service > Program/Object do methods to set/get every field. But you could have > an array of objects in memory and do who knows what to then and > treat them just like objects... Ahhh... so what you're suggesting (if I follow you) is that every global/static variable be kept in a seperate, dynamically allocated, memory location for each instance of each object... calling a "create_new_instance" (or similar) procedure to allocate new ones as needed, and assign them some sort of ID or handle so each call to the service program could know which "object" you're referring to? In that way, you could keep the memory seperate for each "instance" of the object that you need to deal with. Yes. That could get very ugly. But it'd probably work, which is pretty neat. Now, can you make it become threadsafe? :) > The question being can RPGLE simulate OO programming, and my answer > "yes in a limited fashion and with a lot of work". Is it worth it? > Depend on the person looking at the problem. Shoot we have all the > tools now to actually be able to write a compiler using just ILE-RPG > (specifically pointers and the ability to do recusion). This is yet > another project that sound too painful to implement :-) But it could > be done. A compiler? An intriguing idea! What would it compile the source into? MI? Could you actually make an executable *PGM object, without calling an IBM-supplied compiler, somewhere? (In which case, is your program really a compiler, or just a language converter?) An interpreter you could certainly do... You could make your own "Eric-BASIC" which would be interpreted by your RPG program, and other people could write programs in it... :) +--- | 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 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.