Hacker News new | ask | show | jobs
by nudpiedo 2705 days ago
Where does the Pharo runtime run? To which platforms can I bring its solutions? are these standalone binaries or can I create libraries or code which play well with other languages and systems?

Every time I look at a programming language, and at the HN it is every second day, I think about what kind of problems can it solve, and for what kind of platforms these compile/run their runtimes.. and surprisingly not many programming languages inform properly about the most basic feature, and prefer to go deeper into their.

5 comments

> Where does the Pharo runtime run?

Pharo runs in a VM that's compiled to C and runs as a stand-alone native application on Linux, Mac, Windows. You can also build from source but most people don't and there are some rough edges. There are plenty of libraries and mechanisms for connecting to the rest of the world e.g. subprocesses, sockets, FFI, and libraries built on those.

My favourite computer science paper of all time is about how they develop this virtual machine. https://news.ycombinator.com/item?id=12577087

Development is entirely via the most integrated GUI you've ever experienced. It runs on MacOS, Windows, and Linux.

For deployment, you can run it headless.

You can also deploy as Javascript for Node/Browsers via a tool called PharoJS (http://pharojs.org - full disclosure, I'm one of the principals of PharoJS), but it's a work in progress (with a Slack workspace to support it).

GNU Smalltalk can deploy to a standard executable, so you could do most development in Pharo, and then switch to GNU Smalltalk, but you'd lose the fabulous IDE.

I have not looked at Pharo, but the Lisp development environment on my Symbolics computers is amazingly integrated, so this is a very high bar to surpass if true.
Running Pharo (or Cincom Smalltalk or Squeak Smalltalk) on an OS like Windows is similar in many ways to an old Symbolics machine, but Symbolics didn't need to sit on top of an OS, but was lisp all the way down. This existed in the past with Smalltalk as well at Xerox Park where it introduced the GUI and Mouse. I forget the machine's name, but someone on HN rebuilt one recently. The hardware was expensive at the time much like Lisp machines. The best lisp comparison to Smalltalk on Windows is likely SBCL + Emacs Slime, but even that is an inadequate comparison as Emacs Slime is mostly just a super powerful text editor and Pharo is fully graphical. You can run some code to generate a rotating 3D image and recompile any of the methods on the fly and instantaneouly see changes. Even the IDE is fully modifiable and you can change the language to make True = False and break everything. Both SBCL Common Lisp & Pharo use the image concept. So you can save your work and system state in the image.
There are emulators for the old Lisp Machines. The best were Medley (for the old Interlisp-D system from Xerox) and Open Genera from Symbolics. They are philosophical relatively near to Pharo. But Pharo has seen more development in the past decade.

For Common Lisp there are/were many integrated IDEs: Macintosh Common Lisp, Allegro CL, LispWorks, Clozure CL on the Mac, Corman Lisp on Windows upto McCLIM for several CL implementations. A general difference to Pharo is usually that these CL IDEs use mostly native user interfaces. Pharo comes with its own user interface, graphics, window system, display code, event handling, ... Example: Pharo windows on a Mac are not Mac windows. Clozure CL windows on the Mac are Cocoa windows. Similar: most CL systems use native code.

The real commercial Smalltalk machines were underpowered compared to some of the Lisp Machines - for example those from Symbolics - but those were also quite a bit more expensive. It was possible to spend more than $100k for a Symbolics Lisp Machine with accelerated color graphics and HDTV in/out.

The main difference of Pharo with integrated Lisp environments:

1) Pharo uses portable system independent images. Most Lisp systems uses system (OS / architecture) specific images, since code is natively compiled.

2) Pharo code is not native AOT compiled, IIRC. Common Lisp is either source interpreted or AOT compiled - some are even AOT compiled only - with incremental AOT runtime compiler.

3) Pharo uses its own user interface & gui system. Most Common Lisp systems use a native backend for their GUI. Recent exception is Mezzano, which a CL on the metal, which comes with its own GUI.

4) Pharo/Smalltalk usually manages and tracks source code for the user. Most CL IDEs use files and the user works with files and systems of files. CL then more or less tracks the code in these files.

5) Pharo offers to save state in an image between sessions - Lisp systems use that mostly on demand and less as a session state mechanism. LispWorks has some support for sessions.

<It was possible to spend more >than $100k for a Symbolics >Lisp Machine with accelerated >color graphics and HDTV >in/out.

Quantel Harry was the competition.

Link below, is for the 1981 Quantel Paintbox, the existence of which is responsible for the direction of my juvenile mind.

