Keisuke Miyako wrote:
>the question of course, is how do you know that an object field has been 
>changed?

If the objects field is to the left of “:=“, I think it’s fair to say it’s been 
changed.

Does anyone else find it funny (read: ridiculous) that assigning a value to a 
field (which changes the record) doesn’t update the dirty flag and save the 
record, but assigning a field to itself (which doesn’t change the record), does 
and is the recommended approach to get dot notation assignments to work?

It’s pretty much Database 101: if you update a value and save the record, the 
record should be updated on disk. Full stop. The 4D parser knows when a field 
is to the left of the assignment statement, so setting the dirty flag should be 
no big deal. Might there be times where it’s set when it shouldn’t be and 
performance would suffer slightly? Perhaps, but that’s a lot better than data 
loss.

An argument can also (successfully) be made that the developer should be 
testing their code and discovering this behavior, but this is still a bug and 
needs to be fixed.

At a minimum a notion should be added to the documentation that says something 
like “Dot notation can be used to assign values to fields, but it doesn’t 
really work, so assign the field to itself afterwards to have the record 
updated properly”.

Or something like that.

Regards,
Ben Kershaw
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to