On 17 May 2017, at 16:15, Cyril Ferlicot D. <cyril.ferlicot@gmail.com> wrote:
On 17/05/2017 16:02, Sven Van Caekenberghe wrote:
OK, that is an understandable example.
But why exactly do you want Currency to be serialised differently ? You don't want too many instances ? You want all instances to be #== ? Is Currency too big ? You want to allow humans to edit the STON file ? What ? Why ?
You can easily make it Currency['Euro'] or even Currency[#Euro] like it is already done for a number of built-in classes.
The last example that I gave solved the 'too many instances', make them #== issue.
If it is size, that got covered too, but you must solve the problem of how the receiving end will resolve the reference then.
But since that is all no good, there must still be another requirement.
Here it is a simple example to show what I want.
The real use case is that in Moose, entities are really connected to their model, and if one of our classes contains an entity it would produce a really really really big ston file since it would export millions of entities.
But there is a way to retrieve an entity of this model from its moose name.
Thus, I would like to export only the moose name of the entities, then get the corresponding entity from a Model the user would have load before during the ston reading.
OK. So there is some existing method that gives you the entity given its name ? MooseEntity class>>fromEntityName: 'mooseEntityName' Right ? So why can't you use the example that I gave you earlier, replace the UUID string with the mooseEntityName string, and call the above method instead of the #fromId: in my example ? In STON, you will then see MooseEntity['mooseEntityName'] as value.
-- Cyril Ferlicot https://ferlicot.fr
http://www.synectique.eu 2 rue Jacques Prévert 01, 59650 Villeneuve d'ascq France