I should love to one day get together with like minded folk and assemble a complete ca. '89 broadcast graphics suite. I'm in advertising (London, independent, founder) and I'm not convinced that I couldn't work out the financial arithmetic favourably. I am persuaded by artist friends of the merit, tempered I expect by the reality of the working interfaces, if they actually used a 80s Quantel - we take instantaneous responsiveness for granted.. Time and place required, but I'm serious enough to have scouted premises and allocated budget.

I digress. Sorry.

I only have read about Pharo in the last couple of weeks, but I am taken by the sophistication of the ambitions and delivery thereof. I say this here, rather thanon a Pharo list, because I am unsure of what skills and specialities are required, but I have a professional itch to scratch, which is estimating the work of supporting a new language to the fullest extent possible, in Visual Studio. If this could be accomplished in under half a man year for a senior developer, I really want to know. (result to be released to community, purpose of exercise purely personal curiosity about what consequent effect is possible)

https://en.m.wikipedia.org/wiki/Quantel_Paintbox

My impression is that Quantal was more or less about 2d paint and compositing.

The Symbolics Graphics System was more about 3d modeling and animation for TV and games. Paint was also provided - but also in combination with animation.

A very early brochure: http://lispm.de/symbolics-3/symbolics-3.html

A later one in German: http://lispm.de/symbolics-2/symbolics-2.html

I think you are talking about CuriousMarc's Xerox Alto restoration: https://www.youtube.com/watch?v=YupOC_6bfMI&list=PL-_93BVApb...
Yes the Alto and that restoration!
wait.. You have several Symbolics lisp machines? which ones?
User lispm is all about some lisp and lisp machines...super knowledgeable on the subject. I like to think he has acheived a general purpose AI on his networked Symbolics machines. All jokes aside he/she has posted some great stuff on here and the lisp subreddit.
Like lispm, I have several working MacIvory machines as well as several native Ivory machines and several working DEC Alphas running OpenGenera. I also have others including TI and Xerox but have not yet restored them.

You can, with a bit of effort, get OpenGenera running on a Linux VM and display on a modern X server. There are a few patches needed due to recent X server changes, or just run an Ubuntu from a dozen years ago on metal.

FWIW there was a lot of cross-pollination between smalltalk and lisp, and Pharo is a branch of the former.
I looked for any useful documentation for a few minutes and just gave up. I don't want to read a book. I don't want to watch a video. This is not my first programming language, thank you. I just want a "hello world" example to get an idea what I am actually dealing with. How do I run a "hello world" program from the command line? How can I deploy that to another machine that doesn't necessarily have a GUI?
> I just want a "hello world" example to get an idea what I am actually dealing with. How do I run a "hello world" program from the command line?

The trouble is that what you are dealing with is a graphical interactive programming environment. Sure, you can run it from the command line like /bin/perl, but to understand what you are dealing with you have to open it up and try it on its own terms.

If you aren't interested in a novel immersive programming environment then you can safely ignore Pharo too.

>If you aren't interested in a novel immersive programming environment then you can safely ignore Pharo too.

I was curious and so downloaded and ran the default image, and I'm beyond captivated by it, but I have to agree that neither the link nor the homepage do a good job of enticing me to do so, or even hinting and what can I expect.

If I didn't feel like setting up and checking out random projects I stumble upon, I would have never even seen what Pharo is about, given the abundance of marginally different programming languages that pop up on HN.

So yeah, I also think Pharo's best "Hello, World" is just opening it and trying out stuff, but maybe it should try to sell itself, at least a little, for the uninitiated?

> maybe it should try to sell itself, at least a little, for the uninitiated?

Guessing this is a hard problem. People have been working on marketing Smalltalk for almost 50 years now. If there were an easy solution I reckon they'd have found it by now :)

This seems a step worse, though. Neither the release page nor the main Pharo page even mention smalltalk, yet the documentation page talks about it as if it's the same thing (and only seems to point to books and videos, not basic introductions and tutorials). It's really strange for a programming language site to go to so much effort to hide its language.
Yes, I see that the announcement says that the FFI is improved, so I look at the documentation page to see how it is improved, and I see quite a few links, but these are mostly old links to contributed docs, none obviously covering the new release. I guess that the books page linked to documentation page is the one most likely to include anything about the FFI, but the newest book I spot there is 8 months old. Google search for pharo 7.0 FFI turns up the same release announcement and nothing else relevant.
Fellow Pharo contributors: we should take this feedback seriously
Agreed. The main website could benefit from somehow conveying the mind blowing power of using Pharo.

Maybe lots of little gifs?

