"Ary Borenszweig" <[email protected]> wrote in message news:[email protected]... > >> So let's suppose we don't need to take an immutable varaible's address. >> We get rid of "enum" then and unify "immutable" and "enum" into the >> single "immutable" keyword. The compiler still has to determine what to >> put in ROM and what not. But I think this one is easy: primitive types >> can go in ROM, also maybe small immutable structs, maybe primitive >> arrays, but not classes or references to classes. > > Sorry, I wanted to write that the compiler can choose what things are > compile-time constants and what things should go into ROM. Primitives, > small structs, etc, should be compile-time constants.
For many embedded uses, you would need to have some way to be able to say "This must be in ROM" (and probably at a specific address) so that it can be accessed by more than just the firmware. Hmm, but then again, I suppose that would probably be better handled by a linker that supports embedding of resources. It's not a bad idea IMO. And you could even have an "optimize for size" setting that keeps all immutable types out of ROM (wherever possible) without the programmer needing to change code. I'd still want to keep "enum" for *real* enumerations, though.
