Hi
I'm loading objects with JSON and getting a really weird exception. This is JSON>>readString
] repeat. When reading my objects the ifFalse block is evaluated for the first character and "s nextPut: c" is executed. WriteStream>>nextPut: delegates to #_nextPut: where the following is evaluated:
"itsCollection" is the empty string initialized before, "position" is 1 and anObject is "$a" ($a being the first character after the initial double quote). When stepping into this and over the following primitive everything works as expected but when I let it run through I get:
I really can't find any other explanation for this than that something's wrong with the VM. Can somebody help? I copied the stack trace below this message. Thanks, Max trace.txt (101K) Download Attachment |
Max,
One thing I see right off is that you have initialized the stream contents to an invariant object (a string literal). The VM will be unable to add characters to your stream. I suggest your first line be: s := WriteStream on: String new. Alternatively, you can make a copy of the string literal. In my environment, I get an error, but it is a different error, so this might not be the only problem. James On Mar 4, 2011, at 5:45 AM, Max Leske wrote:
|
Perfect!
That did the trick, thanks. As I explained, this is code in a JSON package which runs fine in Pharo (SqueakVM). Is this a GemStone VM thing? Cheers, Max On 04.03.2011, at 14:56, James Foster wrote:
|
I'm glad that fixed it. And, yes, this is a GemStone VM "thing." Whether the ability to modify literals is a bug or a feature has been debated. In Pharo you may do so, in GemStone you may not do so. There are arguments either way, but I like the immutability of literals, so I'm happy with GemStone (for that and many other reasons!).
James On Mar 4, 2011, at 6:04 AM, Max Leske wrote:
|
Good to know. Thanks. Max On 04.03.2011, at 15:08, James Foster wrote:
|
Free forum by Nabble | Edit this page |