One thing that struck me a bit odd was, that the website makes it look like I have to buy a book or join a (paid?) mooc to get started, because these are the very first sections under "documentation".

I was just looking for a basic examples to get some sense what Pharo is about and what the look and feel are. Without downloading and installing it, I wasn't aware that there is a pretty nice interactive tutorial built in.

Maybe convey better how Pharo is distinct from other languages/environments and how to get going?

Pharo is indeed very easy to get started, but the website makes it appear harder than it actually is.

Oh yeah, absolutely; seeing the MOOC featured so prominently, which I genuinely was in no mood for, I was just about resigned to having to aimlessly click around and run barely functional snippets - and then I open the image, and there's a super friendly beginner ready interactive tutorial!

Pharo might be the first project I've seen whose actual usability an user-friendliness is behind that of their presentation :)

I don't remember the MOOC costing money, but it was in French with English subtitles which is understandable with them being French researchers at INRIA, but it couldn't keep my attention up due to the gap.

The books are all free in PDF form and the lead developer also has another website somewhere where he hosts old Smalltalk textbooks which are largely still relevant.

They certainly could work on conveying this better, but it is open source and likely not a high priority.

Social proofs could work too. If you can't show me how powerful Pharo is visually, show me a bunch of people (preferably people whose names, or company/employers' names, I would recognize, but that's secondary) telling me how powerful Pharo is.
Perhaps they are interested in using a novel immersive programming environment to develop an app that runs from OS command line without GUI.
Pharo does have commandline functionality, but that won't demonstrate its value as a first experience. For an interactive tutorial... open Pharo, then left-click background, Tools > Playground, type & highlight 'ProStef go', right-click & 'do it'.

Then try these one-liners in the Playground... https://medium.com/concerning-pharo/elegant-pharo-code-bb590....

Then (and I know its a video) but maybe serverless PharoLambda would interest you... https://www.youtube.com/watch?v=YUbd0-FX6pI

Do you understand that you are not answering `virtualized`s question?

The question is not about a Pharo commandline that exists as part of the Pharo GUI.

The question is about an OS commandline like "GNOME Terminal" with stdio.

They do. By saying "there is such functionality, but you should try this instead, because using it from commandline won't tell you why this is interesting". Which isn't directly answering the question, but pointing the asker in a good direction.
Until the asker has been shown that their commandline requirements can be met — they will not be interested.
But it's entirely missing the point in that you don't use a Smalltalk environment so that you can run some hello world example from the command line.
Think Smalltalk is one case where thinking incrementally from what you already know about programming might be doing yourself a disservice.
We’ve converged on a computing and programming experience that is largely homogeneous across languages and platforms, and Smalltalk is definitely an alternate timeline tech.

I kind of like these systems because they remind me of when computers were weird and different and had legitimate tradeoffs. People’s expectations of computers were still rooted in a physical model of interacting with the world. Computers were still very much trying to prove that they were relevant to the “real world.”

Smalltalk is not so limited.

    COMMAND LINE:
    /opt/src/vw8.3pul/bin/visual nbody.vw_run.im -nogui -evaluate "BenchmarksGame program" -a 50000000

    PROGRAM OUTPUT:
    -0.169075164
    -0.169059907
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
I'm not sure about deployment but the 'hello world' is essentially part of the environment:

https://i.imgur.com/JwgJ66z.png

You create a new image and then start piecing things together from there. GNU Smalltalk is probably what you want if you want to stick to the CLI. That said, it's not exactly a representative example when you want the same program that prints to stdout or something.

I'm curious to know about this aspect of it because my first step after the hello world is usually to figure out how to host the thing.

Edit: this would be more useful: https://stackoverflow.com/a/17259369

There's literally a command-line example (although it doesn't print Hello world, but the factorial of 42) on their front page.

That said, Smalltalk isn't something you use from the commandline typically, or only during deployment or for applying external automation. The GUI environment is fairly key.

No.

The website front page does not show a Pharo program being invoked from the OS command-line and using stdio.

Yes it does. The below is copied from the 'A glimpse of Pharo' section.

""" $ curl https://get.pharo.org | bash $ ./pharo Pharo.image eval "42 factorial" """

Are we to understand that:

— nobody hit the Enter key?

— the program does nothing?

— the program does something but there was no output?

— there was output but not to stdout?

etc etc

From the home page, in the A glimpse of Pharo section:

  $ curl https://get.pharo.org | bash 
  $ ./pharo Pharo.image eval "42 factorial"
