Serializing classes with Fuel
Hi everyone, does anyone here have some experience with Fuel? Its Web site says "It can serialize/materialize not only plain objects but also classes, traits, methods, closures, contexts, packages, etc.". So I should be able to serialize a class somehow, right? But classes are by default treated as global objects, even if they aren't. The class I want to serialize is created by newAnonymousSubclass. And yet, Fuel only stores its name in the output file. The documentation describes considerGlobal: which does the opposite of what I want. So my question is: how can I tell Fuel *not* to consider a class as global? Konrad.
On Tue, Mar 5, 2019 at 1:42 PM Konrad Hinsen <konrad.hinsen@fastmail.net> wrote:
Hi everyone,
does anyone here have some experience with Fuel?
Its Web site says "It can serialize/materialize not only plain objects but also classes, traits, methods, closures, contexts, packages, etc.". So I should be able to serialize a class somehow, right?
But classes are by default treated as global objects, even if they aren't. The class I want to serialize is created by newAnonymousSubclass. And yet, Fuel only stores its name in the output file.
The documentation describes considerGlobal: which does the opposite of what I want. So my question is: how can I tell Fuel *not* to consider a class as global?
Konrad.
Yes, that's the "default" behavior. To fully serialize classes you need FuelMetalevel packages. This brings a new visitors and mappers to allow you to fully serialize methods, classes, contexts, etc. I am sorry but I couldn't remember where the docs about that were. You may want to at least take a look to the packages and their tests. Best, -- Mariano https://twitter.com/MartinezPeck http://marianopeck.wordpress.com
On 5 Mar 2019, at 19:22, Mariano Martinez Peck wrote:
On Tue, Mar 5, 2019 at 1:42 PM Konrad Hinsen <konrad.hinsen@fastmail.net> wrote:
Hi everyone,
does anyone here have some experience with Fuel?
Its Web site says "It can serialize/materialize not only plain objects but also classes, traits, methods, closures, contexts, packages, etc.". So I should be able to serialize a class somehow, right?
But classes are by default treated as global objects, even if they aren't. The class I want to serialize is created by newAnonymousSubclass. And yet, Fuel only stores its name in the output file.
The documentation describes considerGlobal: which does the opposite of what I want. So my question is: how can I tell Fuel *not* to consider a class as global?
Konrad.
Yes, that's the "default" behavior. To fully serialize classes you need FuelMetalevel packages. This brings a new visitors and mappers to allow you to fully serialize methods, classes, contexts, etc. I am sorry but I couldn't remember where the docs about that were. You may want to at least take a look to the packages and their tests.
I'm afraid we don't really have documentation for meta level. The tests are the best place to look for guidance. But if you have concrete questions, best send them to the fule list. Max
Best,
-- Mariano https://twitter.com/MartinezPeck http://marianopeck.wordpress.com
_______________________________________________ Pharo-fuel mailing list Pharo-fuel@lists.gforge.inria.fr https://lists.gforge.inria.fr/mailman/listinfo/pharo-fuel
Hi Mariano,
Yes, that's the "default" behavior. To fully serialize classes you need FuelMetalevel packages. This brings a new visitors and mappers to allow you to fully serialize methods, classes, contexts, etc.
Thanks for the pointer - I will explore FuelMetalevel. Konrad.
participants (3)
-
Konrad Hinsen -
Mariano Martinez Peck -
Max Leske