Am 24.04.2013 12:29, schrieb Massimo Manghi: > Hi everybody > > I know form2.tcl is Harald's baby, so I won't be messing with it > without his opinion/approval > > I've been working with a few forms recently and I found myself creating > select input elements initialized with ordered lists of data associating > a key to a label to be displayed on the select > > I thought that having the whole set of value-label pairs in a dictionary > would be a safe and apt way to do this. It's easy, straightforward, I > don't see side-effects and it would provide a more concise way to > initialize it. We maybe could introduce a new switch > > formname select -dictionary $dict_value > > from which the whole set of configuration parameters could be deduced > (defaults would be passed in the constructor the way we do now) > > thoughts?
Well, my baby ;-) I just fixed bugs and security holes... I like dictionaries everywhere so I am in favour to that. Personally, I would prefer with a new start featuring: - a new load_variables which returns a dict and handles lists and scalars in a more beautiful way. I don't like the "__X"-members to indicate "X" be a list. - A rewrite of form2 which uses dicts everywhere and does not require incrtcl. The use of dicts will simplify all places where are arrays used so far... If a "dict-parameter way" is added, this adds an additional redundant parameter interface. What is the definition ? select wn -labels {L1 L2 L3} -values {V1 V2 V3} will use dict: set dP [dict create\ -labels {L1 L2 L3} \ -values {V1 V2 V3} ] and will be called: select wn -dictionary $dP which will be equivalent to: select wn {*}$dP Is this the idea ? Thank you, Harald --------------------------------------------------------------------- To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org For additional commands, e-mail: rivet-dev-h...@tcl.apache.org