[Rock-dev] Proposed solutions (so far) to the property settings pitfalls
Sylvain Joyeux
sylvain.joyeux at dfki.de
Mon Feb 7 18:48:35 CET 2011
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).
--
Sylvain Joyeux (Dr.Ing.)
Space & Security Robotics
!!! Achtung, neue Telefonnummer!!!
Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Phone: +49 (0)421 178-454136
Fax: +49 (0)421 218-454150
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