| Thread overview | ||||||||
|---|---|---|---|---|---|---|---|---|
|
March 19, 2009 opCall within with | ||||
|---|---|---|---|---|
| ||||
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);
}
| ||||
March 19, 2009 Re: opCall within with | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steve Teale | On Thu, 19 Mar 2009 10:05:59 +0100, Steve Teale <steve.teale@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);
> }
Glob g = new Glob(2);
with ( g ) {
int n = 2 * ( 3 + 4 );
}
If this sets my n to 28, Imma be pissed.
| |||
March 19, 2009 Re: opCall within with | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | Simen Kjaeraas Wrote:
> On Thu, 19 Mar 2009 10:05:59 +0100, Steve Teale <steve.teale@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);
> > }
>
> Glob g = new Glob(2);
> with ( g ) {
> int n = 2 * ( 3 + 4 );
> }
>
> If this sets my n to 28, Imma be pissed.
Err, well yes,silly question, what about ((3+4))? ;-)
| |||
March 19, 2009 Re: opCall within with | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steve Teale | On Thu, Mar 19, 2009 at 5:05 AM, Steve Teale <steve.teale@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);
}
| |||
March 19, 2009 Re: opCall within with | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Steve Teale | On Thu, Mar 19, 2009 at 10:41 AM, Steve Teale <steve.teale@britseyeview.com> wrote:
>
> Err, well yes,silly question, what about ((3+4))? ;-)
>
No! This is a stupid idea, sorry.
| |||
March 19, 2009 Re: opCall within with | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | Jarrett Billingsley Wrote:
> On Thu, Mar 19, 2009 at 10:41 AM, Steve Teale <steve.teale@britseyeview.com> wrote:
> >
> > Err, well yes,silly question, what about ((3+4))? ;-)
> >
>
> No! This is a stupid idea, sorry.
That's what ;-) meant. I just so wanted to write ((((((((12)))))))) == "sausage"
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply