with() statement doesn't want to work with property functions
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sun Sep 18 08:14:23 PDT 2011
struct Bar { int x; }
struct Foo
{
Bar _bar;
Bar bar()
{
return _bar;
}
}
void main()
{
Foo foo;
with (foo.bar)
{
}
}
Error: foo.bar() is not an lvalue
I've made a getter because I want to control how _bar is manipulated.
I've lost the ability to use the with statement, which is a minor
inconvenience. Is there a specific reason why with() should not be
allowed to be used with property functions?
This works fine:
immutable Foo foo;
with (foo)
{
}
So I don't see why it shouldn't work on property functions?
More information about the Digitalmars-d-learn
mailing list