Hmm - about manifest/enum
Derek Parnell
derek at psych.ward
Sat Dec 29 15:30:50 PST 2007
On Sat, 29 Dec 2007 11:39:14 -0800, Walter Bright wrote:
> Derek Parnell wrote:
>> So I guess its not a necessary requirement but it is a nice thing to have,
>> so we can lower the cost of developing acceptable applications.
>
> Constness has 2 main uses:
>
> 1) Better specification of an API. This is of little import for smaller
> projects or projects done by a very small team. It becomes important for
> large projects worked on by diverse teams. It essentially makes explicit
> what things a function can be expected to change, and what things it
> won't change.
In short, improved "documentation".
> 2) It makes functional programming possible. The plum FP gets us is it
> opens the door to automatic parallelization of code! C++ and Java are
> dead in the water when it comes to automatic parallelization - if there
> are multiple cores, the app needs to be painfully and carefully recoded
> to take advantage of them. With FP, this can be done automatically.
This sounds like your real underlying goal; to enable people to use D for
FP.
> Some secondary advantages are:
>
> 3) Better optimization.
>
> 4) ROMable data.
>
> What languages we use definitely shape our thinking about programming.
> C++ ... (2). Java ...
I use neither. The languages I do use don't have much of a 'const'
implementation and that has been a factor in the higher-than-acceptable
cost of maintenance. I have long been sold on the benefits of being able to
specify what and when data is immutable. You and I don't have an issue
there.
My problems with D2 revolve around the syntax you have chosen for us, and
the omissions in the 'const' paradigm you have decided are acceptable for
us. Both of those, I foresee, will add to the cost of maintenance.
The D programming language already has too many over-used keywords and
poorly chosen keywords.
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.
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, (2) C++ sort of, kind of, uses
it sometimes like that, and (3) you think its better than anything else.
Could it be that your point of view is not always the same as the
developers' trying to use D?
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list