Conversation
|
Wouldn't it be nice if |
|
I believe that feature was removed at one point because of overloading problems. |
|
Yet you've never provided an example that has problems if the conversion is enabled. It was disabled long before the current polysemous string literal semantic, so I wouldn't be surprised if the problem doesn't exist any more. |
|
It was a looong time ago, and I don't remember the details or the arguments. I suggest that debate has nothing to do with this PR and should be in a DIP, the n.g. or an ER. |
edb3201 to
649d389
Compare
|
You mean like this? It has to do with this PR because it forces otherwise unnecessary use of |
|
I'm not mixing up changing the language behavior with refactoring the internals of the compiler. |
|
It wouldn't help anyway, since we need to be able to build with 2.067. I'm just still annoyed that it was dismissed for such vague and tenuous reasons. |
|
Oh, this one again.
I find myself now still agreeing with my 2 year junior self in that issue. If you're comparing strings, use strncmp. |
|
The overloading problem is simply that adding one more rule is one more trap for the unwary. Consider: void fun(const(void)*);
void fun(string);
void gun(string a)
{
fun(a);
}Now if through refactoring a changes to @yebblies It's great to demand proper justification of choices in language design. This one is a complete dud. I'll close the issue and please let's not play the game of reopening and re-closing etc. Conversion to
Now I completely understand how some would find the conversion from |
|
Auto-merge toggled on |
|
@andralex: Since you chose to respond here instead of on Bugzilla, I'll follow suite: The elephant in the room that you omit from your analysis is that |
|
I'm really starting to doubt that you understand the issue here. We already have the 'lossy' implicit conversion from string literals to
No, it doesn't. Try compiling this and see what happens: void fun(const(char)*);
void fun(string);
void gun(const(char)[] a)
{
fun(a);
}The conversion to
From that example, it really doesn't seem like you understand the proposed change. Maybe we're hitting the limits of text-based communication again? An executive decision should at the very least require that you understand the issue. |
|
@yebblies I'd forgotten since about your consistency argument, thanks. It had not been forgotten when the decision was taken, only during my rehash here. The consistency argument is good. It is duly noted. It does not influence the decision. One simple way to look at it is the real exception is the conversion of string literals to @klickverbot if we disabled conversion from |
|
@andralex: I agree, and didn't suggest that. What I'd do differently when starting with a clean slate is to
i.e. the string -> const(char)* part, not the const(char)* -> const(void)* one. |
|
@klickverbot agreed, prolly a trick too cute for its own good. |
|
The special case implicit string literal conversion to const(char)* is there in particular to support calling But I don't see such a pragmatic need to support converting to const(void)*, and yes, I read @yebblies' examples in the bugzilla issue he wrote. |
trivial refactor