Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 3 participants
- 144616 messages
[pharo-project/pharo-core]
by GitHub
Branch: refs/tags/60506
Home: https://github.com/pharo-project/pharo-core
July 4, 2017
[pharo-project/pharo-core] 9a3d58: 60506
by GitHub
Branch: refs/heads/6.0
Home: https://github.com/pharo-project/pharo-core
Commit: 9a3d58e0ee84d733c08f8447b05a946939337a5d
https://github.com/pharo-project/pharo-core/commit/9a3d58e0ee84d733c08f8447…
Author: Jenkins Build Server <board(a)pharo-project.org>
Date: 2017-07-04 (Tue, 04 Jul 2017)
Changed paths:
M Collections-Streams.package/Stream.class/instance/accessing/next_put_.st
A Collections-Streams.package/WriteStream.class/instance/accessing/crlf.st
R Collections-Streams.package/WriteStream.class/instance/character writing/crlf.st
M Collections-Streams.package/WriteStream.class/instance/character writing/crtab.st
M Collections-Streams.package/WriteStream.class/instance/character writing/crtab_.st
M Collections-Streams.package/WriteStream.class/instance/character writing/ensureNoSpace.st
M Collections-Streams.package/WriteStream.class/instance/character writing/space_.st
M Collections-Streams.package/WriteStream.class/instance/character writing/tab_.st
A Collections-Tests.package/CharacterTest.class/instance/tests/testIsSeparator.st
A Collections-Tests.package/WriteStreamTest.class/instance/tests/testEnsureNoSpace.st
M Kernel.package/Character.class/instance/testing/isSeparator.st
R ScriptLoader60.package/ScriptLoader.class/instance/pharo - scripts/script60505.st
A ScriptLoader60.package/ScriptLoader.class/instance/pharo - scripts/script60506.st
R ScriptLoader60.package/ScriptLoader.class/instance/pharo - updates/update60505.st
A ScriptLoader60.package/ScriptLoader.class/instance/pharo - updates/update60506.st
M ScriptLoader60.package/ScriptLoader.class/instance/public/commentForCurrentUpdate.st
M Text-Core.package/Text.class/class/instance creation/fromString_.st
Log Message:
-----------
60506
20092 Improve speed of WriteStream>>tab:
https://pharo.fogbugz.com/f/cases/20092
20088 Improve speed of Character>>isSeparator in when the separator is not a space
https://pharo.fogbugz.com/f/cases/20088
20204 Text class>>#fromString
https://pharo.fogbugz.com/f/cases/20204
http://files.pharo.org/image/60/60506.zip
July 4, 2017
Re: [Pharo-dev] Pharo 7 provisional HOWTO
by Pavel Krivanek
A small update:
You are not forced to use a 'pharo-core' repository in your image folder if
you provide a path to your own clone to the working copies of the
bootstrapped packages. This way you can more easily share one local clone
of the pharo-project/pharo repository.
For the registration of your local repository use this script:
target := 'path/to/my/local/repository' asFileReference.
repository := IceRepositoryCreator new
location: target;
subdirectory:'src';
createRepository.
repository register.
fork := repository remotes detect: [ :remote | remote remoteName = #myFork
].
repository pushRemote: fork.
repository pullRemote: repository origin.
repository checkoutBranch: 'development'.
repository backend pullFrom: repository origin.
repository push.
repository checkoutBranch: (SystemVersion current commitHash).
fileTreeRepository := (MCFileTreeRepository new directory: target / #src;
yourself).
repositoryGroup := MCRepositoryGroup withRepositories: {
fileTreeRepository. MCCacheRepository uniqueInstance. }.
MCWorkingCopy allManagers
select: [ :wc | (wc repositoryGroup repositories reject: [ :repo | repo
isCache ]) isEmpty ]
thenDo: [ :wc | wc repositoryGroup: repositoryGroup ]
2017-06-26 13:14 GMT+02:00 Pavel Krivanek <pavel.krivanek(a)gmail.com>:
> Hi,
>
> this mail describes how to start to send pull requests to Pharo 7 Github
> repository from Pharo 7.
>
> Preparations
> =====================
>
> - you need to have a Github account and set SSH keys. See
> https://help.github.com/articles/connecting-to-github-with-ssh/
> - create own pharo-project/pharo repository fork. Go to
> https://github.com/pharo-project/pharo, click on "Fork" button and follow
> the instructions
>
> Get Pharo 7 image
> =====================
>
> The CI jobs for the Pharo 7 defelopment are currently not fully set and we
> still do not publish Pharo 7 image to files.pharo.org so you cannot get
> it using zero-conf scripts. But we have a provisional CI job that
> bootstraps the Pharo 7 image.
>
> https://ci.inria.fr/pharo/view/7.0/job/70-Bootstrap-32bit/
>
> There download a file named like Pharo7.0-32bit-hash.zip and decompress
> it. Unlike Pharo 6 images, the archive contains three files. Image, changes
> and sources. In Pharo 7 you have the sources file for every bootstrapped
> version. It has a commit hash in the name and it cannot be shared between
> different Pharo 7 imges, however it can be shared between images that were
> created as snapshots with the same bootstrapped image as ancestor.
>
> Create local clone
> =====================
>
> You need a local clone of the Pharo repository. Because it contains a lot
> of small files, it is not a good idea to have own clone for every image.
> You can have only one and share them between images. But because of some
> current Monticello constraints you need to have the clone placed in the
> image directory in a folder with name 'pharo-core'.
>
> In this step we will clone the Pharo repository from pharo-project/pharo
> Github repository and add your fork as default pull target. We will update
> your fork repository to contain all latest commits from the Pharo
> repository in the branch named 'development'. For latest stable version
> (Pharo 6) we use the master branch.
> In the end we will checkout the repository to a particular commit from
> which the downloaded Pharo 7 image was bootstrapped. Imagine that you have
> a Pharo 7 image that is several days old and the development branch has
> already some commits that change code. If you would take this older image,
> checkout to the development branch and then do your commit, your would
> revert all changes done in not-loaded commits. The other option is to
> update your image to correspond to the repository latest commit which
> requires packages reloading.
> If you checkout to a particular commit, you are in detached HEAD state. In
> this state you cannot do commits directly. You need to firstly create new a
> new branch which we will do anyway.
>
> Evaluate the following code. This functionality will be later direct part
> of Iceberg UI. Do not forget to change the user name.
>
> username := 'YOUR-USER-NAME'.
> repository := IceRepositoryCreator new
> url: 'git@github.com:pharo-project/pharo.git';
> location: ('pharo-core' asFileReference ensureCreateDirectory);
> subdirectory:'src';
> createRepository.
> repository checkoutBranch: 'development'.
> repository register.
>
> fork := (IceRemote name: 'myFork' url: ('git@github.com:{1}/pharo.git'
> format: {username})).
> repository addRemote: fork.
> repository pushRemote: fork.
> repository pullRemote: repository origin.
>
> "update fork"
> repository backend pullFrom: repository origin. "use this low-level form
> to prevent packages reloading"
> repository push.
>
> "checkout to the commit from which the image was bootstrapped"
> repository checkoutBranch: (SystemVersion current commitHash).
>
> Use already created clone
> =====================
>
> This is alternative to the previous step. Let's suppose that you already
> have your local clone. You take some Pharo 7 image and you want to create
> commits. Then you need to create a symlink or move/copy the repository into
> your image directory. Remember, it must be named pharo-core (we do not use
> the name 'pharo' to avoid collision with VM executable).
>
> In this step we will register an existing Pharo repository clone, set your
> fork as the push target, update your fork and then switch to the particular
> commit.
>
> repository := IceRepositoryCreator new
> location: ('pharo-core' asFileReference);
> subdirectory:'src';
> createRepository.
> repository register.
>
> fork := repository remotes detect: [ :remote | remote remoteName = #myFork
> ].
> repository pushRemote: fork.
> repository pullRemote: repository origin.
>
> repository checkoutBranch: 'development'.
> repository backend pullFrom: repository origin.
> repository push.
>
> repository checkoutBranch: (SystemVersion current commitHash).
>
> Issue processing
> =====================
>
> - create new case on FogBugz to get the issue number
> - open Iceberg and from the context menu on the 'pharo' repository do:
> Pharo - Create new branch from FogBugz issue, enter the issue ID and it
> will fill the full branch name for you
> - create your changes (you can do it before the creation of the branch too)
> - commit and push your changes in Iceberg, this way you will commit your
> branch to your fork repository. Remember that the Iceberg commit window has
> two buttons, one for local commit, the second for commit with immediate
> push. They can be very long because they contain the full branch (issue)
> name
> - in Iceberg in the 'pharo' repository context menu do: Pharo - Create
> pull request, fill your
> - fill your Github credentials
> - leave the PR title, comment is not required, check the pull request head
> and base. The base MUST be pharo-project/pharo development. Create the pull
> requests
> - go to https://github.com/pharo-project/pharo/pulls, check your pull
> requests and put URL of it into the issue record on FogBugz (as a comment).
> Resolve the issue as Fix review needed
>
> Cheers,
> -- Pavel
>
>
July 4, 2017
Re: [Pharo-dev] Reflecting on data (literal) object syntax
by Christian Haider
Yes, Value (the superclass) is used for â äh :) - values, i.e. immutable literal objects, which aid me with a more functional programming style.
The literal printing of Objects is possible for all objects, since the facilities are defined in Object (#asSource).
And yes, it is the same as #storeString â in spirit and as fallback. But instead of using #instvarAt:put:, #asSource uses the constructor form instead.
(I did not want to extend #storeString to not interfere with the systems use of it (lots).)
So, instead of writing the infos (class names, selectors and arguments) in a new syntax, why not writing it as Smalltalk source?
You just need to define a print method #printvalueWith: and implement the corresponding constructor(s).
My question about the purpose was more from the user view.
Is it for persisting settings or configurations outside an image?
Or exchanging data between images / dialects?
Or for interfacing with external systems?
For these, I could recommend Values :).
Cheers
P.S. are you at ESUG? I could show you what I meanâ¦
Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Norbert Hartl
Gesendet: Dienstag, 4. Juli 2017 09:20
An: Pharo Dev <pharo-dev(a)lists.pharo.org>
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Hi Christian,
thanks for the explanation. I see that Values serve a different purpose. We are looking for a compact form of object literal, the is not bound to the external interface and does not need to be subclassed.
I'm interested how the printing of Values is different to #storeString.
Norbert
Am 04.07.2017 um 09:05 schrieb Christian Haider <christian.haider(a)smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com> >:
Hi Norbert,
yes, that is the point: it is a normal Smalltalk expression.
It is trivial and every Smalltalk understands it.
No need for special parsers; you just have class names and constructor methods.
I believe this is a very compact and simple representation of Smalltalk objects.
The Values package contains mainly the machinery to print an object (aka Value) as String so that it can be reconstructed from it.
Exactly like Smalltalk prints literal objects like Array, Integer, Character, String, Symbol etc.
The superclass Value makes sure that the object tree (remember â no cycles or references) will print properly (under consideration of namespaces).
Also, many âsimpleâ base objects can be turned into Values by implementing constructors and the printer (like Date, Timestamp, Point, Rectangle, ColorValue etc.).
Additionally, Values allow to declare optional instVars, so that the representation does not get too cluttered with boilerplate arguments.
In the dev tools, there is a generator which produces the proper constructors (2**<number of defaults>).
There is really not much to it, technically. Maybe it is just too simple.
I would be interested in the differences to the other proposals â what should be achieved and what may be missing?
HTH,
Christian
Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Norbert Hartl
Gesendet: Dienstag, 4. Juli 2017 08:14
An: Pharo Development List <pharo-dev(a)lists.pharo.org <mailto:pharo-dev@lists.pharo.org> >
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Hi Christian,
Am 03.07.2017 um 11:06 schrieb Christian Haider < <mailto:christian.haider@smalltalked-visuals.com> christian.haider(a)smalltalked-visuals.com>:
I solved this with Values[1] for VW and I am very happy with it (using it intensively/routinely).
Your example would look like:
(PointCollection points: (Array
with: (Point x: 10 y: 20)
with: (Point x: 5 y: 8)
))
I do not understand your point. Above is a normal smalltalk expression. I skimmed through the Values document and I do not get how this is related to a discussion about
compact object literal syntax.
Can you elaborate a bit more? How do Values help here?
Norbert
As you see, it is the same except that lots of noise is gone.
Drawbacks: only literal objects (like Values) are allowed; i.e. no cyclic structures (same with JSON etc.)
and the order of arguments is fixed unlike JSON (but you can add constructors for every permutation :)).
I think this is very clear and direct (no magic from parsers etc.). I like it most for configurations (see everything at a glance) and interface data.
Best,
Christian
[1] <https://wiki.pdftalk.de/doku.php?id=complexvalues> https://wiki.pdftalk.de/doku.php?id=complexvalues
Von: Pharo-dev [ <mailto:pharo-dev-bounces@lists.pharo.org> mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Norbert Hartl
Gesendet: Montag, 3. Juli 2017 10:28
An: Pharo Dev < <mailto:pharo-dev@lists.pharo.org> pharo-dev(a)lists.pharo.org>
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Eliot,
Am 01.07.2017 um 20:22 schrieb Eliot Miranda < <mailto:eliot.miranda@gmail.com> eliot.miranda(a)gmail.com>:
Hi Norbert,
On Jul 1, 2017, at 7:36 AM, Norbert Hartl < <mailto:norbert@hartl.name> norbert(a)hartl.name> wrote:
Am 30.06.2017 um 21:14 schrieb Stephane Ducasse < <mailto:stepharo.self@gmail.com> stepharo.self(a)gmail.com>:
But what is DataFrame?
the new collection done by alesnedr from Lviv. It is really nice but
does not solve the problem of the compact syntax.
STON fromString: 'Point[10,20]'
Same goes for JSON.
We were brainstorming with marcus and we could have a first nice extension:
{ 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
10@20
Now in addition I think that there is a value in having an object
literal syntax.
I pasted the old mail of igor on object literals because I like the
idea since it does not add any change in the parser.
Do you remember what were the problem raised by this solution (beside
the fact that it had too many # and the order was like in ston not
explicit).
I would love to have another pass on the idea of Igor.
What I don't like about it is that the object literal exposes the internal implementation of the object. Everything is based on index. So it could suffer the same problem as fuel. When you don't have the exact same code the deserialization fails.
Indeed this is why
{ 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
could be more robust.
We could extend the object literal syntax to use association for non
collection.
I think it is more robust and more explicit. I do not know what are the semantics of detecting something as #Point being a class name. Is it then forbidden to use symbols with uppercase letters? I think something like
{ #x -> 10 . #y -> 20} asObjectOf: #Point
is handling the format with implicit knowledge of type. While the explicit version would be
{ #Point -> { #x -> 10 . #y -> 20}} asObject
And then nested objects are as easy as
{#PointCollection -> {
#points -> { {#Point -> { #x -> 10 . #y -> 20} }.
{#Point -> { #x -> 5 . #y -> 8} } } } asObject
The -> messages are just noise and add additional processing for nothing. This is just as effective:
{ #Point. { #x. 10 . #y. 20}} asObject
{#PointCollection. { #points. { {#Point. { #x. 10 . #y. 20} }.
{#Point. { #x. 5 . #y. 8} } } } asObject
So an object is a pair of a class name and an array of slot specifier pairs, and a slot specifier is a pair of a slot band and a value. And of course that means that many object specs can be literal, which is useful for storing in pragmas etc:
#(PointCollection
(points ((Point (x 10 y 20))
((Point (x 5 y 8)))) asObject
Agreed. My first impression was it should be something like S-expression which your example is. I was misled by the idea it should be closer to the programming syntax. But a parser does not care if implemented properly, that's right. I like the compactness of that format but still find it a bit hard to read if there is only pairs. As this object literal syntax is meant to be written in code it is important that it reads well even if there are noisy characters.
would give a PointCollection of two point objects. My future wish would be that there is an object literal parser that takes all of the information from the format. And then a object literal parser that is aware of slot information. Meaning that the type information can be gathered from the object class instead having it to write in the format. In the PointCollection the slot for points would have the type information #Point attached. The format goes then to
{ #points -> {
{ #x -> 10 . #y -> 20 }.
{ #x -> 5 . #y -> 8 } }
which would then the equivalent to something like JSON
{ "points" : [
{ "x" : 10, "y" : 20 },
{ "x" : 5, "y" : 8 } ] }
What I don't know is how to solve the difference between a dictionary and an collection of associations.
That's incidental to the format, internal to the parser. If the parser chooses to build a dictionary as it parses so be it. The point is that the output is as you specify; a tree of objects.
The thing to think about is how to introduce labels so that sub objects can be shared in the graph, the naïve deepCopy vs deepCopyUsing: issue.
I'm not sure this is necessary. It should be a format to easily instantiate a small tree of objects. Making it build a graph instead of a tree makes everything much more complicated. Either we decide that STON can do the full set and in that case it is probably less valuable to have a simple syntax to write in code. Or we need to break pairs rule. In that case an object definition can have an optional third argument which would be the label for the object. The draback is that the label needs to be before the array of slots
{ :v1 #ValueHolder { 'contents' . { ValueHolder . { 'contents' . @v1 }}}}
Or something like this. It would be in theory closer to STON using the @ reference. The difference is that STON has indexed object access and that variant would make it based on labels.Or something like this.
Norbert
Norbert
As a dictionary is both, an array of associations and a key-value store, it works perfectly there. But for other objects I have doubts. Especially is in a lot of contexts you need to have a mapping of internal state to external representation. It can be applied afterwards but I'm not sure that can work all the time.
Yes after we should focus on the frequent cases. And may be having a
literal syntax for dictionary would be good enough.
I will do another version of igor's proposal with associations to see
how it feels.
my 2 cents,
Norbert
Stef
---------- Forwarded message ----------
From: Igor Stasenko < <mailto:siguctua@gmail.com> siguctua(a)gmail.com>
Date: Fri, Oct 19, 2012 at 1:09 PM
Subject: [Pharo-project] Yet another Notation format: Object literals
To: Pharo Development < <mailto:Pharo-project@lists.gforge.inria.fr> Pharo-project(a)lists.gforge.inria.fr>
Hi,
as i promised before, here the simple smalltalk-based literal format.
It based on smalltalk syntax, and so, unlike JSON, it doesn't needs to
have separate parser (a normal smalltalk parser used for that).
The idea is quite simple:
you can tell any object to represent itself as an 'object literal' ,
for example:
(1@3) asObjectLiteral
--> #(#Point 1 3)
{ 1@2. 3@4. true. false . nil } asObjectLiteral
-> #(#Array #(#Point 1 2) #(#Point 3 4) true false nil)
(Dictionary newFromPairs: { 1->#(1 2 3) . 'foo' -> 'bar' }) asObjectLiteral
->
#(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar')
Next thing, you can 'pretty-print' it (kinda):
#(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar') printObjectLiteral
'#(#Dictionary
1
(#Array 1 2 3)
''foo'' ''bar'')'
and sure thing, you can do reverse conversion:
'#(#Dictionary
1
(#Array 1 2 3)
''foo'' ''bar'')' parseAsObjectLiteral
a Dictionary('foo'->'bar' 1->#(1 2 3) )
Initially, i thought that it could be generic (by implementing default
Object>>#asObjectLiteral),
but then after discussing it with others, we decided to leave
Object>>#asObjectLiteral to be a subclass responsibility.
So, potentially the format allows to represent any object(s) as
literals, except from circular referencing objects, of course.
The implementation is fairly simple, as you may guess and contains no
new classes, but just extension methods here and there.
Take it with grain and salt, since it is just a small proof of
concept. (And if doing it for real it may need some changes etc).
Since i am far from areas right now, where it can be used, i don't
want to pursue it further or advocate if this is the right way to do
things.
Neither i having a public repository for this project..
So, if there anyone who willing to pick it up and pursue the idea
further, please feel free to do so and make a public repository for
project.
July 4, 2017
Re: [Pharo-dev] Reflecting on data (literal) object syntax
by Norbert Hartl
Hi Christian,
thanks for the explanation. I see that Values serve a different purpose. We are looking for a compact form of object literal, the is not bound to the external interface and does not need to be subclassed.
I'm interested how the printing of Values is different to #storeString.
Norbert
> Am 04.07.2017 um 09:05 schrieb Christian Haider <christian.haider(a)smalltalked-visuals.com>:
>
> Hi Norbert,
>
> yes, that is the point: it is a normal Smalltalk expression.
> It is trivial and every Smalltalk understands it.
> No need for special parsers; you just have class names and constructor methods.
> I believe this is a very compact and simple representation of Smalltalk objects.
>
> The Values package contains mainly the machinery to print an object (aka Value) as String so that it can be reconstructed from it.
> Exactly like Smalltalk prints literal objects like Array, Integer, Character, String, Symbol etc.
> The superclass Value makes sure that the object tree (remember â no cycles or references) will print properly (under consideration of namespaces).
> Also, many âsimpleâ base objects can be turned into Values by implementing constructors and the printer (like Date, Timestamp, Point, Rectangle, ColorValue etc.).
>
> Additionally, Values allow to declare optional instVars, so that the representation does not get too cluttered with boilerplate arguments.
> In the dev tools, there is a generator which produces the proper constructors (2**<number of defaults>).
>
> There is really not much to it, technically. Maybe it is just too simple.
> I would be interested in the differences to the other proposals â what should be achieved and what may be missing?
>
> HTH,
> Christian
>
> Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Norbert Hartl
> Gesendet: Dienstag, 4. Juli 2017 08:14
> An: Pharo Development List <pharo-dev(a)lists.pharo.org>
> Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
>
> Hi Christian,
>
> Am 03.07.2017 um 11:06 schrieb Christian Haider <christian.haider(a)smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com>>:
>
>> I solved this with Values[1] for VW and I am very happy with it (using it intensively/routinely).
>> Your example would look like:
>>
>> (PointCollection points: (Array
>> with: (Point x: 10 y: 20)
>> with: (Point x: 5 y: 8)
>> ))
>>
> I do not understand your point. Above is a normal smalltalk expression. I skimmed through the Values document and I do not get how this is related to a discussion about
> compact object literal syntax.
> Can you elaborate a bit more? How do Values help here?
>
> Norbert
>
>> As you see, it is the same except that lots of noise is gone.
>> Drawbacks: only literal objects (like Values) are allowed; i.e. no cyclic structures (same with JSON etc.)
>> and the order of arguments is fixed unlike JSON (but you can add constructors for every permutation J).
>>
>> I think this is very clear and direct (no magic from parsers etc.). I like it most for configurations (see everything at a glance) and interface data.
>>
>> Best,
>> Christian
>>
>> [1] https://wiki.pdftalk.de/doku.php?id=complexvalues <https://wiki.pdftalk.de/doku.php?id=complexvalues>
>>
>> Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org <mailto:pharo-dev-bounces@lists.pharo.org>] Im Auftrag von Norbert Hartl
>> Gesendet: Montag, 3. Juli 2017 10:28
>> An: Pharo Dev <pharo-dev(a)lists.pharo.org <mailto:pharo-dev@lists.pharo.org>>
>> Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
>>
>> Eliot,
>>
>>> Am 01.07.2017 um 20:22 schrieb Eliot Miranda <eliot.miranda(a)gmail.com <mailto:eliot.miranda@gmail.com>>:
>>>
>>> Hi Norbert,
>>>
>>>
>>>
>>>
>>>> On Jul 1, 2017, at 7:36 AM, Norbert Hartl <norbert(a)hartl.name <mailto:norbert@hartl.name>> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>> Am 30.06.2017 um 21:14 schrieb Stephane Ducasse <stepharo.self(a)gmail.com <mailto:stepharo.self@gmail.com>>:
>>>>>>
>>>>>> But what is DataFrame?
>>>>>
>>>>> the new collection done by alesnedr from Lviv. It is really nice but
>>>>> does not solve the problem of the compact syntax.
>>>>>
>>>>>
>>>>>
>>>>>>>
>>>>>>> STON fromString: 'Point[10,20]'
>>>>>>>
>>>>>> Same goes for JSON.
>>>>>>
>>>>>>
>>>>>>
>>>>>>> We were brainstorming with marcus and we could have a first nice extension:
>>>>>>>
>>>>>>> { 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
>>>>>>>
>>>>>>>
>>>>>>>>>> 10@20
>>>>>>>
>>>>>>> Now in addition I think that there is a value in having an object
>>>>>>> literal syntax.
>>>>>>>
>>>>>>> I pasted the old mail of igor on object literals because I like the
>>>>>>> idea since it does not add any change in the parser.
>>>>>>> Do you remember what were the problem raised by this solution (beside
>>>>>>> the fact that it had too many # and the order was like in ston not
>>>>>>> explicit).
>>>>>>>
>>>>>>> I would love to have another pass on the idea of Igor.
>>>>>>
>>>>>> What I don't like about it is that the object literal exposes the internal implementation of the object. Everything is based on index. So it could suffer the same problem as fuel. When you don't have the exact same code the deserialization fails.
>>>>>
>>>>> Indeed this is why
>>>>> { 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
>>>>> could be more robust.
>>>>> We could extend the object literal syntax to use association for non
>>>>> collection.
>>>>>
>>>> I think it is more robust and more explicit. I do not know what are the semantics of detecting something as #Point being a class name. Is it then forbidden to use symbols with uppercase letters? I think something like
>>>>
>>>> { #x -> 10 . #y -> 20} asObjectOf: #Point
>>>>
>>>> is handling the format with implicit knowledge of type. While the explicit version would be
>>>>
>>>> { #Point -> { #x -> 10 . #y -> 20}} asObject
>>>>
>>>> And then nested objects are as easy as
>>>>
>>>> {#PointCollection -> {
>>>> #points -> { {#Point -> { #x -> 10 . #y -> 20} }.
>>>> {#Point -> { #x -> 5 . #y -> 8} } } } asObject
>>>
>>> The -> messages are just noise and add additional processing for nothing. This is just as effective:
>>>
>>> { #Point. { #x. 10 . #y. 20}} asObject
>>>
>>> {#PointCollection. { #points. { {#Point. { #x. 10 . #y. 20} }.
>>> {#Point. { #x. 5 . #y. 8} } } } asObject
>>>
>>> So an object is a pair of a class name and an array of slot specifier pairs, and a slot specifier is a pair of a slot band and a value. And of course that means that many object specs can be literal, which is useful for storing in pragmas etc:
>>>
>>> #(PointCollection
>>> (points ((Point (x 10 y 20))
>>> ((Point (x 5 y 8)))) asObject
>>>
>>>
>> Agreed. My first impression was it should be something like S-expression which your example is. I was misled by the idea it should be closer to the programming syntax. But a parser does not care if implemented properly, that's right. I like the compactness of that format but still find it a bit hard to read if there is only pairs. As this object literal syntax is meant to be written in code it is important that it reads well even if there are noisy characters.
>>
>>
>>>>
>>>> would give a PointCollection of two point objects. My future wish would be that there is an object literal parser that takes all of the information from the format. And then a object literal parser that is aware of slot information. Meaning that the type information can be gathered from the object class instead having it to write in the format. In the PointCollection the slot for points would have the type information #Point attached. The format goes then to
>>>>
>>>> { #points -> {
>>>> { #x -> 10 . #y -> 20 }.
>>>> { #x -> 5 . #y -> 8 } }
>>>>
>>>> which would then the equivalent to something like JSON
>>>>
>>>> { "points" : [
>>>> { "x" : 10, "y" : 20 },
>>>> { "x" : 5, "y" : 8 } ] }
>>>>
>>>> What I don't know is how to solve the difference between a dictionary and an collection of associations.
>>>
>>> That's incidental to the format, internal to the parser. If the parser chooses to build a dictionary as it parses so be it. The point is that the output is as you specify; a tree of objects.
>>>
>>> The thing to think about is how to introduce labels so that sub objects can be shared in the graph, the naïve deepCopy vs deepCopyUsing: issue.
>>
>> I'm not sure this is necessary. It should be a format to easily instantiate a small tree of objects. Making it build a graph instead of a tree makes everything much more complicated. Either we decide that STON can do the full set and in that case it is probably less valuable to have a simple syntax to write in code. Or we need to break pairs rule. In that case an object definition can have an optional third argument which would be the label for the object. The draback is that the label needs to be before the array of slots
>>
>> { :v1 #ValueHolder { 'contents' . { ValueHolder . { 'contents' . @v1 }}}}
>>
>> Or something like this. It would be in theory closer to STON using the @ reference. The difference is that STON has indexed object access and that variant would make it based on labels.Or something like this.
>>
>> Norbert
>>
>>>
>>>
>>>
>>>>
>>>> Norbert
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>> As a dictionary is both, an array of associations and a key-value store, it works perfectly there. But for other objects I have doubts. Especially is in a lot of contexts you need to have a mapping of internal state to external representation. It can be applied afterwards but I'm not sure that can work all the time.
>>>>>
>>>>> Yes after we should focus on the frequent cases. And may be having a
>>>>> literal syntax for dictionary would be good enough.
>>>>>
>>>>> I will do another version of igor's proposal with associations to see
>>>>> how it feels.
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> my 2 cents,
>>>>>>
>>>>>> Norbert
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Stef
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------- Forwarded message ----------
>>>>>>> From: Igor Stasenko <siguctua(a)gmail.com <mailto:siguctua@gmail.com>>
>>>>>>> Date: Fri, Oct 19, 2012 at 1:09 PM
>>>>>>> Subject: [Pharo-project] Yet another Notation format: Object literals
>>>>>>> To: Pharo Development <Pharo-project(a)lists.gforge.inria.fr <mailto:Pharo-project@lists.gforge.inria.fr>>
>>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>> as i promised before, here the simple smalltalk-based literal format.
>>>>>>> It based on smalltalk syntax, and so, unlike JSON, it doesn't needs to
>>>>>>> have separate parser (a normal smalltalk parser used for that).
>>>>>>>
>>>>>>> The idea is quite simple:
>>>>>>> you can tell any object to represent itself as an 'object literal' ,
>>>>>>> for example:
>>>>>>>
>>>>>>> (1@3) asObjectLiteral
>>>>>>> --> #(#Point 1 3)
>>>>>>>
>>>>>>> { 1@2. 3@4. true. false . nil } asObjectLiteral
>>>>>>>
>>>>>>> -> #(#Array #(#Point 1 2) #(#Point 3 4) true false nil)
>>>>>>>
>>>>>>> (Dictionary newFromPairs: { 1->#(1 2 3) . 'foo' -> 'bar' }) asObjectLiteral
>>>>>>> ->
>>>>>>> #(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar')
>>>>>>>
>>>>>>> Next thing, you can 'pretty-print' it (kinda):
>>>>>>>
>>>>>>> #(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar') printObjectLiteral
>>>>>>>
>>>>>>> '#(#Dictionary
>>>>>>> 1
>>>>>>> (#Array 1 2 3)
>>>>>>> ''foo'' ''bar'')'
>>>>>>>
>>>>>>>
>>>>>>> and sure thing, you can do reverse conversion:
>>>>>>>
>>>>>>> '#(#Dictionary
>>>>>>> 1
>>>>>>> (#Array 1 2 3)
>>>>>>> ''foo'' ''bar'')' parseAsObjectLiteral
>>>>>>>
>>>>>>> a Dictionary('foo'->'bar' 1->#(1 2 3) )
>>>>>>>
>>>>>>> Initially, i thought that it could be generic (by implementing default
>>>>>>> Object>>#asObjectLiteral),
>>>>>>> but then after discussing it with others, we decided to leave
>>>>>>>
>>>>>>> Object>>#asObjectLiteral to be a subclass responsibility.
>>>>>>> So, potentially the format allows to represent any object(s) as
>>>>>>> literals, except from circular referencing objects, of course.
>>>>>>>
>>>>>>> The implementation is fairly simple, as you may guess and contains no
>>>>>>> new classes, but just extension methods here and there.
>>>>>>>
>>>>>>> Take it with grain and salt, since it is just a small proof of
>>>>>>> concept. (And if doing it for real it may need some changes etc).
>>>>>>> Since i am far from areas right now, where it can be used, i don't
>>>>>>> want to pursue it further or advocate if this is the right way to do
>>>>>>> things.
>>>>>>> Neither i having a public repository for this project..
>>>>>>>
>>>>>>> So, if there anyone who willing to pick it up and pursue the idea
>>>>>>> further, please feel free to do so and make a public repository for
>>>>>>> project.
July 4, 2017
Re: [Pharo-dev] Reflecting on data (literal) object syntax
by Christian Haider
Hi Norbert,
yes, that is the point: it is a normal Smalltalk expression.
It is trivial and every Smalltalk understands it.
No need for special parsers; you just have class names and constructor methods.
I believe this is a very compact and simple representation of Smalltalk objects.
The Values package contains mainly the machinery to print an object (aka Value) as String so that it can be reconstructed from it.
Exactly like Smalltalk prints literal objects like Array, Integer, Character, String, Symbol etc.
The superclass Value makes sure that the object tree (remember â no cycles or references) will print properly (under consideration of namespaces).
Also, many âsimpleâ base objects can be turned into Values by implementing constructors and the printer (like Date, Timestamp, Point, Rectangle, ColorValue etc.).
Additionally, Values allow to declare optional instVars, so that the representation does not get too cluttered with boilerplate arguments.
In the dev tools, there is a generator which produces the proper constructors (2**<number of defaults>).
There is really not much to it, technically. Maybe it is just too simple.
I would be interested in the differences to the other proposals â what should be achieved and what may be missing?
HTH,
Christian
Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Norbert Hartl
Gesendet: Dienstag, 4. Juli 2017 08:14
An: Pharo Development List <pharo-dev(a)lists.pharo.org>
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Hi Christian,
Am 03.07.2017 um 11:06 schrieb Christian Haider <christian.haider(a)smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com> >:
I solved this with Values[1] for VW and I am very happy with it (using it intensively/routinely).
Your example would look like:
(PointCollection points: (Array
with: (Point x: 10 y: 20)
with: (Point x: 5 y: 8)
))
I do not understand your point. Above is a normal smalltalk expression. I skimmed through the Values document and I do not get how this is related to a discussion about
compact object literal syntax.
Can you elaborate a bit more? How do Values help here?
Norbert
As you see, it is the same except that lots of noise is gone.
Drawbacks: only literal objects (like Values) are allowed; i.e. no cyclic structures (same with JSON etc.)
and the order of arguments is fixed unlike JSON (but you can add constructors for every permutation :)).
I think this is very clear and direct (no magic from parsers etc.). I like it most for configurations (see everything at a glance) and interface data.
Best,
Christian
[1] https://wiki.pdftalk.de/doku.php?id=complexvalues
Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Norbert Hartl
Gesendet: Montag, 3. Juli 2017 10:28
An: Pharo Dev <pharo-dev(a)lists.pharo.org <mailto:pharo-dev@lists.pharo.org> >
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Eliot,
Am 01.07.2017 um 20:22 schrieb Eliot Miranda <eliot.miranda(a)gmail.com <mailto:eliot.miranda@gmail.com> >:
Hi Norbert,
On Jul 1, 2017, at 7:36 AM, Norbert Hartl <norbert(a)hartl.name <mailto:norbert@hartl.name> > wrote:
Am 30.06.2017 um 21:14 schrieb Stephane Ducasse <stepharo.self(a)gmail.com <mailto:stepharo.self@gmail.com> >:
But what is DataFrame?
the new collection done by alesnedr from Lviv. It is really nice but
does not solve the problem of the compact syntax.
STON fromString: 'Point[10,20]'
Same goes for JSON.
We were brainstorming with marcus and we could have a first nice extension:
{ 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
10@20
Now in addition I think that there is a value in having an object
literal syntax.
I pasted the old mail of igor on object literals because I like the
idea since it does not add any change in the parser.
Do you remember what were the problem raised by this solution (beside
the fact that it had too many # and the order was like in ston not
explicit).
I would love to have another pass on the idea of Igor.
What I don't like about it is that the object literal exposes the internal implementation of the object. Everything is based on index. So it could suffer the same problem as fuel. When you don't have the exact same code the deserialization fails.
Indeed this is why
{ 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
could be more robust.
We could extend the object literal syntax to use association for non
collection.
I think it is more robust and more explicit. I do not know what are the semantics of detecting something as #Point being a class name. Is it then forbidden to use symbols with uppercase letters? I think something like
{ #x -> 10 . #y -> 20} asObjectOf: #Point
is handling the format with implicit knowledge of type. While the explicit version would be
{ #Point -> { #x -> 10 . #y -> 20}} asObject
And then nested objects are as easy as
{#PointCollection -> {
#points -> { {#Point -> { #x -> 10 . #y -> 20} }.
{#Point -> { #x -> 5 . #y -> 8} } } } asObject
The -> messages are just noise and add additional processing for nothing. This is just as effective:
{ #Point. { #x. 10 . #y. 20}} asObject
{#PointCollection. { #points. { {#Point. { #x. 10 . #y. 20} }.
{#Point. { #x. 5 . #y. 8} } } } asObject
So an object is a pair of a class name and an array of slot specifier pairs, and a slot specifier is a pair of a slot band and a value. And of course that means that many object specs can be literal, which is useful for storing in pragmas etc:
#(PointCollection
(points ((Point (x 10 y 20))
((Point (x 5 y 8)))) asObject
Agreed. My first impression was it should be something like S-expression which your example is. I was misled by the idea it should be closer to the programming syntax. But a parser does not care if implemented properly, that's right. I like the compactness of that format but still find it a bit hard to read if there is only pairs. As this object literal syntax is meant to be written in code it is important that it reads well even if there are noisy characters.
would give a PointCollection of two point objects. My future wish would be that there is an object literal parser that takes all of the information from the format. And then a object literal parser that is aware of slot information. Meaning that the type information can be gathered from the object class instead having it to write in the format. In the PointCollection the slot for points would have the type information #Point attached. The format goes then to
{ #points -> {
{ #x -> 10 . #y -> 20 }.
{ #x -> 5 . #y -> 8 } }
which would then the equivalent to something like JSON
{ "points" : [
{ "x" : 10, "y" : 20 },
{ "x" : 5, "y" : 8 } ] }
What I don't know is how to solve the difference between a dictionary and an collection of associations.
That's incidental to the format, internal to the parser. If the parser chooses to build a dictionary as it parses so be it. The point is that the output is as you specify; a tree of objects.
The thing to think about is how to introduce labels so that sub objects can be shared in the graph, the naïve deepCopy vs deepCopyUsing: issue.
I'm not sure this is necessary. It should be a format to easily instantiate a small tree of objects. Making it build a graph instead of a tree makes everything much more complicated. Either we decide that STON can do the full set and in that case it is probably less valuable to have a simple syntax to write in code. Or we need to break pairs rule. In that case an object definition can have an optional third argument which would be the label for the object. The draback is that the label needs to be before the array of slots
{ :v1 #ValueHolder { 'contents' . { ValueHolder . { 'contents' . @v1 }}}}
Or something like this. It would be in theory closer to STON using the @ reference. The difference is that STON has indexed object access and that variant would make it based on labels.Or something like this.
Norbert
Norbert
As a dictionary is both, an array of associations and a key-value store, it works perfectly there. But for other objects I have doubts. Especially is in a lot of contexts you need to have a mapping of internal state to external representation. It can be applied afterwards but I'm not sure that can work all the time.
Yes after we should focus on the frequent cases. And may be having a
literal syntax for dictionary would be good enough.
I will do another version of igor's proposal with associations to see
how it feels.
my 2 cents,
Norbert
Stef
---------- Forwarded message ----------
From: Igor Stasenko <siguctua(a)gmail.com <mailto:siguctua@gmail.com> >
Date: Fri, Oct 19, 2012 at 1:09 PM
Subject: [Pharo-project] Yet another Notation format: Object literals
To: Pharo Development <Pharo-project(a)lists.gforge.inria.fr <mailto:Pharo-project@lists.gforge.inria.fr> >
Hi,
as i promised before, here the simple smalltalk-based literal format.
It based on smalltalk syntax, and so, unlike JSON, it doesn't needs to
have separate parser (a normal smalltalk parser used for that).
The idea is quite simple:
you can tell any object to represent itself as an 'object literal' ,
for example:
(1@3) asObjectLiteral
--> #(#Point 1 3)
{ 1@2. 3@4. true. false . nil } asObjectLiteral
-> #(#Array #(#Point 1 2) #(#Point 3 4) true false nil)
(Dictionary newFromPairs: { 1->#(1 2 3) . 'foo' -> 'bar' }) asObjectLiteral
->
#(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar')
Next thing, you can 'pretty-print' it (kinda):
#(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar') printObjectLiteral
'#(#Dictionary
1
(#Array 1 2 3)
''foo'' ''bar'')'
and sure thing, you can do reverse conversion:
'#(#Dictionary
1
(#Array 1 2 3)
''foo'' ''bar'')' parseAsObjectLiteral
a Dictionary('foo'->'bar' 1->#(1 2 3) )
Initially, i thought that it could be generic (by implementing default
Object>>#asObjectLiteral),
but then after discussing it with others, we decided to leave
Object>>#asObjectLiteral to be a subclass responsibility.
So, potentially the format allows to represent any object(s) as
literals, except from circular referencing objects, of course.
The implementation is fairly simple, as you may guess and contains no
new classes, but just extension methods here and there.
Take it with grain and salt, since it is just a small proof of
concept. (And if doing it for real it may need some changes etc).
Since i am far from areas right now, where it can be used, i don't
want to pursue it further or advocate if this is the right way to do
things.
Neither i having a public repository for this project..
So, if there anyone who willing to pick it up and pursue the idea
further, please feel free to do so and make a public repository for
project.
July 4, 2017
Re: [Pharo-dev] Reflecting on data (literal) object syntax
by Norbert Hartl
Hi Christian,
> Am 03.07.2017 um 11:06 schrieb Christian Haider <christian.haider(a)smalltalked-visuals.com>:
>
> I solved this with Values[1] for VW and I am very happy with it (using it intensively/routinely).
> Your example would look like:
>
> (PointCollection points: (Array
> with: (Point x: 10 y: 20)
> with: (Point x: 5 y: 8)
> ))
>
I do not understand your point. Above is a normal smalltalk expression. I skimmed through the Values document and I do not get how this is related to a discussion about
compact object literal syntax.
Can you elaborate a bit more? How do Values help here?
Norbert
> As you see, it is the same except that lots of noise is gone.
> Drawbacks: only literal objects (like Values) are allowed; i.e. no cyclic structures (same with JSON etc.)
> and the order of arguments is fixed unlike JSON (but you can add constructors for every permutation J).
>
> I think this is very clear and direct (no magic from parsers etc.). I like it most for configurations (see everything at a glance) and interface data.
>
> Best,
> Christian
>
> [1] https://wiki.pdftalk.de/doku.php?id=complexvalues
>
> Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Norbert Hartl
> Gesendet: Montag, 3. Juli 2017 10:28
> An: Pharo Dev <pharo-dev(a)lists.pharo.org>
> Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
>
> Eliot,
>
> Am 01.07.2017 um 20:22 schrieb Eliot Miranda <eliot.miranda(a)gmail.com>:
>
> Hi Norbert,
>
>
>
> On Jul 1, 2017, at 7:36 AM, Norbert Hartl <norbert(a)hartl.name> wrote:
>
>
>
> Am 30.06.2017 um 21:14 schrieb Stephane Ducasse <stepharo.self(a)gmail.com>:
>
> But what is DataFrame?
>
> the new collection done by alesnedr from Lviv. It is really nice but
> does not solve the problem of the compact syntax.
>
>
>
> STON fromString: 'Point[10,20]'
>
> Same goes for JSON.
>
>
> We were brainstorming with marcus and we could have a first nice extension:
>
> { 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
>
> 10@20
>
> Now in addition I think that there is a value in having an object
> literal syntax.
>
> I pasted the old mail of igor on object literals because I like the
> idea since it does not add any change in the parser.
> Do you remember what were the problem raised by this solution (beside
> the fact that it had too many # and the order was like in ston not
> explicit).
>
> I would love to have another pass on the idea of Igor.
>
> What I don't like about it is that the object literal exposes the internal implementation of the object. Everything is based on index. So it could suffer the same problem as fuel. When you don't have the exact same code the deserialization fails.
>
> Indeed this is why
> { 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
> could be more robust.
> We could extend the object literal syntax to use association for non
> collection.
>
> I think it is more robust and more explicit. I do not know what are the semantics of detecting something as #Point being a class name. Is it then forbidden to use symbols with uppercase letters? I think something like
>
> { #x -> 10 . #y -> 20} asObjectOf: #Point
>
> is handling the format with implicit knowledge of type. While the explicit version would be
>
> { #Point -> { #x -> 10 . #y -> 20}} asObject
>
> And then nested objects are as easy as
>
> {#PointCollection -> {
> #points -> { {#Point -> { #x -> 10 . #y -> 20} }.
> {#Point -> { #x -> 5 . #y -> 8} } } } asObject
>
> The -> messages are just noise and add additional processing for nothing. This is just as effective:
>
> { #Point. { #x. 10 . #y. 20}} asObject
>
> {#PointCollection. { #points. { {#Point. { #x. 10 . #y. 20} }.
> {#Point. { #x. 5 . #y. 8} } } } asObject
>
> So an object is a pair of a class name and an array of slot specifier pairs, and a slot specifier is a pair of a slot band and a value. And of course that means that many object specs can be literal, which is useful for storing in pragmas etc:
>
> #(PointCollection
> (points ((Point (x 10 y 20))
> ((Point (x 5 y 8)))) asObject
>
> Agreed. My first impression was it should be something like S-expression which your example is. I was misled by the idea it should be closer to the programming syntax. But a parser does not care if implemented properly, that's right. I like the compactness of that format but still find it a bit hard to read if there is only pairs. As this object literal syntax is meant to be written in code it is important that it reads well even if there are noisy characters.
>
>
> would give a PointCollection of two point objects. My future wish would be that there is an object literal parser that takes all of the information from the format. And then a object literal parser that is aware of slot information. Meaning that the type information can be gathered from the object class instead having it to write in the format. In the PointCollection the slot for points would have the type information #Point attached. The format goes then to
>
> { #points -> {
> { #x -> 10 . #y -> 20 }.
> { #x -> 5 . #y -> 8 } }
>
> which would then the equivalent to something like JSON
>
> { "points" : [
> { "x" : 10, "y" : 20 },
> { "x" : 5, "y" : 8 } ] }
>
> What I don't know is how to solve the difference between a dictionary and an collection of associations.
>
> That's incidental to the format, internal to the parser. If the parser chooses to build a dictionary as it parses so be it. The point is that the output is as you specify; a tree of objects.
>
> The thing to think about is how to introduce labels so that sub objects can be shared in the graph, the naïve deepCopy vs deepCopyUsing: issue.
>
> I'm not sure this is necessary. It should be a format to easily instantiate a small tree of objects. Making it build a graph instead of a tree makes everything much more complicated. Either we decide that STON can do the full set and in that case it is probably less valuable to have a simple syntax to write in code. Or we need to break pairs rule. In that case an object definition can have an optional third argument which would be the label for the object. The draback is that the label needs to be before the array of slots
>
> { :v1 #ValueHolder { 'contents' . { ValueHolder . { 'contents' . @v1 }}}}
>
> Or something like this. It would be in theory closer to STON using the @ reference. The difference is that STON has indexed object access and that variant would make it based on labels.Or something like this.
>
> Norbert
>
>
>
>
> Norbert
>
>
>
>
> As a dictionary is both, an array of associations and a key-value store, it works perfectly there. But for other objects I have doubts. Especially is in a lot of contexts you need to have a mapping of internal state to external representation. It can be applied afterwards but I'm not sure that can work all the time.
>
> Yes after we should focus on the frequent cases. And may be having a
> literal syntax for dictionary would be good enough.
>
> I will do another version of igor's proposal with associations to see
> how it feels.
>
>
>
> my 2 cents,
>
> Norbert
>
>
>
> Stef
>
>
>
>
> ---------- Forwarded message ----------
> From: Igor Stasenko <siguctua(a)gmail.com>
> Date: Fri, Oct 19, 2012 at 1:09 PM
> Subject: [Pharo-project] Yet another Notation format: Object literals
> To: Pharo Development <Pharo-project(a)lists.gforge.inria.fr>
>
>
> Hi,
> as i promised before, here the simple smalltalk-based literal format.
> It based on smalltalk syntax, and so, unlike JSON, it doesn't needs to
> have separate parser (a normal smalltalk parser used for that).
>
> The idea is quite simple:
> you can tell any object to represent itself as an 'object literal' ,
> for example:
>
> (1@3) asObjectLiteral
> --> #(#Point 1 3)
>
> { 1@2. 3@4. true. false . nil } asObjectLiteral
>
> -> #(#Array #(#Point 1 2) #(#Point 3 4) true false nil)
>
> (Dictionary newFromPairs: { 1->#(1 2 3) . 'foo' -> 'bar' }) asObjectLiteral
> ->
> #(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar')
>
> Next thing, you can 'pretty-print' it (kinda):
>
> #(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar') printObjectLiteral
>
> '#(#Dictionary
> 1
> (#Array 1 2 3)
> ''foo'' ''bar'')'
>
>
> and sure thing, you can do reverse conversion:
>
> '#(#Dictionary
> 1
> (#Array 1 2 3)
> ''foo'' ''bar'')' parseAsObjectLiteral
>
> a Dictionary('foo'->'bar' 1->#(1 2 3) )
>
> Initially, i thought that it could be generic (by implementing default
> Object>>#asObjectLiteral),
> but then after discussing it with others, we decided to leave
>
> Object>>#asObjectLiteral to be a subclass responsibility.
> So, potentially the format allows to represent any object(s) as
> literals, except from circular referencing objects, of course.
>
> The implementation is fairly simple, as you may guess and contains no
> new classes, but just extension methods here and there.
>
> Take it with grain and salt, since it is just a small proof of
> concept. (And if doing it for real it may need some changes etc).
> Since i am far from areas right now, where it can be used, i don't
> want to pursue it further or advocate if this is the right way to do
> things.
> Neither i having a public repository for this project..
>
> So, if there anyone who willing to pick it up and pursue the idea
> further, please feel free to do so and make a public repository for
> project.
>
July 4, 2017
Re: [Pharo-dev] Reflecting on data (literal) object syntax
by Christian Haider
Hi Thorsten.
c) both are licensed with the MIT license
Values since 2009 and PDF4Smalltalk since 2011
The current versions are in the Public Store at Cincom:
Bundle {Values Development} (1.2.0.0, chaider) 12.5.2017 and
Bundle {PDF Development} (1.4.5.0, chaider) 1.12.2016
The current landing pages are [1] and [2].
Values should be very easy to port. It does not use namespaces and is rather trivial.
[1] https://wiki.pdftalk.de/doku.php?id=complexvalues
[2] http://christianhaider.de/dokuwiki/doku.php?id=pdf:pdf4smalltalk
> -----Ursprüngliche Nachricht-----
> Von: Torsten Bergmann [mailto:astares@gmx.de]
> Gesendet: Montag, 3. Juli 2017 21:36
> An: pharo-dev(a)lists.pharo.org
> Cc: Pharo Development List <pharo-dev(a)lists.pharo.org>;
> christian.haider(a)smalltalked-visuals.com
> Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
>
> Hi Christian,
>
> just to avoid confusions: What was released with MIT license now:
>
> a) the Values code
> b) the pdf4smalltalk code
> c) or both
>
> and where can one find the latest release in case interested people want to
> start a port to Pharo?
>
> Thanks in advance for any clarification!
>
> Bye
> Torsten
>
>
>
> Gesendet: Montag, 03. Juli 2017 um 18:54 Uhr
> Von: "Ben Coman" <btc(a)openinworld.com>
> An: "Pharo Development List" <pharo-dev(a)lists.pharo.org>
> Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
>
> Thanks Christian for the open release of pdf4smalltalk. Sorry I aborted the
> two times I started to port it to Pharo. The task of dealing with both file
> format and namespace differences to synchronise with VW was too big for
> me. Now with Iceberg, if VisualWorks might work with git that would knock
> down one barrier and I might have another go.
>
> On Mon, Jul 3, 2017 at 5:45 PM, Christian Haider
> <christian.haider@smalltalked-
> visuals.com[mailto:christian.haider@smalltalked-visuals.com]> wrote:
>
> I did
>
>
> Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org[mailto:pharo-
> dev-bounces(a)lists.pharo.org]] Im Auftrag von Serge Stinckwich
> Gesendet: Montag, 3. Juli 2017 11:40
> An: Pharo Development List <pharo-dev@lists.pharo.org[mailto:pharo-
> dev(a)lists.pharo.org]>
>
> Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
>
>
>
>
> Hi Christian,
>
>
>
> interesting ! Maybe you can release your software with an MIT licence ?
>
>
>
> Regards,
>
>
>
> On Mon, Jul 3, 2017 at 10:06 AM, Christian Haider
> <christian.haider@smalltalked-
> visuals.com[mailto:christian.haider@smalltalked-visuals.com]> wrote:
>
> I solved this with Values[1] for VW and I am very happy with it (using it
> intensively/routinely).
> Your example would look like:
>
> (PointCollection points: (Array
> with: (Point x: 10 y: 20)
> with: (Point x: 5 y: 8)
> ))
>
>
> And I remember you saying pdf4smalltalk relied heavily on this, so having
> Values integrated (if it was broadly useful) would also be a minor step in
> porting pdf4smalltalk to Pharo.
>
> cheers -ben
>
>
>
> As you see, it is the same except that lots of noise is gone.
> Drawbacks: only literal objects (like Values) are allowed; i.e. no cyclic
> structures (same with JSON etc.) and the order of arguments is fixed unlike
> JSON (but you can add constructors for every permutation J).
>
> I think this is very clear and direct (no magic from parsers etc.). I like it most
> for configurations (see everything at a glance) and interface data.
>
> Best,
> Christian
>
> [1]
> https://wiki.pdftalk.de/doku.php?id=complexvalues[https://wiki.pdftalk.de
> /doku.php?id=complexvalues]
>
>
> Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org[mailto:pharo-
> dev-bounces(a)lists.pharo.org]] Im Auftrag von Norbert Hartl
> Gesendet: Montag, 3. Juli 2017 10:28
> An: Pharo Dev <pharo-dev@lists.pharo.org[mailto:pharo-
> dev(a)lists.pharo.org]>
> Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
>
>
> Eliot,
>
>
>
> Am 01.07.2017 um 20:22 schrieb Eliot Miranda
> <eliot.miranda@gmail.com[mailto:eliot.miranda@gmail.com]>:
>
>
> Hi Norbert,
>
>
> On Jul 1, 2017, at 7:36 AM, Norbert Hartl
> <norbert@hartl.name[mailto:norbert@hartl.name]> wrote:
>
>
> Am 30.06.2017 um 21:14 schrieb Stephane Ducasse
> <stepharo.self@gmail.com[mailto:stepharo.self@gmail.com]>:
>
> But what is DataFrame?
>
> the new collection done by alesnedr from Lviv. It is really nice but does not
> solve the problem of the compact syntax.
>
>
> STON fromString: 'Point[10,20]'
> Same goes for JSON.
>
> We were brainstorming with marcus and we could have a first nice
> extension:
>
> { 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
> 10@20
>
> Now in addition I think that there is a value in having an object literal syntax.
>
> I pasted the old mail of igor on object literals because I like the idea since it
> does not add any change in the parser.
> Do you remember what were the problem raised by this solution (beside the
> fact that it had too many # and the order was like in ston not explicit).
>
> I would love to have another pass on the idea of Igor.
>
> What I don't like about it is that the object literal exposes the internal
> implementation of the object. Everything is based on index. So it could suffer
> the same problem as fuel. When you don't have the exact same code the
> deserialization fails.
>
> Indeed this is why
> { 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
> could be more robust.
> We could extend the object literal syntax to use association for non
> collection.
> I think it is more robust and more explicit. I do not know what are the
> semantics of detecting something as #Point being a class name. Is it then
> forbidden to use symbols with uppercase letters? I think something like
>
> { #x -> 10 . #y -> 20} asObjectOf: #Point
>
> is handling the format with implicit knowledge of type. While the explicit
> version would be
>
> { #Point -> { #x -> 10 . #y -> 20}} asObject
>
> And then nested objects are as easy as
>
> {#PointCollection -> {
> #points -> { {#Point -> { #x -> 10 . #y -> 20} }.
> {#Point -> { #x -> 5 . #y -> 8} } } } asObject
>
> The -> messages are just noise and add additional processing for
> nothing. This is just as effective:
>
> { #Point. { #x. 10 . #y. 20}} asObject
>
> {#PointCollection. { #points. { {#Point. { #x. 10 . #y. 20} }.
> {#Point. { #x. 5 . #y. 8} } } } asObject
>
> So an object is a pair of a class name and an array of slot specifier pairs, and a
> slot specifier is a pair of a slot band and a value. And of course that means
> that many object specs can be literal, which is useful for storing in pragmas
> etc:
>
> #(PointCollection
> (points ((Point (x 10 y 20))
> ((Point (x 5 y 8)))) asObject Agreed. My first impression was it
> should be something like S-expression which your example is. I was misled
> by the idea it should be closer to the programming syntax. But a parser does
> not care if implemented properly, that's right. I like the compactness of that
> format but still find it a bit hard to read if there is only pairs. As this object
> literal syntax is meant to be written in code it is important that it reads well
> even if there are noisy characters.
>
> would give a PointCollection of two point objects. My future wish would be
> that there is an object literal parser that takes all of the information from the
> format. And then a object literal parser that is aware of slot information.
> Meaning that the type information can be gathered from the object class
> instead having it to write in the format. In the PointCollection the slot for
> points would have the type information #Point attached. The format goes
> then to
>
> { #points -> {
> { #x -> 10 . #y -> 20 }.
> { #x -> 5 . #y -> 8 } }
>
> which would then the equivalent to something like JSON
>
> { "points" : [
> { "x" : 10, "y" : 20 },
> { "x" : 5, "y" : 8 } ] }
>
> What I don't know is how to solve the difference between a dictionary and
> an collection of associations.
>
> That's incidental to the format, internal to the parser. If the parser chooses
> to build a dictionary as it parses so be it. The point is that the output is as you
> specify; a tree of objects.
>
> The thing to think about is how to introduce labels so that sub objects can be
> shared in the graph, the naïve deepCopy vs deepCopyUsing: issue.
>
>
> I'm not sure this is necessary. It should be a format to easily instantiate a
> small tree of objects. Making it build a graph instead of a tree makes
> everything much more complicated. Either we decide that STON can do the
> full set and in that case it is probably less valuable to have a simple syntax to
> write in code. Or we need to break pairs rule. In that case an object definition
> can have an optional third argument which would be the label for the object.
> The draback is that the label needs to be before the array of slots
>
>
>
> { :v1 #ValueHolder { 'contents' . { ValueHolder . { 'contents' . @v1 }}}}
>
>
>
> Or something like this. It would be in theory closer to STON using the @
> reference. The difference is that STON has indexed object access and that
> variant would make it based on labels.Or something like this.
>
>
>
> Norbert
>
>
>
>
>
> Norbert
>
>
>
> As a dictionary is both, an array of associations and a key-value store, it works
> perfectly there. But for other objects I have doubts. Especially is in a lot of
> contexts you need to have a mapping of internal state to external
> representation. It can be applied afterwards but I'm not sure that can work
> all the time.
>
> Yes after we should focus on the frequent cases. And may be having a literal
> syntax for dictionary would be good enough.
>
> I will do another version of igor's proposal with associations to see how it
> feels.
>
>
> my 2 cents,
>
> Norbert
>
>
> Stef
>
>
>
>
> ---------- Forwarded message ----------
> From: Igor Stasenko <siguctua@gmail.com[mailto:siguctua@gmail.com]>
> Date: Fri, Oct 19, 2012 at 1:09 PM
> Subject: [Pharo-project] Yet another Notation format: Object literals
> To: Pharo Development <Pharo-project@lists.gforge.inria.fr[mailto:Pharo-
> project(a)lists.gforge.inria.fr]>
>
>
> Hi,
> as i promised before, here the simple smalltalk-based literal format.
> It based on smalltalk syntax, and so, unlike JSON, it doesn't needs to have
> separate parser (a normal smalltalk parser used for that).
>
> The idea is quite simple:
> you can tell any object to represent itself as an 'object literal' , for example:
>
> (1@3) asObjectLiteral
> --> #(#Point 1 3)
>
> { 1@2. 3@4. true. false . nil } asObjectLiteral
>
> -> #(#Array #(#Point 1 2) #(#Point 3 4) true false nil)
>
> (Dictionary newFromPairs: { 1->#(1 2 3) . 'foo' -> 'bar' }) asObjectLiteral
> ->
> #(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar')
>
> Next thing, you can 'pretty-print' it (kinda):
>
> #(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar') printObjectLiteral
>
> '#(#Dictionary
> 1
> (#Array 1 2 3)
> ''foo'' ''bar'')'
>
>
> and sure thing, you can do reverse conversion:
>
> '#(#Dictionary
> 1
> (#Array 1 2 3)
> ''foo'' ''bar'')' parseAsObjectLiteral
>
> a Dictionary('foo'->'bar' 1->#(1 2 3) )
>
> Initially, i thought that it could be generic (by implementing default
> Object>>#asObjectLiteral),
> but then after discussing it with others, we decided to leave
>
> Object>>#asObjectLiteral to be a subclass responsibility.
> So, potentially the format allows to represent any object(s) as literals, except
> from circular referencing objects, of course.
>
> The implementation is fairly simple, as you may guess and contains no new
> classes, but just extension methods here and there.
>
> Take it with grain and salt, since it is just a small proof of concept. (And if
> doing it for real it may need some changes etc).
> Since i am far from areas right now, where it can be used, i don't want to
> pursue it further or advocate if this is the right way to do things.
> Neither i having a public repository for this project..
>
> So, if there anyone who willing to pick it up and pursue the idea further,
> please feel free to do so and make a public repository for project.
>
>
>
>
>
> --
>
> Serge Stinckwich
> UCN & UMI UMMISCO 209 (IRD/UPMC)
> Every DSL ends up being Smalltalk
> http://www.doesnotunderstand.org/[http://www.doesnotunderstand.org/
> ]
July 4, 2017
Re: [Pharo-dev] Reflecting on data (literal) object syntax - porting PDF
by Christian Haider
Hi Ben,
at ESUG I will hopefully show the new version of the library with a new PDF type implementation which allows the classes to be freely (re)named.
This should make a port a lot easier.
Currently I am working on the port for Gemstone. If that works, it could be more than half the way towards a Pharo/Squeak version.
cheers
Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] Im Auftrag von Ben Coman
Gesendet: Montag, 3. Juli 2017 18:54
An: Pharo Development List <pharo-dev(a)lists.pharo.org>
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Thanks Christian for the open release of pdf4smalltalk. Sorry I aborted the two times I started to port it to Pharo. The task of dealing with both file format and namespace differences to synchronise with VW was too big for me. Now with Iceberg, if VisualWorks might work with git that would knock down one barrier and I might have another go.
On Mon, Jul 3, 2017 at 5:45 PM, Christian Haider <christian.haider(a)smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com> > wrote:
I did
Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org <mailto:pharo-dev-bounces@lists.pharo.org> ] Im Auftrag von Serge Stinckwich
Gesendet: Montag, 3. Juli 2017 11:40
An: Pharo Development List <pharo-dev(a)lists.pharo.org <mailto:pharo-dev@lists.pharo.org> >
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Hi Christian,
interesting ! Maybe you can release your software with an MIT licence ?
Regards,
On Mon, Jul 3, 2017 at 10:06 AM, Christian Haider <christian.haider(a)smalltalked-visuals.com <mailto:christian.haider@smalltalked-visuals.com> > wrote:
I solved this with Values[1] for VW and I am very happy with it (using it intensively/routinely).
Your example would look like:
(PointCollection points: (Array
with: (Point x: 10 y: 20)
with: (Point x: 5 y: 8)
))
And I remember you saying pdf4smalltalk relied heavily on this, so having Values integrated (if it was broadly useful) would also be a minor step in porting pdf4smalltalk to Pharo.
cheers -ben
As you see, it is the same except that lots of noise is gone.
Drawbacks: only literal objects (like Values) are allowed; i.e. no cyclic structures (same with JSON etc.)
and the order of arguments is fixed unlike JSON (but you can add constructors for every permutation :)).
I think this is very clear and direct (no magic from parsers etc.). I like it most for configurations (see everything at a glance) and interface data.
Best,
Christian
[1] https://wiki.pdftalk.de/doku.php?id=complexvalues
Von: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org <mailto:pharo-dev-bounces@lists.pharo.org> ] Im Auftrag von Norbert Hartl
Gesendet: Montag, 3. Juli 2017 10:28
An: Pharo Dev <pharo-dev(a)lists.pharo.org <mailto:pharo-dev@lists.pharo.org> >
Betreff: Re: [Pharo-dev] Reflecting on data (literal) object syntax
Eliot,
Am 01.07.2017 um 20:22 schrieb Eliot Miranda <eliot.miranda(a)gmail.com <mailto:eliot.miranda@gmail.com> >:
Hi Norbert,
On Jul 1, 2017, at 7:36 AM, Norbert Hartl <norbert(a)hartl.name <mailto:norbert@hartl.name> > wrote:
Am 30.06.2017 um 21:14 schrieb Stephane Ducasse <stepharo.self(a)gmail.com <mailto:stepharo.self@gmail.com> >:
But what is DataFrame?
the new collection done by alesnedr from Lviv. It is really nice but
does not solve the problem of the compact syntax.
STON fromString: 'Point[10,20]'
Same goes for JSON.
We were brainstorming with marcus and we could have a first nice extension:
{ 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
10@20
Now in addition I think that there is a value in having an object
literal syntax.
I pasted the old mail of igor on object literals because I like the
idea since it does not add any change in the parser.
Do you remember what were the problem raised by this solution (beside
the fact that it had too many # and the order was like in ston not
explicit).
I would love to have another pass on the idea of Igor.
What I don't like about it is that the object literal exposes the internal implementation of the object. Everything is based on index. So it could suffer the same problem as fuel. When you don't have the exact same code the deserialization fails.
Indeed this is why
{ 'x' -> 10 .'y' -> 20 } asObjectOf: #Point.
could be more robust.
We could extend the object literal syntax to use association for non
collection.
I think it is more robust and more explicit. I do not know what are the semantics of detecting something as #Point being a class name. Is it then forbidden to use symbols with uppercase letters? I think something like
{ #x -> 10 . #y -> 20} asObjectOf: #Point
is handling the format with implicit knowledge of type. While the explicit version would be
{ #Point -> { #x -> 10 . #y -> 20}} asObject
And then nested objects are as easy as
{#PointCollection -> {
#points -> { {#Point -> { #x -> 10 . #y -> 20} }.
{#Point -> { #x -> 5 . #y -> 8} } } } asObject
The -> messages are just noise and add additional processing for nothing. This is just as effective:
{ #Point. { #x. 10 . #y. 20}} asObject
{#PointCollection. { #points. { {#Point. { #x. 10 . #y. 20} }.
{#Point. { #x. 5 . #y. 8} } } } asObject
So an object is a pair of a class name and an array of slot specifier pairs, and a slot specifier is a pair of a slot band and a value. And of course that means that many object specs can be literal, which is useful for storing in pragmas etc:
#(PointCollection
(points ((Point (x 10 y 20))
((Point (x 5 y 8)))) asObject
Agreed. My first impression was it should be something like S-expression which your example is. I was misled by the idea it should be closer to the programming syntax. But a parser does not care if implemented properly, that's right. I like the compactness of that format but still find it a bit hard to read if there is only pairs. As this object literal syntax is meant to be written in code it is important that it reads well even if there are noisy characters.
would give a PointCollection of two point objects. My future wish would be that there is an object literal parser that takes all of the information from the format. And then a object literal parser that is aware of slot information. Meaning that the type information can be gathered from the object class instead having it to write in the format. In the PointCollection the slot for points would have the type information #Point attached. The format goes then to
{ #points -> {
{ #x -> 10 . #y -> 20 }.
{ #x -> 5 . #y -> 8 } }
which would then the equivalent to something like JSON
{ "points" : [
{ "x" : 10, "y" : 20 },
{ "x" : 5, "y" : 8 } ] }
What I don't know is how to solve the difference between a dictionary and an collection of associations.
That's incidental to the format, internal to the parser. If the parser chooses to build a dictionary as it parses so be it. The point is that the output is as you specify; a tree of objects.
The thing to think about is how to introduce labels so that sub objects can be shared in the graph, the naïve deepCopy vs deepCopyUsing: issue.
I'm not sure this is necessary. It should be a format to easily instantiate a small tree of objects. Making it build a graph instead of a tree makes everything much more complicated. Either we decide that STON can do the full set and in that case it is probably less valuable to have a simple syntax to write in code. Or we need to break pairs rule. In that case an object definition can have an optional third argument which would be the label for the object. The draback is that the label needs to be before the array of slots
{ :v1 #ValueHolder { 'contents' . { ValueHolder . { 'contents' . @v1 }}}}
Or something like this. It would be in theory closer to STON using the @ reference. The difference is that STON has indexed object access and that variant would make it based on labels.Or something like this.
Norbert
Norbert
As a dictionary is both, an array of associations and a key-value store, it works perfectly there. But for other objects I have doubts. Especially is in a lot of contexts you need to have a mapping of internal state to external representation. It can be applied afterwards but I'm not sure that can work all the time.
Yes after we should focus on the frequent cases. And may be having a
literal syntax for dictionary would be good enough.
I will do another version of igor's proposal with associations to see
how it feels.
my 2 cents,
Norbert
Stef
---------- Forwarded message ----------
From: Igor Stasenko <siguctua(a)gmail.com <mailto:siguctua@gmail.com> >
Date: Fri, Oct 19, 2012 at 1:09 PM
Subject: [Pharo-project] Yet another Notation format: Object literals
To: Pharo Development <Pharo-project(a)lists.gforge.inria.fr <mailto:Pharo-project@lists.gforge.inria.fr> >
Hi,
as i promised before, here the simple smalltalk-based literal format.
It based on smalltalk syntax, and so, unlike JSON, it doesn't needs to
have separate parser (a normal smalltalk parser used for that).
The idea is quite simple:
you can tell any object to represent itself as an 'object literal' ,
for example:
(1@3) asObjectLiteral
--> #(#Point 1 3)
{ 1@2. 3@4. true. false . nil } asObjectLiteral
-> #(#Array #(#Point 1 2) #(#Point 3 4) true false nil)
(Dictionary newFromPairs: { 1->#(1 2 3) . 'foo' -> 'bar' }) asObjectLiteral
->
#(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar')
Next thing, you can 'pretty-print' it (kinda):
#(#Dictionary 1 #(#Array 1 2 3) 'foo' 'bar') printObjectLiteral
'#(#Dictionary
1
(#Array 1 2 3)
''foo'' ''bar'')'
and sure thing, you can do reverse conversion:
'#(#Dictionary
1
(#Array 1 2 3)
''foo'' ''bar'')' parseAsObjectLiteral
a Dictionary('foo'->'bar' 1->#(1 2 3) )
Initially, i thought that it could be generic (by implementing default
Object>>#asObjectLiteral),
but then after discussing it with others, we decided to leave
Object>>#asObjectLiteral to be a subclass responsibility.
So, potentially the format allows to represent any object(s) as
literals, except from circular referencing objects, of course.
The implementation is fairly simple, as you may guess and contains no
new classes, but just extension methods here and there.
Take it with grain and salt, since it is just a small proof of
concept. (And if doing it for real it may need some changes etc).
Since i am far from areas right now, where it can be used, i don't
want to pursue it further or advocate if this is the right way to do
things.
Neither i having a public repository for this project..
So, if there anyone who willing to pick it up and pursue the idea
further, please feel free to do so and make a public repository for
project.
--
Serge Stinckwich
UCN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/
July 4, 2017
Re: [Pharo-dev] P6 crashed image
by David T. Lewis
Hi Hilaire,
I do not know if it will help in this case, but sometimes I have recovered from
similar problems by temporarily deleting a problem plugin (probably FT2Plugin.so
in this case). Sometimes that will allow you to open the image and save it again.
After that, you may be able to put the plugin back and run the image again.
Dave
On Sun, Jul 02, 2017 at 05:56:05PM +0200, Hilaire wrote:
> Hi,
>
> I got problem with my Pharo6 image when I save it, after some Glamour
> try out, don't know if it is related.
>
> When I saved the image, it grows to 292MB then stalled, with the mouse
> writing pointer. Then Pharo display became garbage. I have to kill the
> process.
>
> The image does not start anymore, get segmentation fault with Smalltalk
> stack dump, Freetype seems to be involved:
>
> Segmentation fault Sun Jul 2 17:52:39 2017
>
>
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/lib/pharo/5.0-201705310241/pharo
> Pharo VM version: 5.0-201705310241 Wed May 31 04:43:29 UTC 2017 gcc 4.6.3 [Production Spur 64-bit VM]
> Built from: CoInterpreter VMMaker.oscog-eem.2231 uuid: de62947a-7f40-4977-a232-e06a3a80c939 May 31 2017
> With: StackToRegisterMappingCogit VMMaker.oscog-eem.2227 uuid: 7ea146b4-39ce-4de7-afa3-a76ed1d1da35 May 31 2017
> Revision: VM: 201705310241 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $ Date: Tue May 30 19:41:27 2017 -0700 $
> Plugins: 201705310241 https://github.com/OpenSmalltalk/opensmalltalk-vm.git $
> Build host: Linux testing-gce-7baaea33-cad4-44b6-b0e5-7ad5f93c3335 3.13.0-115-generic #162~precise1-Ubuntu SMP Fri Mar 24 16:47:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
> plugin path: /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241 [default: /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/lib/pharo/5.0-201705310241/]
>
>
> C stack backtrace & registers:
> rax 0x49063940 rbx 0x490637d0 rcx 0x490639f8 rdx 0x49063888
> rdi 0x490635a8 rsi 0x490635a8 rbp 0x49063718 rsp 0x49063ab0
> r8 0x49062fe8 r9 0x490630a0 r10 0x49063158 r11 0x49063210
> r12 0x490632c8 r13 0x49063380 r14 0x49063438 r15 0x490634f0
> rip 0x49063b68
> *[0x7fff49063b68]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo[0x41cac1]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo[0x41ce4f]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0x10330)[0x7f4e70d53330]
> /usr/lib/x86_64-linux-gnu/libfreetype.so.6(FT_Stream_ReadULong+0x78)[0x7f4e6cc9c168]
> /usr/lib/x86_64-linux-gnu/libfreetype.so.6(+0x52116)[0x7f4e6ccdb116]
> /usr/lib/x86_64-linux-gnu/libfreetype.so.6(+0x26742)[0x7f4e6ccaf742]
> /usr/lib/x86_64-linux-gnu/libfreetype.so.6(+0x152e3)[0x7f4e6cc9e2e3]
> /usr/lib/x86_64-linux-gnu/libfreetype.so.6(FT_Open_Face+0x2a0)[0x7f4e6cca0070]
> /usr/lib/x86_64-linux-gnu/libfreetype.so.6(FT_New_Memory_Face+0x39)[0x7f4e6cca0669]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/FT2Plugin.so(primitiveNewMemoryFaceFromExternalMemoryAndIndex+0xea)[0x7f4e6cf309aa]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo[0x4572a7]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo(interpret+0xbd80)[0x467d80]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo[0x468651]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo(interpret+0x268)[0x45c268]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo(main+0x2ab)[0x419d6b]
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f4e70695f45]
> /home/hilaire/Travaux/Developpement/Pharo/vm/pharo64-linux-threaded-stable/bin/../lib/pharo/5.0-201705310241/pharo[0x41a055]
> [0x7fff49061d60]
>
>
> Smalltalk stack dump:
> 0x7fff490695d8 I FreeTypeFace(FT2Face)>newFaceFromExternalMemory:index: 0x4a83478: a(n) FreeTypeFace
> 0x7fff49069628 I FreeTypeFace>create 0x4a83478: a(n) FreeTypeFace
> 0x7fff49069668 I FreeTypeFace>validate 0x4a83478: a(n) FreeTypeFace
> 0x7fff490696a8 I FreeTypeFont>face 0x13c41758: a(n) FreeTypeFont
> 0x7fff490696e8 I FreeTypeFont>validate 0x13c41758: a(n) FreeTypeFont
> 0x7fff49069728 I LogicalFont>realFont 0x3015870: a(n) LogicalFont
> 0x7fff49069768 I LogicalFont>descent 0x3015870: a(n) LogicalFont
>
>
> --
> Dr. Geo
> http://drgeo.eu
>
July 4, 2017