Hmm - about manifest/enum
Derek Parnell
derek at psych.ward
Sat Dec 29 19:05:59 PST 2007
On Sat, 29 Dec 2007 17:40:37 -0800, Walter Bright wrote:
Thank you for responding (N.B. That statement is truthful and not sarcasm)
> Derek Parnell wrote:
>> My problems with D2 revolve around the syntax you have chosen for us, and
>> the omissions in the 'const' paradigm
>
> I'm not sure what omissions you mean. The const scheme is pretty
> thorough end-to-end.
Does the scheme allow a mutable pointer to immutable data?
?? (const int)* p
Does the scheme allow an immutable pointer to mutable data?
?? (int *) const p
Does the scheme allow an immutable pointer to immutable data?
?? (const int)* const p
(and for completeness) Does the scheme allow a mutable pointer to mutable
data?
?? int *p
Can a mutable item become immutable at any time during the run time of an
application?
Can you take a mutable copy of any immutable item? And is the syntax to do
this dependant on the data type of the original?
Can you take a mutable copy of any immutable class object, struct or array?
And is the syntax to do this dependant on the data type of the original?
>> you have decided are acceptable for
>> us. Both of those, I foresee, will add to the cost of maintenance.
>
> It's difficult to tell what is right without using it for a while.
That idea does not apply to everything in life. I have not used cigarettes
but I know they are not right.
Also "goto" can be shown to increase the cost of program maintenance
without having to actually use it to demostrate this effect.
>> The D programming language already has too many over-used keywords and
>> poorly chosen keywords.
>
> Some have also argued that it has too many keywords, period.
I have not heard that comment from anyone.
>> The current decision to reuse 'enum' for manifest constants is yet another
>> example of a designer believing that their intuition is better than their
>> customers', regardless of any evidence to the contrary. Please reconsider
>> that there might be a remote possibility that this decision is actually
>> wrong in this case; 'enum' is not the best choice for developers when it
>> comes to declaring manifest constants.
>
> There are a number of people who strongly feel it is the correct
> decision who are not vocal about it.
If they are not vocal, how do you know about them? Can you give numbers?
>> And yes, after using it for awhile we will get used to it, but that is not
>> a reason for having it in the first place. We can get accustomed to the
>> wart on our partners' nose but it will always be a wart.
>>
>> The arguments to date for 'enum' boil down to (1) its easier to implement
>> given the current state of the D compiler,
>
> Actually it's easier to invent another keyword.
That is good news then.
>> (2) C++ sort of, kind of, uses it sometimes like that, and
>
> I brought up the C++ thing in the context of showing that enum is
> already routinely used for similar things.
And just like there are many of the bad things in C++ that have made it
into D, right? Oh hang on, that's why you started D, to rid us of the
misuse and insanity of some C++ idioms.
>> (3) you think its better than anything else.
>
> That's not really an argument as to why I think it's the best option <g>.
I know that. But it has been used anyway.
>> Could it be that your point of view is not always the same as the
>> developers' trying to use D?
>
> All I can say is try using it for a while. Give it a chance, and then
> see what you think. I initially got criticized a lot for using !( ) for
> templates rather than < >, but I think that time has shown it was a good
> decision.
Actually I think that both < > and !() suck big time.
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list