links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 1:09 pm UTC on 19 February 2018

Smalltalk Object Notation (STON) documentation

Sven Van Caekenberghe
<sven@beta9.be>	Tue, Apr 24, 2012 at 7:35 PM
Reply-To: Pharo-project@lists.gforge.inria.fr
To: Pharo-project@lists.gforge.inria.fr
Reply | Reply to all | Forward | Print | Delete | Show original

On 24 Apr 2012, at 19:22, Dale Henrichs wrote:

> Sven,
> I looked at your sample document in the pdf:
> TestDomainObject {
>  #created : DateAndTime [ '2012-02-14T16:40:15+01:00' ],
>  #modified : DateAndTime [ '2012-02-14T16:40:18+01:00' ],
>  #integer : 39581,
>  #float : 73.84789359463944,
>  #description : 'This is a test',
>  #color : #green,
>  #tags : [
>    #two,
>    #beta,
>    #medium
>  ],
>  #bytes : ByteArray [ 'afabfdf61d030f43eb67960c0ae9f39f' ],
>  #boolean : false
> }
> And this is very readable (to me)... not as many '[]' as I inferred from reading the tests:).
> I take back my YAML comparison ... this has the nice flavor of Smalltalk ...
> Dale


The main 'hack' is to extend JSON's list/array [] and map/dictionary {} with a very simple way to instanciate any class, by preceding them with a class name (or alias) and giving the control to instanciate to the class or instance. Furthermore, for Array and Dictionary these are optional. For the concrete representations chosen for say DateAndTime or ByteArray, human readability was the deciding factor. But any of these could be changed without hurting the concept.

Note that there are also references and implicit object counting and graph tracing with a defined visit order. In a discussion with Mariano I kind of decided to no longer treat Strings as shareable/reference-able objects. This is not yet reflected in the document but it is in the code.


STON for Squeak

to check

STON to read into Squeak, check out these three packages and report here if they are OK:




About STONS efficiency at storing nested objects

Sven Van Caekenberghe<sven@stfx.eu>	Wed, Nov 2, 2016 at 6:21 PM
Reply-To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>

Basically, STON walks the graph noting each object it sees. When it encounters the same object again, it outputs a reference. Object equality is of course #==

References are integers, indexes into the list of objects seen, ordered by walking depth first.

See also