Date readFromString: Date today storeString....is it a bug?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Date readFromString: Date today storeString....is it a bug?

stéphane ducasse-2
Date readFromString: Date today storeString

raises an exception...


testReadFrom works so it is the idiom readFrom:/storeOn: that does  
not work anymore?

Stef

Reply | Threaded
Open this post in threaded view
|

RE: Date readFromString: Date today storeString....is it a bug?

Alan L. Lovejoy
Steph,

There is no convention that establishes a global invariant with respect to
the relationship between ("y := x printString" | "y := x storeString") and
"x class readFromString: y."  There is, however, a convention that
establishes a global invariant such that "y := x storeString" should be
reversible using "Compiler evaluate: y."

Many Smalltalk class libraries provide an implementation of #printString and
#storeString in Object that both produce the same result, and also implement
Object class>>readFromString: using "Compiler evaluate:". Consequently, "x
class readFromString: x storeString" may or may not evaluate to "x."

"Date readFromString: Date today storeString" produces an exception in
VisualWorks also. I would suggest that you try "Date readFromString: Date
today printString" instead.

--Alan

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of stéphane
ducasse
Sent: Monday, May 29, 2006 2:31 AM
To: The general-purpose Squeak developers list
Subject: Date readFromString: Date today storeString....is it a bug?

Date readFromString: Date today storeString

raises an exception...


testReadFrom works so it is the idiom readFrom:/storeOn: that does not work
anymore?

Stef



Reply | Threaded
Open this post in threaded view
|

RE: Date readFromString: Date today storeString....is it a bug?

Gary Chambers
In reply to this post by stéphane ducasse-2
Looking at it, the readFromString: expects a String and not a date, so

Date readFromString: Date today asString

works.

As does

Compiler evaluate: Date today storeString



> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of
> stephane ducasse
> Sent: 29 May 2006 10:31 AM
> To: The general-purpose Squeak developers list
> Subject: Date readFromString: Date today storeString....is it a bug?
>
>
> Date readFromString: Date today storeString
>
> raises an exception...
>
>
> testReadFrom works so it is the idiom readFrom:/storeOn: that does  
> not work anymore?
>
> Stef
>