[squeak-dev] [ANN] Fuel 1.8.1

H. Hirzel hannes.hirzel at gmail.com
Fri Jan 4 12:44:26 UTC 2013


Hello Martín

I wanted to try out a simpler example first, just a few Morphs and had
problems with it.

The test case
---------------------


A) Create a RectangleMorph with 4 submorphs and serialize it.


I a Morphic project I evaluate the following code. It serializes a
morph into a file called

4ColoredDots.FL.

"Example taken from: http://wiki.squeak.org/squeak/52"

m := RectangleMorph new.
m layoutPolicy: TableLayout new.
m listDirection: #leftToRight.
"If you omit this expression you get the default "
"m listDirection: #topToBottom."
m hResizing: #shrinkWrap.
m vResizing: #shrinkWrap.

m addMorph: (EllipseMorph new extent: 40 at 40; color: Color red).
m addMorph: (EllipseMorph new extent: 50 at 50; color: Color yellow).
m addMorph: (EllipseMorph new extent: 60 at 60; color: Color green).
m addMorph: (EllipseMorph new extent: 70 at 70; color: Color blue).
m openInWorld.


"Store to the file"
FLSerializer serialize: r toFileNamed: '4coloredDots.FL'.




B) Loading  file '4coloredDots.FL'  into another Morphic project

I open another Morphic project and evaluate.

"Load from the file"
| r |
r := FLMaterializer materializeFromFileNamed: '4coloredDots.FL'.
r inspect.
World addMorph: r.


PROBLEM
----------------

r is nil.


QUESTION
----------------


What am I missing here?
Maybe this example is not actually simpler but more complicated than
the one you gave in the previous mail.... :-(

In any case illustrative comments are appreciated.


Kind regards

Hannes Hirzel


On 1/3/13, Martin Dias <tinchodias at gmail.com> wrote:
>>
>> I didn't explain the problem you had:
>>
>> When you evaluated the snippet of code, it was compiled to a temporary
>> #DoIt method (not installed into the method dictionary). Then, the
>> example serialized a blockclosure, that was defined into the
>> not-installed #DoIt. By default, Fuel serializes the CompiledMethods
>> just as a class name and a selector. So, when you try to materialize
>> the blockclosure, Fuel asks the method dictionary for the #DoIt, which
>> is not there. So signals an error.
>> Using FuelMetalevel, you can tell Fuel to fully serialize the
>> CompiledMethods, so DoIt can be serialized and materialized, no matter
>> if it is installed or not.
>
> Just to complete the idea... if the block closure were installed in a
> class, then there will be no error. If you file-in the attached file
> and evaluate:
>
> FLSerializer example.
>
> I works, so you can see a string printed in the Transcript.
>
> Martín
>


More information about the Squeak-dev mailing list