
Right, I fixed that now. BTW, order of vector elements should be of no impact I guess (would make equals awkward to use...) Andre. Quoting [Graeme Pound] (Mar 01 2006):
Date: Wed, 01 Mar 2006 12:34:21 +0000 From: Graeme Pound <G.E.POUND@soton.ac.uk> To: Andre Merzky <andre@merzky.net> CC: SAGA RG <saga-rg@ggf.org> Subject: Re: [saga-rg] 1.4 version of the spec
Andre,
#2 The introspection added to the saga.Attribute interface further confuses the issues surrounding vector and "scalar" attributes. There are genuine use cases for vector attributes; for example in the JobDefintion class.
However in the strawman the introspection is separated for vector and "scalar" attributes, list_attributes() returns a single unified list of attribute names, and there is no defined behaviour if a vector attribute is requested via get_attribute() or visa versa. This solution is awkward.
An alternative solution is to allow any attribute to be returned via get_attribute() and get_vector_attribute(); this is simple since all values are strings, a vector returned by get_attribute() be delimited by comas or parentheses. Then a single has_attribute() methods would be sufficient, and an additional is_vector() method would be useful.
I don't like the dstinction vector/scalar either, it is confusing. If we would not have the (very valid) use cases... ;-)
Problem with the approach you propose is that, whatever delimiter you choose, you'll step on somebodies toes. I think space limited is kind of useful, or komma, as the result is at easily human readable... -
It might be worth to have both versions:
- separate setters/getters for scalar/vector attribs - scalar attrib with vector getter -> list with one element - vector attrib with scalar getter -> space limited string - scalar attrib with vector setter -> set to space limited string - vector attrib with scalar setter -> set to list with one element Well, I say space limited - but see above, no good idea.
is_vector sounds indeed useful, simplifies the inspection.
The behaviour of the equals() method is also ill-defined when called against a vector attribute. The problem would go away if a delimiter is defined by the strawman for a string representation of vector attributes.
Graeme
-- "So much time, so little to do..." -- Garfield