Which apparently does nothing.
I got 1405006117752879898543142606244511569936384000000000 on my command line after running those commands.
> How do I run a "hello world" program from the command line?

You can load and run a smalltalk source file, at the OS command-line, something like —

    ./pharo Pharo.image st helloworld.st 
You can pre-load smalltalk source files, save a memory image, and use default startup behavior to run the saved bytecode —

    ./pharo helloworld.image
> deploy that to another machine

It's just moving files (VM + bytecode image) so — rsync, ssh

> I just want a "hello world" example to get an idea what I am actually dealing with.

iirc something like —

    FileStream stdout nextPutAll: 'Hello, world'; cr.
You can do something like: `Stdio stdout nextPutAll: 'Hello, World!'.`
Are you suggesting that `FileStream stdout` doesn't work, or that using `Stdio stdout` is in some way better, or that `nextPutAll:` will add a newline, or that … ?
I think `FileStream` is deprecated in the new version of Pharo.
in case you get really curious: https://mooc.pharo.org/

also a hello world will never ever give you any idea about smalltalk/pharo.

don't be impatient, this is a system worth playing with, it's quite ~amazing.

Even after you download it, pick Pharo 7, and open it up, the "Explore Pharo" section points you to a page that doesn't work that says it's accurate for version Pharo 5. [0]

I finally found out that the magic invocation was to open up a window by clicking on the background, and navigating to Tools -> Playground, and running `Profstef go.` But they certainly didn't make it easy.

[0] https://ci.inria.fr/pharo-contribution/job/UpdatedPharoByExa...

As a beginner, ProStef (Mini tutorial) helped me get familiar with environment. To access that tutorial, it's on the welcome page in the Learn Pharo tab when you first launch the image. Hope that helps!
You don't. Smalltalk means GUI, pretty much.
Headless (no GUI) Smalltalk apps have been used commercially for decades.
But were the developed with the GUI and then deployed as a headless app?
And were the developed with the GUI and then deployed as a headless app.
Not from command line - but this will hopefully get you up and running in the IDE and have an idea what Pharo can do. or To deploy on another machine you simply copy the image file - so they can run from pharo. The image can be run headless (doesnt display GUI) if you need to deploy on a server.

Run PharoLauncher and Load a Pharo image instance.

Once the Pharo Desktop IDE appears type CTRL+O+T to open Transcript - the system log console abnd type CTRL+O+W to open playground - Playground is a window into which you can type. It can be used for any purpose, but is most often used for typing Pharo expressions and equickly executing them.

(There are windows /icon menu entries for these as well)

In playground window type:

     Transcript show: 'Hello World'


and press the play 'do it' icon at the top of the playground window to evaluate it

You should now see Hello World appear in the transcript window.

What you just did was send the Transcript objects show method the message 'Hello World'

Lets do a slightly more complex Cut and paste the following code into the Playground window and click the play button. The first part installs the Roassal visualization framework. It only needs to be run once. The second part uses ROassal's Mondrian API which offers facilities to describe and render graphs. Mondrian allows mapping of metric values and properties into visual dimensions, such as shape and colors. Cut and paste the second piece of code into playground and hit play doit icon to evaluate. In the view panel you should see a simple tree class browser of the installed classes in the Pharo image with size of class coloured and scaled to represent number of source code lines in each class. Note lines in speach marks are comments.

"-------------------------------------"

"install Roassal visualization engine"

"-------------------------------------"

Gofer it

  smalltalkhubUser: 'ObjectProfile' project: 'Roassal2';
configurationOf: 'Roassal2';

	    loadStable.
"---------------------------------------------------"

"- Make a Simple interactiver Class Tree Browser -"

"---------------------------------------------------"

myBrowser := RTMondrian new.

myBrowser nodes: Collection withAllSubclasses.

myBrowser edges connectFrom: #superclass.

myBrowser normalizer

  normalizeSize: #numberOfMethods;

  normalizeColor: #numberOfLinesOfCode.

myBrowser layout tree.

myBrowser

> are these standalone binaries or can I create libraries or code which play well with other languages and systems?

Traditionally Pharo could only create standalone applications, but the minheadless builds are making good progress on stripping the windowing code to facilitate it being embeddable.

A platform specific VM runs on Windows, Linux, OSX. All those VMs run a single application binary.

Why the downvotes? is there anything wrong in my question? I read the webpage and the answer is nowhere (at least I could not find it), and looking at the docs is not so easy to find this information, it seems that I have to get deep in a chapter of a book or a video in order to find out whether this tool has anything to do with my work, tool or area at all.

