const debacle
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Sun Apr 27 10:49:00 PDT 2008
Janice Caron wrote:
> I think I've got it.
>
...
>
> I honestly think this might be problem solved. But please, please,
> please chime in if I've got anything wrong.
Well, *DUH*!
Yes, your proposal looks safe and sound, and you managed to follow the
whole logical progression to reach this conclusion. But all of it was a
trail that had been walked before! Let me explain.
A mechanism exactly like yours has already been described in an academic
paper called Javari, about adding a transitive const system to Java
(http://groups.csail.mit.edu/pag/pubs/tschantz-refimmut-mengthesis.pdf).
The mechanism there is called "romaybe" (short for read-only maybe), and
is pretty much the same as yours. Quotes:
"romaybe, a syntactic convenience that reduces code duplication;"
"Javari provides the keyword romaybe to declare that a method should
be templated over the mutability of one or more formal parameters—that
is, the method should have different signatures in the mutable and
read-only types."
Nearly a year ago, someone posted the link to the Javari paper. A few
months later, when the const discussion was starting up and gaining
prominence, I mentioned, quote: "I would say reading it [the Javari
paper] should likely be mandatory for anyone who wants to venture
thinking and posting how the const system should work."
(http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=3880)
That's because the paper and the proposal genuinely look to be very well
written and thought out, well detailed, and having all the issues
considered. (unlike this other proposal:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4211070).
Hence my comments like, "I wish I had an euro every time someone posted
about something that had already been discussed and concluded in Javari."
Now, you weren't yet in the D NG when Javari was mentioned, so I'm not
disparaging you about all of this. In fact, it's a good sign that you
reached the same conclusion as the one mentioned in the paper.
What is really annoying me, is that Walter (and Andrei), the masters
behind D's language design, seem to be utterly ignoring such a good
repository of knowledge and technical wisdom. They seem to be designing
const with more of a gun-ho attitude, without carefully considering all
aspects. That's why we had like 3 or 4 versions of const so far, and
frankly, unlike Walter, I don't think the current system has "mostly
been worked out". The 'inout'/'romaybe' is just one example of a kink,
but are many other aspects at fault. (more on that on another thread).
(BTW: the Javari paper also mentions logical const, and offers a
proposal very similar to your's 'unpaintable')
--
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list