[Rock-dev] Proposed solutions (so far) to the property settings pitfalls

Janosch Machowinski Janosch.Machowinski at dfki.de
Wed Feb 9 10:00:27 CET 2011


On 09.02.2011 09:57, Janosch Machowinski wrote:
> I dislike 3 as it is the most unintuitive API I can think of.
Uhm 3 is ok, for some reason I thought one was forced to use the
do block for updating.

> I would like 0 if it just raises in the problematic case.
>
> I would a variation of 2 with config.get() / config.set()
> as it would be closest to the way properties are accessed
> from the c++ side and thus more intuitive.
>
>       Janosch
>
> On 07.02.2011 18:48, 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).
>


-- 
  Dipl. Inf. Janosch Machowinski
  SAR-&  Sicherheitsrobotik

  DFKI Bremen
  Robotics Innovation Center
  Robert-Hooke-Straße 5
  28359 Bremen, Germany

  Phone: +49 (0)421 218-64100
  Fax:   +49 (0)421 218-64150
  E-Mail: robotik at dfki.de

  Weitere Informationen: http://www.dfki.de/robotik
  -----------------------------------------------------------------------
  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