Does it compile to other platforms? Binary code, compile to C, to LLVM? Does it compile to other VMs like Java and it is compatible with javascript engines? For me this is a basic aspect of a language.

Like Java, it runs on a VM. This VM works on the mainstream OS.

One of the peculiarity of Pharo (and Smalltalk) is that when you shutdown the system, you can persist the whole system on disk (called "the image"). Next time you open it, you start exactly where you left.

All the development tools are mixed with your code. There is no differences between the coding time and runtime (i.e., you code at runtime). If you are familiar with IRB in Ruby, imagine a GUI running in IRB.

This means that it is hard to see the limit between your code and Pharo's code. Pharo 7 seems to bring a bootstrap process where you can build images from scratch. This is an interesting evolution that will vastly improve the development/reproducability/deployment story.

> Why the downvotes?

Please don't complain about downvotes, especially not within the first 23 minutes. It's common to receive one random downvote and a couple more piling on, but given a few hours a decent comment will be back in the black.

For what it's worth I think these are decent questions to ask, even if others think they're worthy of a downvote.

As far as I understand it: it doesn't necessarily compile in that sense. You are constructing an 'image', which is basically a living environment that your program runs in, and maybe it corresponds somewhat to a VM. But you're not really treating the code that the VM runs as separate to the VM itself.

In some sense I think you might map it to something like a Lisp machine, where you can interact with a running program and its state through a REPL.

Someone more knowledgeable might be able to elaborate on that (or correct the misunderstandings), but it felt worth offering something other than a straight up dismissal of your question.

Smalltalk system consists of a VirtualMachine and an image. An image is just some Smalltalk code compiled into a form suitable for VM to read it into memory. The initial image contains all the standard classes of Smalltalk plus the GUI and various tools. When you add a method to some class inside the GUI, it gets compiled and added to the image held by the VM in memory. Later, you can dump the modified image to disk, producing a new initial image you can later use.

This is indeed similar to Common Lisp and Emacs.

Back to the original question: the VM runs on Windows/Mac/Linux and on some IoT devices. The code is compiled to bytecode which can then be JIT compiled further on some architectures/OSes. The compiler and the whole infrastructure is exposed and available on runtime.

Pharo has classes for easy FFI to C and for bundling native libraries. I don't know if it's possible to call back from C to Pharo, but I assume yes (many libraries require this). There is no FFI or other integration with any other language (at least as a built-in, there are RPC interfaces for some langs as add-on packages).

As for "standalone binaries" - almost, as you need to bundle the VM with the image; there are some helper scripts for bundling and then launching images.

The most obvious use case is GUI programming, there's also old-school Web programming with Seaside, data crunching and visualization with Roassal. Other than these killer-apps, Pharo is just as capable as any other high-level language, although with a much smaller selection of libraries available.

Some/many Common Lisp implementations. But there are a bunch of Common Lisp implementations which are not image-based.

Another difference might be that most image-based Common Lisp implementations don't use portable byte-code. Some are using byte-code engines, but those are usually not portable across operating systems and/or machine architectures.

You can definitely do GUI programming as the IDE itself is in Smalltalk, but I wouldn't call it super straightforward like using a GUI designer in Visual Studio. I've tried before and got lost in Bloc & Specc?
To be honest, I stopped playing with Pharo around the time when Spec was being designed and beta-tested - I forgot most of it, but I hazily recall that it was a bit too magical for my taste. I hope it got better since then, but I'd have to check.

But, about the GUI, I was thinking about Morphic. It's basically a GUI designer on its own: you can create widgets by instantiating their objects in Playground. It doesn't matter what widget it is: you can create a button or a list item or a textarea on their own. You can then edit them with halo actions or in the inspector until they look like you want, then add them to container widgets, then finally put them in a window. It's bottom-up programming for GUIs! You need to manually track the changes you make via inspector (ie. to copy them to playground), but if you do, you can copy the whole playground into a method and done, you've just designed a GUI app! You later replace some Widgets with their subclasses written by you to handle events and you're done.

I didn't know you could do that. Any chance there is a video on YouTube showing how to do it?
The download page clearly shows Windows, Mac and Linux.
But that's the development environemnt/compiler and tooling. It still could generate binaries for microcontrolers for example.
No, it couldn't. It's image-based. Your application is the development environment. That's the point of Smalltalk.
But it does, apparently: https://github.com/pharo-iot/PharoThings

EDIT: Nope! I was wrong, see comment below. It promises Arduino support but via some firmware with Pharo itself still running on the desktop.

That runs the VM on the embedded Linux computer, and provides remote access to the development tools/an API to run development tools against.