www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - new DIP2: Const code bloat

reply Kagamin <spam here.lot> writes:
DiP2 is here. Check it.

http://www.prowiki.org/wiki4d/wiki.cgi?DiPs
http://www.prowiki.org/wiki4d/wiki.cgi?DiP2

ps code markup is not very nice.
Jul 09 2009
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Kagamin:
 DiP2 is here. Check it.
 http://www.prowiki.org/wiki4d/wiki.cgi?DiP2
It misses the Author field. Also an optional field for the suggested way to implement something can be positive. Bye, bearophile
Jul 09 2009
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Kagamin wrote:
 DiP2 is here. Check it.
 
 http://www.prowiki.org/wiki4d/wiki.cgi?DiPs
 http://www.prowiki.org/wiki4d/wiki.cgi?DiP2
Great start! Andrei
Jul 09 2009
prev sibling next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 09 Jul 2009 09:46:50 -0400, Kagamin <spam here.lot> wrote:

 DiP2 is here. Check it.

 http://www.prowiki.org/wiki4d/wiki.cgi?DiPs
 http://www.prowiki.org/wiki4d/wiki.cgi?DiP2

 ps code markup is not very nice.
Thanks for that! I updated the DiP to identify one other important problem that the solution solves: specifying that a function will not alter a parameter *during* the function but allows modification of the parameter through the return value (if the passed in value is mutable, of course). Please update if what I wrote is too confusing, it's hard to word properly... -Steve
Jul 09 2009
prev sibling next sibling parent reply Jason House <jason.james.house gmail.com> writes:
that's a great choice for DIP 2. it addresses the really old "return const"
issue. We know Walter at one time wanted to solve the issue and we have an
official record of Andrei saying it's technically sound. 

The sample usage should probably include temporary variables inside a function.

What are the next steps for this DIP?

Kagamin Wrote:

 DiP2 is here. Check it.
 
 http://www.prowiki.org/wiki4d/wiki.cgi?DiPs
 http://www.prowiki.org/wiki4d/wiki.cgi?DiP2
 
 ps code markup is not very nice.
Jul 09 2009
parent Kagamin <spam here.lot> writes:
Jason House Wrote:

 What are the next steps for this DIP?
 
Added migration notes.
Jul 10 2009
prev sibling next sibling parent Kagamin <spam here.lot> writes:
bearophile Wrote:

 Also an optional field for the suggested way to implement something can be
positive.
I'm not sure it's an implementation, described it as design details.
Jul 10 2009
prev sibling parent reply Leandro Lucarella <llucax gmail.com> writes:
Kagamin, el  9 de julio a las 09:46 me escribiste:
 DiP2 is here. Check it.
 
 http://www.prowiki.org/wiki4d/wiki.cgi?DiPs
 http://www.prowiki.org/wiki4d/wiki.cgi?DiP2
 
 ps code markup is not very nice.
It would be very nice if you include at least the abstract in the mail, so it's easier to discuss the DIP here. And as bearophile pointed, the DIP is missing the author. I think a DIP can't be taken very seriously without an author. I think a DIP author should be committed to maintain the DIP (this doesn't mean that other people can't update it) and do the requested changes to make the DIP move forward to its acceptance. As for the DIP itself, I didn't used the const system in D2 yet, so I can't give a good opinion, but I think that adding a new kind of pseudo-constness can be a little bloat. Of course, having to copy the same code 3 times is much worse, so if nobody has a better solution for the problem, I guess I can live with it =) -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- All men are born equal But quite a few get over it
Jul 14 2009
parent reply Bill Baxter <wbaxter gmail.com> writes:
On Tue, Jul 14, 2009 at 7:26 AM, Leandro Lucarella<llucax gmail.com> wrote:
 Kagamin, el =A09 de julio a las 09:46 me escribiste:
 DiP2 is here. Check it.

 http://www.prowiki.org/wiki4d/wiki.cgi?DiPs
 http://www.prowiki.org/wiki4d/wiki.cgi?DiP2

 ps code markup is not very nice.
It would be very nice if you include at least the abstract in the mail, s=
o
 it's easier to discuss the DIP here.

 And as bearophile pointed, the DIP is missing the author. I think a DIP
 can't be taken very seriously without an author. I think a DIP author
 should be committed to maintain the DIP (this doesn't mean that other
 people can't update it) and do the requested changes to make the DIP move
 forward to its acceptance.

 As for the DIP itself, I didn't used the const system in D2 yet, so
 I can't give a good opinion, but I think that adding a new kind of
 pseudo-constness can be a little bloat. Of course, having to copy the sam=
e
 code 3 times is much worse, so if nobody has a better solution for the
 problem, I guess I can live with it =3D)
I have to say I read the previous proposals when they were proposed here on the newsgroup, but when I saw the DIP just using a new keyword "vconst" instead of "inout" it looked soooooo much more readable to me. Might just be me, but I think my brain had a hard time convincing my eyes that inout had anything to with const. --bb
Jul 14 2009
parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Tue, 14 Jul 2009 12:37:47 -0400, Bill Baxter <wbaxter gmail.com> wrote:

 On Tue, Jul 14, 2009 at 7:26 AM, Leandro Lucarella<llucax gmail.com>  
 wrote:
 Kagamin, el  9 de julio a las 09:46 me escribiste:
 DiP2 is here. Check it.

 http://www.prowiki.org/wiki4d/wiki.cgi?DiPs
 http://www.prowiki.org/wiki4d/wiki.cgi?DiP2

 ps code markup is not very nice.
It would be very nice if you include at least the abstract in the mail, so it's easier to discuss the DIP here. And as bearophile pointed, the DIP is missing the author. I think a DIP can't be taken very seriously without an author. I think a DIP author should be committed to maintain the DIP (this doesn't mean that other people can't update it) and do the requested changes to make the DIP move forward to its acceptance. As for the DIP itself, I didn't used the const system in D2 yet, so I can't give a good opinion, but I think that adding a new kind of pseudo-constness can be a little bloat. Of course, having to copy the same code 3 times is much worse, so if nobody has a better solution for the problem, I guess I can live with it =)
I have to say I read the previous proposals when they were proposed here on the newsgroup, but when I saw the DIP just using a new keyword "vconst" instead of "inout" it looked soooooo much more readable to me. Might just be me, but I think my brain had a hard time convincing my eyes that inout had anything to with const.
Yeah, when I used inout, I was sort of trying to cut off some of the "oh no, not another keyword" objections. I tried my *hardest* to explicitly say that the keyword doesn't matter, the proposal still works with any keyword name, but it just doesn't work. People latch onto the keyword like flies on a bikeshed covered with, um.. stuff. I also had another alterior motive in that certain people who seemed to be influential with Walter liked the idea of using inout. I really couldn't care less what the keyword is, because no matter what it ends up being, it is much easier to deal with than writing N copies of a function, especially when the code is identical. -Steve
Jul 14 2009