Re: [gtkmvc-users] Logical container property triggers assertion failure
Brought to you by:
cavada
From: Philipp B. <ph...@hb...> - 2014-08-10 08:23:16
|
Hi Tobias (?) On 10.08.2014 03:45, to...@ce... wrote: > On 09.08.2014, at 18:56, Philipp Burch <ph...@hb...> wrote: > > Hi, > and thank you for your kind words. > >> Interesting is that the assertion failure is not triggered when I use a concrete property instead > > I don't think we can support notifications other than "assign" for logical properties. GTKMVC needs a better error message for that. > > Remember that in Python `m.someList.append(1)` means `tmp = m.someList; tmp.append(1)`. For concrete properties the model maintains a connection to the value it returns, so it can notify you of the "append" even though that line contains no m. > > Logical properties exist for calculated values, so GTKMVC must assume that the getter returns a different instance every time. Should the model track all of those? If append is called on two, should notifications go out in the order of the calls, or the order they were retrieved? > > Maybe we can find a solution depending on why you want to use logical properties. > Thanks for your quick response! Actually, I haven't thought about what it would mean for gtkmvc to support those notifications for complex logical properties. Thanks for pointing out the problem with all the new instances, that sounds sensible. Maybe the assertion could be replaced by an exception with a more detailed error message, but it would also help to see that limitation in the docs. Maybe I have overlooked it, but I really searched through the manual and did not find a hint about that. The reason I even tried to use a complex object in a logical property is because I wanted to have getters and setters for everything. But by letting a model observe itself, this should not be strictly necessary, so I guess I'll use concrete props unless I really have a calculated value and everything should be fine :) Best regards, Philipp |