Am 05.08.2015 um 11:42 schrieb Iwan Vosloo <iwan@reahl.org>:

On 05/08/2015 11:14, Norbert Hartl wrote:

Am 05.08.2015 um 10:58 schrieb Iwan Vosloo <iwan@reahl.org>:

Thanks, Norbert. I get that, but when you do, for example:

aComponent := anObject asComponent.

then aComponent holds onto the description created above (in asComponent's implementation), as I understand it.
This means that as long as aComponent exists, it will always refer to the same description.

Is that understanding correct?

I think that is correct. I don't use magritte much lately so my memory is slightly blurry. I need to give a more precise answer to the instance side description. A description can alter in two ways. Either the shape/class of the description changes when accessed multiple times. I think this is a not so likely thing to happen. The other way would be if the data in the description changes because the object changed. So a multiple option description can update the list of options while the descriptions stay the same. And that is one thing you gain with Magritte3 because you can have descriptions with dynamic data that has access to the instance.


Thanks Norbert, I have to ask stupid questions because I realise I am sometimes struggling for lack of understanding some fundamental concepts.

These are no stupid questions. Just go ahead. The only thing that can happen is that we all learn something.

I think I understand how some of the data displayed by a component can change during the lifetime of the component. For example, a MAElementDescriptionComponent>>value will just use the accessor set on the description, so that is quite dynamic. But what I am struggling with is things like setting visibility of a description. For example I could have the following on the instance side of my object:

descriptionNumber
  ^ MANumberDescription new
         selectorAccessor: #number;
         visible: self mayBeSeen;
         yourself

... with the assumption that mayBeSeen is a method on my object that might return a different result during the lifetime of aComponent in my example above.


But it seems that visible: can only take a Boolean, which the description then retains for the lifetime of the description. The description in turn lives as long as the MAContainerComponent stays alive. So, I don't really understand how one can change the contents of the MAContainerComponent based on something like visible: on the description.  (I thought magritteDynamicObject could help here, but magritteDynamicObject is deprecated in Magritte3.)

I'm not sure I can give a good answer to this. And I'm not sure it is a feasible use case to have visibility fully dynamic. Usually you create a component and the visibility of the elements should be defined by then. 
Moving stuff to the instance side opened the possibility to have more dynamic stuff that can access the instance but there is surely a lack of support for things like the one you describe. So not everything can be used dynamically. We need to decide which of these things need to be integrated into magritte.

Can you describe a more detailled use case why you would want to have dynamic visibility of elements?  

Norbert