[Rock-dev] Proposed solutions (so far) to the property settings pitfalls
Alexander Duda
Alexander.Duda at dfki.de
Tue Feb 8 00:11:02 CET 2011
I would not go for solution 0 or 1.
We had a lot of trouble with the way it is right now because new users are often trying to set the properties in a wrong way.
Sending half configured properties to the tasks is even worst because this can crash tasks which are not aware of.
I would prefer a combination between 2 and 3
-> getter and setter + a readonly value if someone tries to access a property directly.
The code block would be a nice optional way for setting properties.
Alex
Am 07.02.2011 um 18:48 schrieb Sylvain Joyeux:
> Proposed solutions
> ==================
> 0. make task.config.value = 10 transfer the updated property to the
> remote task
> 1. leaving it as it is
> 2. require people to use read/write (or get/set) methods to read and
> write the properties. For instance, it could look like
>
> p = task.read_config
> p.value = 10
> task.write_config(p)
>
> 3. make the returned values read-only and allow to provide a
> block to update
>
> task.config.value = 10 # will raise an exception
>
> # The following works
> p = task.config.dup
> p.value = 10
> task.config = p
>
> # and it is equivalent to
> task.config do |p|
> p.value = 10
> end # the property gets written at the end of the block
>
More information about the Rock-dev
mailing list