Read-only array reference
BCS
BCS_member at pathlink.com
Sun Jul 9 15:49:57 PDT 2006
In article <e8pa25$1ud6$1 at digitaldaemon.com>, Hasan Aljudy says...
>
>Bruno Medeiros wrote:
[...]
>>
>> Plus, your proposal is omissive in many important aspects. For example,
>> how about the transitive property? If I have:
[...]
>you can do what you want with the array reference ..
>when ever you access an element of the array you're getting a copy of
>that element.
>if that element is a pointer, you're getting a copy of the pointer.
>if you don't want this to happen, don't frickin use pointers when you
>don't want others to manipulate your array!!
>
Ok, then how do you pass the common type of char[][] to a function?
Const more than one level deep is necessary in my mind.
I'd recommend that a const reference can't refer to a non const reference. It
has the advantage of being simple and easy to understand. Unless this has been
shown to not work, I think that it would be informative to try it for a while.
*Question for Walter*: How hard would it be to implement several const models,
in parallel (DMD ver 0.162a, 0.163b,...) This would let people try them and see
how well they work.
[...]
>
>I need to ask .. what did javari *really* add to java?
>Is there something that's impossible with java but possible with javari?
>
>no?
>I thought so.
Const doesn't make anything new possible, it makes things impossible, and that's
the point.
More information about the Digitalmars-d-learn
mailing list