Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smalltalk ReferenceStream has problems with new instance variables?

In Pharo Smalltalk I'm using ReferenceStream to serialise a list of objects -- here's the class definition of the objects I'm serialising:

Object subclass: #Task
instanceVariableNames: 'title notes list project dateNextAction dateCreated dateCompleted importance selected'
classVariableNames: 'Database'
poolDictionaries: ''
category: 'ToDo'

I'm using the SMFileDatabase method described here: http://book.seaside.st/book/advanced/persistency/image-based-persistency

This has been working well, and it's been nice not to have to use a database for my prototype app.

Howevere, here's the problem: when I add a new instance variable person to Task the load from ReferenceStream breaks:

Object subclass: #Task
instanceVariableNames: 'title notes list project person dateNextAction dateCreated dateCompleted importance selected'
classVariableNames: 'Database'
poolDictionaries: ''
category: 'ToDo'

It seems to not spot the new variable, and load the values into the wrong slots, so person takes the value of dateNextAction, dateNextAction takes dateCreated and so on.

How can I stop this happening?

I've got it working by placing the new variable at the end of the list, but I'd like to group variables by type.

like image 685
Eric Clack Avatar asked Dec 15 '22 12:12

Eric Clack


1 Answers

ReferenceStream is not supported anymore and has been deleted in Pharo 2.0. You should use Fuel which is well written, well documented, well tested and very fast. http://rmod.lille.inria.fr/web/pier/software/Fuel

like image 51
Damien Cassou Avatar answered Apr 11 '23 20:04

Damien Cassou