[Issue 11837] String literals should convert to const(void)*

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 9 09:49:06 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11837



--- Comment #17 from Andrei Alexandrescu <andrei at erdani.com> 2014-03-09 09:48:56 PDT ---
(In reply to comment #15)
> (In reply to comment #14)
> > I agree it's an exception that "str" converts to const(char)* but not
> > subsequently to const(void)*. However, the conversion to char* is already a
> > known concession for the sake of C string APIs. I don't think we need to go all
> > the way into the rabbit hole. (Also the example is obscure.)
> > 
> 
> You seem to be saying it's not worth the effort to fix, if I understand
> correctly.  We've already spent a lot more time arguing about it than I spent
> fixing it, so I'd really like to know why you think preventing the fix is worth
> all this effort?

I'm saying we shouldn't have a compromise force others after it. Conversion to
untyped pointers is bad and should be avoided. So I'm arguing against what I
believe is a bad thing. Also the supporting examples are specious and
non-idiomatic D.

> > @yebblies sorry I'll close this and the pull request. Feel free to reopen if
> > you feel strongly about this.
> 
> The usual arguments for rejecting an enhancement are that it breaks existing
> code, or it complicates the language.  So far it seems this does neither, in
> fact it simplifies the language.

It makes the language worse.

> Just like Walter, you've failed to provide a single reason why this special
> case should exist.
> 
> I just can't accept that - it doesn't make any sense.
> 
> I appreciate you taking the time to look at this, but without any evidence that
> this is a bad change I think you are drawing the wrong conclusion.

Untyped pointers are bad. We are providing conversion to immutable(char)* as a
compromise. Please let's not make nice string literals implicitly convert all
the way down to void*. I'll leave it to you to close this.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list