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

Matthias Goldhoorn matthias.goldhoorn at dfki.de
Tue Feb 8 09:26:19 CET 2011


 From my Point i would prefer 3.
Because there is no change in api, and it's only an warning/error for 
people who use it wrong.

Matthias

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. Matthias Goldhoorn
  Unterwasserrobotik

  Hauptanschrift Standort Bremen:
  DFKI GmbH
  Robotics Innovation Center
  Robert-Hooke-Straße 5
  28359 Bremen, Germany

  Phone: +49 (0)421 178 45-4193
  Fax:   +49 (0)421 178 45-4150
  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