Phobos' std.conv.text functions
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 31 10:56:13 PDT 2015
On 08/31/2015 07:45 PM, H. S. Teoh via Digitalmars-d wrote:
> On Mon, Aug 31, 2015 at 07:40:24PM +0200, Timon Gehr via Digitalmars-d wrote:
>> On 08/31/2015 05:35 PM, H. S. Teoh via Digitalmars-d wrote:
> [...]
>> Also, the proposed rewrite does not fix the problem. (I haven't tested
>> it, but AFAIU, the following code is neither rejected by the pull, nor
>> does it print "123".)
>>
>> import std.stdio;
>>
>> void main(){
>> string text="123";
>> void foo(){
>> import std.conv;
>> writeln(text());
>> }
>> foo();
>> }
>>
>> (Also, essentially the same logic occurs in three distinct places in
>> the new code.)
>
> This code should *not* print "123", because text() is explicitly a
> function call, but the local variable 'text' is not a function.
>...
It's a typo, presumably caused by implicit good intentions. :o)
What I meant to write was this:
import std.stdio;
void main(){
string text="123";
void foo(){
import std.conv;
writeln(text);
}
foo();
}
More information about the Digitalmars-d
mailing list