Issue 1824 - Object not const correct #72

Merged
merged 6 commits into from Jul 9, 2012

Conversation

Projects
None yet
5 participants
@9rnsr
Member

9rnsr commented Sep 16, 2011

http://d.puremagic.com/issues/show_bug.cgi?id=1824
D-Programming-Language/dmd#387
D-Programming-Language#72
D-Programming-Language/phobos#262

  1. Change Object.opEquals, opCmp, toHash and toString to const member functions.
  2. Change using TypeInfo objects to const.
@yebblies

This comment has been minimized.

Show comment
Hide comment
@yebblies

yebblies Sep 18, 2011

Member

You're missing a const in a couple of opApply signatures: http://yebblies.com/results/dmd_387_9rnsr_constApply_druntimebuild.txt

Member

yebblies commented Sep 18, 2011

You're missing a const in a couple of opApply signatures: http://yebblies.com/results/dmd_387_9rnsr_constApply_druntimebuild.txt

@jmdavis

This comment has been minimized.

Show comment
Hide comment
@jmdavis

jmdavis Sep 18, 2011

Member

Personally, I'd argue that all of those consts should go after the functions that they're on. Putting them in front risks confusion, since then it looks like they're marking the return types and not the functions.

Member

jmdavis commented Sep 18, 2011

Personally, I'd argue that all of those consts should go after the functions that they're on. Putting them in front risks confusion, since then it looks like they're marking the return types and not the functions.

@jmdavis

This comment has been minimized.

Show comment
Hide comment
@jmdavis

jmdavis Sep 18, 2011

Member

Another thing to consider (though it shouldn't be dealt with in this pull request regardless) is whether some of Object's functions should be pure as well. I'm not sure if we can for sure or not, but their lack of purity could be a problem. If opEquals isn't pure, can objects be compared for equality within a pure function? And not being to use toString in a pure function could be really annoying (though as long as format isn't pure, there's no way that toString could be). To some extent, the problem is solved by the fact that you can override Object's functions with versions with stricter attributes, so as long as you do that and specifically use the derived type, then you should be okay. But if it's actually reasonably to require that functions such as toString be pure, then we should do it. The question though is whether that's reasonable or not. I should probably bring it up in the newsgroup. Regardless, it's not something that should be dealt with in this pull request.

Member

jmdavis commented Sep 18, 2011

Another thing to consider (though it shouldn't be dealt with in this pull request regardless) is whether some of Object's functions should be pure as well. I'm not sure if we can for sure or not, but their lack of purity could be a problem. If opEquals isn't pure, can objects be compared for equality within a pure function? And not being to use toString in a pure function could be really annoying (though as long as format isn't pure, there's no way that toString could be). To some extent, the problem is solved by the fact that you can override Object's functions with versions with stricter attributes, so as long as you do that and specifically use the derived type, then you should be okay. But if it's actually reasonably to require that functions such as toString be pure, then we should do it. The question though is whether that's reasonable or not. I should probably bring it up in the newsgroup. Regardless, it's not something that should be dealt with in this pull request.

@jmdavis

This comment has been minimized.

Show comment
Hide comment
@jmdavis

jmdavis Sep 25, 2011

Member

Another thing, we need to have non-const versions of Object's const functions, so that those who want caching and the like in those functions can have it with non-const objects.

And again, I would strongly argue that const should go after the functions and not before. It's bad enough that it's even legal D to put it in front. It's not something that we should be doing.

Member

jmdavis commented Sep 25, 2011

Another thing, we need to have non-const versions of Object's const functions, so that those who want caching and the like in those functions can have it with non-const objects.

And again, I would strongly argue that const should go after the functions and not before. It's bad enough that it's even legal D to put it in front. It's not something that we should be doing.

@9rnsr

This comment has been minimized.

Show comment
Hide comment
@9rnsr

9rnsr Sep 25, 2011

Member

Hmm, I had not focused so much that ambiguity, but also I can agree to your point.
OK. I'll fix it after a while.

Member

9rnsr commented Sep 25, 2011

Hmm, I had not focused so much that ambiguity, but also I can agree to your point.
OK. I'll fix it after a while.

@9rnsr

This comment has been minimized.

Show comment
Hide comment
@9rnsr

9rnsr Sep 29, 2011

Member

Change prefix const to suffix.
And add feature for opEquals migration. See discussion in D-Programming-Language/phobos#262

Member

9rnsr commented Sep 29, 2011

Change prefix const to suffix.
And add feature for opEquals migration. See discussion in D-Programming-Language/phobos#262

@9rnsr

This comment has been minimized.

Show comment
Hide comment
@9rnsr

9rnsr Oct 15, 2011

Member

Updated for interface and typedef'ed class/interface comparison for fixing issue 4088.

Member

9rnsr commented Oct 15, 2011

Updated for interface and typedef'ed class/interface comparison for fixing issue 4088.

@andralex

This comment has been minimized.

Show comment
Hide comment
@andralex

andralex Apr 21, 2012

Member

rebase? I'll also pull the Phobos request.

Member

andralex commented Apr 21, 2012

rebase? I'll also pull the Phobos request.

@9rnsr

This comment has been minimized.

Show comment
Hide comment
@9rnsr

9rnsr Apr 22, 2012

Member

Rebased.

Member

9rnsr commented Apr 22, 2012

Rebased.

@jmdavis

This comment has been minimized.

Show comment
Hide comment
@jmdavis

jmdavis Apr 28, 2012

Member

According to the pull tester, these changes are currently failing.

Member

jmdavis commented Apr 28, 2012

According to the pull tester, these changes are currently failing.

@ghost ghost assigned andralex Jul 8, 2012

@andralex

This comment has been minimized.

Show comment
Hide comment
@andralex

andralex Jul 8, 2012

Member

Yah, @9rnsr - this seems to be failing, and is out of sync again. Could you please take a look? I'll be back on this in a week if not earlier. Thanks!

Member

andralex commented Jul 8, 2012

Yah, @9rnsr - this seems to be failing, and is out of sync again. Could you please take a look? I'll be back on this in a week if not earlier. Thanks!

@9rnsr

This comment has been minimized.

Show comment
Hide comment
@9rnsr

9rnsr Jul 8, 2012

Member

OK. Rebased and fixed for git head.

Member

9rnsr commented Jul 8, 2012

OK. Rebased and fixed for git head.

@LightBender

This comment has been minimized.

Show comment
Hide comment
@LightBender

LightBender Jul 9, 2012

Contributor

@9rnsr, this needs another rebase, we've been doing merges all day and something got changed in object_.d

Contributor

LightBender commented Jul 9, 2012

@9rnsr, this needs another rebase, we've been doing merges all day and something got changed in object_.d

@9rnsr

This comment has been minimized.

Show comment
Hide comment
@9rnsr

9rnsr Jul 9, 2012

Member

Thanks for the info. Re-rebasing is done.

Member

9rnsr commented Jul 9, 2012

Thanks for the info. Re-rebasing is done.

andralex added a commit that referenced this pull request Jul 9, 2012

Merge pull request #72 from 9rnsr/constApply
Issue 1824 - Object not const correct

@andralex andralex merged commit d39bd49 into dlang:master Jul 9, 2012

JohanEngelen added a commit to weka-io/druntime that referenced this pull request Jul 7, 2016

Merge pull request #72 from tethyslab/solaris-stdio
Solaris: fix stdio issue for x64 OS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment