opCall within with

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Mar 19 07:36:04 PDT 2009


On Thu, Mar 19, 2009 at 5:05 AM, Steve Teale
<steve.teale at britseyeview.com> wrote:
> YASQ - say I have
>
> class Glob
> {
>   int a;
>   this(int) { a = n; }
>   int opCall(int n) { return n*a; }
> }
>
> Glob g = new Glob(2);
> with (g)
> {
>   // should () have any special meaning here?
>   int n = (3);
> }

No.  Parenthesized expressions are not call expressions.

opCall, however, would be usable:

with(g)
{
    int n = opCall(3);
}



More information about the Digitalmars-d mailing list