const by default.
kris
foo at bar.com
Fri Jul 7 13:18:55 PDT 2006
Walter Bright wrote:
> kris wrote:
>
>> Er, that's great, but does it provide for const return-values?
>
>
> No, it does not.
Well, that's what's actually needed to tighten up the contractual
agreement between callee and caller. The 'inbound' cases /could/ be
handled purely via aggregates, given an immutable return-type. As such,
the latter would appear to be the base case. It would be nice to see the
'in' support, but it won't add any additional strength to the language.
>
>> You see, the above can be handled adequately via either struct or
>> class /right now/ ~ but their immutablity can quickly unravel when,
>> for example, exposing content via toString() or whatever. And please
>> don't suggest returning a .dup of the content instead.
>
>
> I've argued against the .dup method many times <g>.
Just a friendly reminder <g>
More information about the Digitalmars-d
mailing list