Extended Type Design.
Daniel Keep
daniel.keep.lists at gmail.com
Fri Mar 16 18:47:08 PDT 2007
Andrei Alexandrescu (See Website For Email) wrote:
> Derek Parnell wrote:
>> But you are saying that if I don't want 'final', I not
>> only have to avoid using 'final', I also have to put some of the phrase
>> (and I know I'll never remember which parts) in parenthesis. But wait ...
>> there's more. If I do want it to be 'final' all I have to do is not
>> use the
>> 'final' keyword. Am I getting this right?
>>
>> Is it not possible to make reading code simple?
>
> An intuition that I see reasonable is that const by default engulfs
> everything to its right:
>
> const char[] str = "Hi!"; // same as const(char[] str) = "Hi!";
>
> When it engulfs the symbol, it makes it immutable, hence final. So by
> putting the parens you limit const's power.
>
> But I'd be glad to drop this exception. I'm not sure what Walter and
> people who'll have to modify their code would say though.
> ...
> Andrei
$ dmd -v1
With the v1 switch, I don't need to rewrite my code if it's already
working and isn't being updated. And even if for some reason I do need
to rewrite my code, I'm more than happy to do it in this case, if it
gets us a sane, exception-free const system :)
Heck, with D being as easy to parse as it is, I imagine that it wouldn't
be terribly difficult for someone to write a source migration program;
IIRC, Python actually had one of these for a particular version that
broke several programs.
Yeah, it's going to catch some people, but D !is Cpp, and there will
always be things that are different. So long as these breaking changes
are for the better, I can't imagine any reasonable person would complain[1].
-- Daniel
[1]: Well, OK, they might complain anyway. But it's like how I could
complain that my plans of doing car maintenance-related stuff has been
ruined by this blasted wet weather!
Considering that, as a country, we really need this sort of wet weather
more often, and I know it, it's kinda an empty complaint :P
--
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list