[Rock-dev] Proposed solutions (so far) to the property settings pitfalls
Christopher Gaudig
christopher.gaudig at dfki.de
Mon Feb 7 19:24:10 CET 2011
I kinda like 0 and 1.
2 is acceptable, 3 is my least favorite, but then I don't use ruby a lot.
Christopher
On 02/07/2011 06:51 PM, Jakob Schwendner wrote:
> On 02/07/2011 06:48 PM, Sylvain Joyeux wrote:
>> The problem
>> ===========
>>
>> task.config.value = 10
>>
>> does *not* change the field "value" of property "config" on the task.
>> One has to do
>>
>> p = task.config
>> p.value = 10
>> task.config = p
>>
>> 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
>>
>> Thoughts ?
>>
>>
>> I personally don't like 0 as it involves having partial changes to the
>> configuration data structures (which might be very bad if the component
>> is currently running).
> I like 3. Wouldn't mind 0 from an API point of view (most intuitive).
> Dislike 2.
>
> Jakob
>
> _______________________________________________
> Rock-dev mailing list
> Rock-dev at dfki.de
> http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev
--
Christopher Gaudig
Underwater & Space Robotics
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0)421 178 45-4119
Fax: +49 (0)421 178 45-4150
E-Mail: christopher.gaudig at dfki.de
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
German Research Center for Artificial Intelligence
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/673/0060/3
More information about the Rock-dev
mailing list