Re: elements vs sets



Date view Thread view Subject view Author view

Jos Warmer (J.Warmer@klasse.nl)
Fri, 25 Feb 2000 15:20:36 +0100


Mark, You are right. In fact this makes a point for removing the 'asSequence' operation from OCL. The use can be replaced by the operation 'sortedBy(expression)', which is already included in OCL. 'sortedBy' is defined on Collection and results in a Sequence where an expression is used as the ordening criterion. This is a deterministic way of making a Sequence out of a Set or Bag. What do you think ? Jos At 02:36 PM 25-02-00 +0100, Mark Richters wrote: >Jos Warmer <J.Warmer@klasse.nl> writes: > >> Hello Perdita, >> >> At 11:05 AM 25-02-00 +0000, Perdita Stevens wrote: >> >Well, you could use mySet -> asSequence -> first; but I agree that OCL is >> >fundamentally broken in this respect. >> > >> The inclusion of a feature 'giveOneElement' for a Set (or Bag) in OCL has been >> discussed in the past. We have decided not to include this, because such a >> feature has undeterministic behavior. You request a random element from >> the set (Bag) and you cannot determine which element you get. >> Such undeterministic behavior was unwanted on OCL. Therefore it was not >> included. > >Actually, the expression "mySet -> asSequence -> first" is >undeterministic as well for sets with more than one element. > >Regards, >Mark >-- >Mark Richters (mr@informatik.uni-bremen.de) > > > >To remove yourself from this list please mail puml-list-request@cs.york.ac.uk >with a message containing the word "unsubscribe". > > > > _____________________________________________________ Klasse Objecten tel : +31 (0)35 6037646 Chalonhof 153 fax : +31 (0)35 6037647 3762 CT Soest email : J.Warmer@klasse.nl The Netherlands internet: http://www.klasse.nl


Date view Thread view Subject view Author view