conv text and pure

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Oct 23 17:15:30 PDT 2013


On Thu, Oct 24, 2013 at 12:12:48AM +0200, Daniel Davidson wrote:
> On Wednesday, 23 October 2013 at 21:37:25 UTC, H. S. Teoh wrote:
> >On Wed, Oct 23, 2013 at 11:17:30PM +0200, Daniel Davidson wrote:
[...]
> >>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
> >
> >No, pure can't be specified as a block. You can only mark a function
> >as pure.
> >
> 
> I think that is not correct. Consider:
> 
> int x = 3;
> struct S {
>   pure {
>     void foo() {
>       //x = 4;
>     }
>   }
> }
> 
> pure blocks seem to have the effect you would expect. In fact it
> seems like you can stream them together to make code more pleasant:
> 
> const pure ... { ... }

You're right. I didn't make myself clear: pure blocks are allowed but
not inside a function, i.e., this isn't supported currently:

	void foo() {
		pure {
			...
		}
		...
	}

My bad.


[...]
> Here is the self-contained code (I hope) that you can see it
> happening in:
> http://pastebin.com/hb0Dz50r
> 
> BTW: any and all constructive criticism on any aspect of code is
> welcome.
[...]

Thanks! Sorry I have to run now; I'll take a look at your code later,
and perhaps try to track down the source of the purity error.


T

-- 
"I suspect the best way to deal with procrastination is to put off the
procrastination itself until later. I've been meaning to try this, but
haven't gotten around to it yet. " -- swr


More information about the Digitalmars-d-learn mailing list