Re: PUUser class>>descriptionFullName

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: PUUser class>>descriptionFullName

Lukas Renggli
Hi Damien,

> here is a description that can be found in Pier:
>
> PUUser class>>descriptionFullName
>    ^ MAStringDescription new
>        parameterName: 'full-name';
>        accessor: #fullName;
>        beReadonly;
>        beHidden;
>        yourself
>
>
> The write selector #fullName: (with the $:) is not defined in PUUser.
> It is probably not a problem, but I wanted to know if it would not be
> safer to write the following instead:

The description is read-only, so the write accessor is never used anyway.

> PUUser class>>descriptionFullName
>    ...
>        accessor: (MAAccessor read: #fullName);
>     ...
>
> what do you think?'

The #read: and #write constructor methods are leftovers from very old
Magritte versions. They should not be used any longer (and I removed
them just now). The accessors shouldn't know about readonly or not,
only if the object can be read and can be written (physically).

Thanks for pointing out.

Lukas

--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PUUser class>>descriptionFullName

Damien Cassou
On Tue, Sep 28, 2010 at 7:44 AM, Lukas Renggli <[hidden email]> wrote:
> The description is read-only, so the write accessor is never used anyway.

The problem is that the readonly attribute is used both to indicate
that it makes no sense to write (e.g., for the full name of PUUSer) or
that the data is immutable (such as for the name attribute of PUUser).
In my goal of persisting the pier wiki to text files, I have to
distinguish between both cases and for the second case, I need to be
able to write. Do you have a solution?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: PUUser class>>descriptionFullName

Lukas Renggli
On 28 September 2010 09:21, Damien Cassou <[hidden email]> wrote:
> On Tue, Sep 28, 2010 at 7:44 AM, Lukas Renggli <[hidden email]> wrote:
>> The description is read-only, so the write accessor is never used anyway.
>
> The problem is that the readonly attribute is used both to indicate
> that it makes no sense to write (e.g., for the full name of PUUSer) or
> that the data is immutable (such as for the name attribute of PUUser).
> In my goal of persisting the pier wiki to text files, I have to
> distinguish between both cases and for the second case, I need to be
> able to write. Do you have a solution?

In the case of #fullName this is a derived property, so it is
dynamically calculated from other properties and should not be saved.

In the case of #name this is a read-only property that should not be
changed after instantiation.

Looks like you need to extend the Magritte meta-model to contain such
additional information for persistency (e.g how to set a private
value). For example look at how this is done with the XML serializer
that Philippe wrote.

Lukas







>
> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> "Lambdas are relegated to relative obscurity until Java makes them
> popular by not having them." James Iry
>



--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki