> On 20 Jul 2017, at 12:08, Diego Lont <diego.l...@delware.nl> wrote:
> 
> Hi,
> 
> What I remember of STON is that it simply puts out the entire tree. So it 
> might include things you don’t want (like thisContext), and also does not 
> handle loops well. But that is from memory, I might be wrong there.

Hmm, I think you are misinformed. STON was specifically designed to handle 
cycles and structure sharing in object graphs. STON won't interact with 
thisContext unless you make that part of your domain objects. A limitation of 
STON is that it won't handle blocks (though in some cases there are 
workarounds). It is possible to tune how your objects are serialised by STON 
with various mechanisms, including skipping certain instance variables.

> For serialisation you could also look into the Magritte serialisation. It has 
> several extenstions, among them one to output them in the JSon format. 
> Disadvantage is that you have to describe your objects, but this is also 
> helps you only send into the world the things you want.
> 
> Regards,
> Diego
> 
>> On 16 Jul 2017, at 21:00, Siemen Baader <siemenbaa...@gmail.com> wrote:
>> 
>> Hi all, 
>> 
>> I’m trying to transpile the STON class to JavaScript with PharoJS to use it 
>> in a client side web application. The goal is it to retrieve object(graphs) 
>> from the server and deserialize them in the frontend via xhr. 
>> 
>> But PharoJS doesn't support thisContext, I think that's a limitation of the 
>> JavaScript VM. PharoJS raises "PjJavascriptTranspilationError - thisContext 
>> not supported. Found in Collection >> #toBraceStack:". I tried to add the 
>> <pharoJsSkip> pragma to the method in the hope that it will not be needed 
>> for my uses, but no luck.
>> 
>> Is the use of thisContext needed in STON, can I avoid it? I had hoped to use 
>> STON because it is simple and well documented and unlike JSON handles object 
>> graphs and classes.
>> 
>> What are my options?
>> 
>> Alternatively, what else could I use to serialize objects? I'm already using 
>> Voyage & Mongo on the backend which deal with JSON internally, and I think 
>> Moose also has a serialization component. Using a JS library in the frontend 
>> is also an option if there is a Pharo implementation for its format as well.
>> 
>> Thanks,
>> Siemen
> 
> 


Reply via email to