|
Walden, There are restrictions on how you can use a CONST parameter. You cannot retrieve the address is one of them. Say I want to pass that constant to another routine and I don't know, or care what the type is. The strict type checking prevents me from passing it directly. So I have to pass the address which I can't retrieve. We use a lot of black-box functions that use CONST wherever possible. I would like to have the benefit of a CONST without the restrictions. I can simulate a protected memory space using authority, so why can't the compiler do it? The compiler has access to a lot lower level functions and could do this more efficiently. I agree that compile time checking is best. Saves time. The compiler could still return an error with a low severity if a line of code could potentially change a CONST variable. Similar to the way a CALLP to a procedure that returns a value that I don't need to use. I also agree the compiler should use the most optimal method possible. For example the compiler allows logical record blocking if certain conditions are met. You even get feedback from the compiler telling you when blocking can be used. You can use that feedback to tune your application if it is important to you. I would want the same type of feedback for constants if the implementation affected performance. Another alternative would be to create a new keyword. I don't care for CONST anyway. Something like PROTECTED. Thanks, David Morris >>> Walden Leverich <walden@techsoftinc.com> 07/22 8:07 AM >>> OK, I'll bite, why do you want the CONST parms protected "as if they had a debug WATCH ensuring they are not changed rather than having the compiler evaluate source statements"? It sounds to me like you are saying you want the checking done at runtime, not at compile time. Why? Compile time checking will find all errors when I have the code available to edit, runtime will only find it when the program blows up (hopefully in testing). Also, compiler based checking also allows some optimizations that may not be possible if the compiler can't assume the const-ness of the parameters. -Walden +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-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.