Kagamin wrote:
Walter Bright Wrote:

The issue is what if b is a property, returns a temporary object, and that temp's .c field is uselessly set to 3?

It's a classic problem with properties that are implemented as functions.

Does this problem pertain to properties?
Look at this:

void main()
{
  int a=3;
}

Is "a" assigned usefully or uselessly? And what compiler says about it? And how 
did you determine that your example is useless? Did you check for destructors, 
invariants, copy constructors?

The code above is only loosely related. The code above contains a definition initiated by the user. The code a.b.c = 4 expresses the intent of a user to effect a change a field that can be accessed later through a.b.c, whereas with properties the code will in all likelihood not do that.

And do your question imply that functions are allowed to return temporaries 
while properties aren't?

The question is very simple: given that we're used with a specific semantics for a.b.c = 3, how can we address the fact that the semantics of this familiar operation is so different (and likely so useless) when properties replace fields?

And what's the difference if c is field or property?

It's b that's the problem.


Andrei

Reply via email to