conv text and pure

Ali Çehreli acehreli at yahoo.com
Wed Oct 23 14:35:56 PDT 2013


On 10/23/2013 02:17 PM, Daniel Davidson wrote:
> On Wednesday, 23 October 2013 at 20:18:39 UTC, Andrej Mitrovic wrote:
>> On 10/23/13, Daniel Davidson <nospam at spam.com> wrote:
>>> Great, thanks. What is the best way to get on that version for
>>> the Mac (pointer to instructions)?
>>
>> You can download the beta here:
>> http://forum.dlang.org/thread/52605C84.6010109@walterbright.com
>
> Thanks for pointer. I am using it and the file conv.d has:
>
> string text(T...)(T args) { return textImpl!string(args); }
>
>
> So, when you say it is pure, what are you referring to. I think pure
> could be specified as a block, but when I search up the next prior pure
> occurrence is:
>    @safe pure unittest
>
> So I don't think it is in a pure block. Also I still get:
>
> Error: pure function 'plus.utils.history.History!(const(S), "a.date <
> b.date").History.opOpAssign!("~", S).opOpAssign' cannot call impure
> function 'std.conv.text!(string, string, const(S), string, const(S)).text'
>
> So, I am still looking for workaround if possible and answers to the
> general questions on pure.
>
> Thanks
> Dan

Perhaps it missed the beta cut. The following compiles with git head (or 
at least with v2.064-devel-b12d171):

import std.conv;
import std.exception;

void foo(int i) pure
{
     enforce (i == 42, i.text);
}

void main()
{
     foo(42);
}

Ali



More information about the Digitalmars-d-learn mailing list