> Le 4 janv. 2018 à 23:48, Kjell Godo <squeakl...@gmail.com> a écrit :
> 
> did you use a socket to communicate from Pharo to Python?
>      it does not sound like it     it sounds more one way
>      i am interested in using sockets to communicate between programs
>           but i haven't done much with it yet
>      maybe you can include sockets in your generated Python to talk
>           back to Pharo ?
>      i got Dolphin Smalltalk to talk to Pharo using a socket
>           but i kind of forgot about it


There is a concept of « Interpreter » in this framework. Basically, an 
interpreter is an object to which you provide strings containing Python 3 code 
and that execute it.

There is a FFI interpreter which writes the python code in a file on the file 
system and uses the int system(char *) function to make python execute the 
file. It also redirect stderr to a file and read that file after execution in 
order to have eventual execution errors.

There is a Atlas interpreter which uses the Atlas project from Kilon. Atlas 
makes Python and Pharo talk trough sockets. So this is what you want I guess. 
The thing is, if I want to send data from Python Pharo, I would use the Atlas 
interpreter and serialise data to send to Pharo through a socket as JSON for 
example. But for Matplotlib I do not need to read Python’s value so I did not 
implemented that. Nevertheless, it could be cool to have this ability to get 
Python’s data in Pharo because we could use Numpy or others Python modules for 
which getting Python's is important.

Another interesting thing when communicating through sockets between two 
different languages is: How do you manage callbacks? For example I would like 
to be able to make Python execute a Pharo Block at a certain point of the 
execution or to make Pharo execute a Python’s lambda. I do not have answer for 
that.

> did you look at Roassal ? Roassal does a lot of plotting they look very nice
>      they have mouse interactions and lots of cool stuff
>           but i don't know how they relate to other plotting programs
>      i imagine that Roassal tries to do things not done in other programs
>           but i don't really know     i looked at some other plotting thing 
> also
>           can't remember Sci something
>      Roassal has a nice declarative style that is nice
>           i want to use it a lot in future
>       i use Roassal in the Moose Pharo image because it is pre installed

Yes I know Roassal and I think this is a great project when you want to do 
interactive visualisations and keep them inside the image.

But, as far as I know, when it comes to export the plot into a pdf file to have 
a nice integration in a LaTeX document, you can not do that in Roassal. Of 
course you can export your plot as svg but then you have to deal with 
integrating svg inside LaTeX… Furthermore, as I said before, I already used 
MatplotLib in Python and really liked its simple interface… Finally, at the 
beginning it was just an experiment for fun, but then I saw it was quite easy 
to interface to a Python library from which you don’t need to get values back 
in Pharo so I continued this project and used it when I had to plot stuff. Now 
I think it is quite usable and I enhance it a little every time I use it and 
see there is a part of the bridge I need that is not built yet. :-)

> i have a rich text tree editing program in Dolphin Smalltalk
>      that i use like a note taking program like everNote but as a great big 
> tree
>           using the old Windows tree widget in Dolphin 6 which i like
>           and i store a lot of my text stuff in there
>      and i would like to store and edit Racket programs or lisp programs
>           in there in a tree format
>      and your project sounds interesting
>           about how to maybe generate Racket code that will allow
>           me to use Dolphin and Pharo and other Smalltalks as a front end to 
>           Racket or commonLisp etc
>           because i don't like the GUIs or IDEs of those things
>                ( they're so primative )( but i don't know them well )( they 
> just look
>                     brittle )( and C like )
>      and i believe there is a command line interface in Pharo so you can
>           execute external programs like generated scripts

I think you could re-use the ideas behind the bridge but not the code. It is 
really specific to Python 3, I do not see how you could generate LISP using it 
as is.

Julien

---
Julien Delplanque
Doctorant à l’Université de Lille 1
http://juliendelplanque.be/phd.html
Equipe Rmod, Inria
Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
Numéro de téléphone: +333 59 35 86 40

Reply via email to