2010/3/17 stephane ducasse <[email protected]>:
> in Squeak
>
>        (aDateAndTime offset: '0:12:00:00') =  '1901-01-01T00:00:00+12:00'
>        true
>
> in pharo
>
>        (aDateAndTime offset: '0:12:00:00') =  '1901-01-01T00:00:00+12:00'.
>        false.
>
> Apparently the false in pharo comes from a bug in readFrom: in DateAndTime
>
> Now the question is does it make sense to have a DateAndTime = to its string 
> representation.
> For me I would prefer not
>
>        (aDateAndTime offset: '0:12:00:00') =  '1901-01-01T00:00:00+12:00'
>        -> false
>        (aDateAndTime offset: '0:12:00:00') printString  =  
> '1901-01-01T00:00:00+12:00'
>        -> true
>
> DateAndTime>>= comparand
>        "comparand conforms to protocol DateAndTime,
>        or can be converted into something that conforms."
>        | comparandAsDateAndTime |
>        self == comparand
>                ifTrue: [^ true].
>        comparandAsDateAndTime := [comparand asDateAndTime]
>                on: MessageNotUnderstood
>                do: [^ false].
>        ^ self offset = comparandAsDateAndTime offset
>                ifTrue: [self hasEqualTicks: comparandAsDateAndTime ]
>                ifFalse: [self asUTC ticks = comparandAsDateAndTime asUTC 
> ticks]
>
>
> What do you think
>
>

I would expect = to be
"reflexive"       self assert: (a = a).
"symmetric"   self assert: (a = b) ==> (b = a).
"transitive"      self assert: (a = b) & (b = c) ==> (a = c).

Date>>= does not seem to meet my expectations

> Stef
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to