The Status of Const

Justin Johansson no at spam.com
Thu Aug 12 19:39:57 PDT 2010


Nick Sabalausky wrote:
> "Justin Johansson" <no at spam.com> wrote in message 
> news:i424ac$27nb$1 at digitalmars.com...
>> Graham St Jack wrote:
>>> Is there any plan to introduce some way of having a mutable reference to 
>>> an immutable class object on the heap? Do others see this as a problem at 
>>> all?
>> For embedded microsystems (i.e. with ROM/RAM) this is a problem.  It
>> is a common use case to have a mutable reference (in RAM) to some
>> objects that reside in ROM.  Obviously anything in ROM is guaranteed
>> by hardware to be immutable.  So, yes, this is a problem in a
>> wider sense.
> 
> Would there every really be anything in ROM though that would be appropriate 
> as a class though, as opposed to, say, a struct? I've never heard of an 
> object with a vtable being stored in ROM. 
> 

Yes, well back in my embedded C++ days yes did so.  But just because I
did doesn't necessarily make it a common use case.  Strike 'common'
above and replace with 'valid.

Anyway, what about a mutable reference to an immutable struct (in ROM)?
Same argument.  Also there is no reason why vtables cannot be stored
in ROM along with code.

The only stuff to have in RAM is the mutable stuff! :-)




More information about the Digitalmars-d mailing list