I have data in memory, and I want a function to take a part of
data for processing only. It will only read and won't change.
char[] importantData;
With Immutable,
void dataProcessor( string giveMeAllYourData ){}
dataProcessor( cast( immutable )( importantData[5 .. 14] ) );
With Const,
void dataProcessor( in char[] giveMeAllYourData ){}
dataProcessor( cast( const )( importantData[5 .. 14] ) );
(Code with const wasn't tested)
Which one is better? I didn't understand it very well in
http://dlang.org/const3.html this page.