Hacker News new | past | comments | ask | show | jobs | submit login
Pharo, the Modern Smalltalk (medium.com/smalltalk-talk)
157 points by louiscyphre on Oct 4, 2017 | hide | past | favorite | 171 comments



Is there a snippet of example code to look at? I browsed the pharo.org website, but couldn't find an example to give me a taste. I even tried googling "pharo example" and with a brief look at the results didn't find an example.

Today, there are hundreds of programming languages competing for attention. It is in your interest to put an example front and center of why one should spend time looking into yet another programming language.


This may not be immediately apparent, but I discovered that Smalltalk did not fit into the 'programming language' concepts in my head. I think of a typical bytecode VM language as

  [source code] -> [interpreter] -> [running program]
Instead Smalltalk is more like

  [running program] + [auto persistence] + [editing tools]
So you don't modify large gobs of source code files, you modify the running program from within - aka live editing. The running program consists of a network of interconnected objects. You use the textual syntax also - but only to modify parts of the already live program (e.g. you could 'install' a new method on an existing class object). You inspect the running program using graphical browsers (typically also part of the same program) - and everything you modify is live immediately.

The syntax of Smalltlak is interesting (can be seen here https://en.wikipedia.org/wiki/Smalltalk#Syntax). But the more interesting aspects of the experience are the live editing, working with network of objects, hybrid text/non-text ways of modifying these objects, etc.


> [running program] + [auto persistence] + [editing tools]

How do you use TDD when coding like this?


Others have answered but interestingly, TDD was 'built-in' to the Pharo tutorial I did a while back.

Basically you write a test first, say it calls an undefined method `x.somemethod()`. You push a button to run the test, as soon as the method call fails, the environment shows you a popup which lets you define the method right then and there, while you have all the details of the suspended execution. You can write the method and the 'resume' the execution from where it excepted.


Kent Beck invented TDD while programming in Smalltalk.

You first extend the environment with tests, then add the code to make them green. All without ever having to restart the "program".


I admit the question made me smile, but it's a great question. I found these short videos, that are maybe the shortest possible answer (less than 3 minutes, I just watched them w/o sound, auto-captioned):

Pharo: https://youtu.be/ymITEeAOtEA

Cinecom Smalltalk: https://youtu.be/mXoxfmcDDJM


Here is a nice Pharo TDD video (thx Avi) from an author of several Ruby books, when he was trying Pharo... http://www.virtuouscode.com/2015/05/11/in-which-i-make-you-h...


See "Chapter 9 SUnit" in [pdf] "Pharo by Example"

http://files.pharo.org/books-pdfs/updated-pharo-by-example/2...

There are pictures :-)


How do you use TDD when coding like this?

There were some utilities that let you run the tests at the push of a button.


So, how do you distribute the program you've just written? That's the issue I have with image based languages.


Well, Pharo seems to have quite a few contributors, so they probably figured something out. Let me have a look..

So, based on these slides about Pharo 6[0], it seems that they use multiple things. First, they have a tool called Epicea, which is a more modern way of tracking changes to an image[1]. Then, for git integration, they have a bunch of tools at pharo-vcs, specifically Iceberg[2].

[0] https://www.slideshare.net/pharoproject/pharo-6

[1] http://smalltalkhub.com/#!/~MartinDias/Epicea

[2] https://github.com/pharo-vcs, https://github.com/pharo-vcs/iceberg


You seem to be answering the question - How do you distribute the software development? - and I read the question as - How do you distribute the finished app?


I honestly don't know how I misread GP so badly... too late to edit now.


Image + VM is the short answer.

Slightly longer discussion here: https://pharo.fogbugz.com/default.asp?W78

Really, not much different than any interpreted language, where you do source + runtime; the image just replaces the source.


Pharo doesn't need to be "installed". It can run from any directory. Typically your Image may be 30MB and the VM 5MB, so you just need to drop the two in the same folder via a zip file or whatever platform packaging tool you like.

Typically with Smalltalk you would have an Image live on and on and maybe forget how to create it from scratch. And depending on your audience, you may have wanted to strip out development tools, something like this old example for Squeak... http://squeak.preeminent.org/tut2007/html/205.html

Pharo has put a lot of effort into "bootstrapping" the Image via CI to address this weakness of Image based systems. So you only need to load the parts you want in a reproducible way.


It varies from one Smalltalk language implementation to another.

For MS Windows based Dolphin Smalltalk -- "The Lagoon Deployment Wizard strips out redundant components from your image and shrinks your code down to a tight, single click EXE file. Alternatively, you can choose to additively compose your application by building it up from the raw Dolphin boot image."


You distribute the image + interpreter. I presume you could strip the image, but haven't tried it.


The language is a dialect of Smalltalk, so looking for Smalltalk examples might be more productive. There are some useful examples at http://wiki.c2.com/?SmalltalkExamples, such as (double quotes are comments):

    " this sends a message to the transcript "

    Transcript show: 'hello world '.


    " compute 10 factorial and send the result to the Transcript "

    Transcript show: 10 factorial.


    " now, try this: "

    Transcript show: 100 factorial.


    " a loop (the timesRepeat-method evaluates its argument n-times)"

    10 timesRepeat: [
        Transcript show:'hello'.
        Transcript cr.
    ].


    " another loop "

    1 to: 10 do:[ :i |
        Transcript show:i.
        Transcript show:' '.
        Transcript show:i sqt.
        Transcript cr.
    ].


    " looping over a collection "

    #('a' 'b' 'c' ) do:[:each |
        Transcript show: each.
        Transcript cr.
    ].


I've always found the 'image' environment to be far more interesting than the language of Smalltalk itself. If you do find just code snippets, you're missing out on what I, at least, see as the most significant feature of the whole thing. The way it goes about defining the code is clunky, but the overall structure of 'images' and the workflow involved with them is fascinating. I could easily see something similar being the future of containerization when implemented in some other language.


That image environment sounds scary to me. I used to do a lot of hardware development, and what I love most about software is that you can always restart from the clean plate (by restarting the program) and/or undo your previous work (with version control).

From what I understand, none of this applies to Smalltalk. You always modify code on the fly, so you may end up with properties which exists, but no current code ever sets them. Or your program ends up in the invalid state, and you have no idea why -- is it a genuine bug or did it happen few minutes ago, when the function was still incomplete?


what I love most about software is that you can always restart from the clean plate (by restarting the program) and/or undo your previous work (with version control).

That's what I loved best about Smalltalk. You could just hard quit out of the image, then go back to the Change Log and replay all but the last few changes. If you save off an image every day or so, you're always back in minutes, no matter how dangerously you've been coding.

There are a variety of utilities which let you load code quickly. Most often, deployment was done using one of these loading onto a clean or a stripped image. You can certainly control changes to your environment. In fact, I'd say you can often control them more easily than in other environments.

you have no idea why -- is it a genuine bug or did it happen few minutes ago, when the function was still incomplete?

The Change Log makes it very easy to figure that out. All of your ad-hoc "command-line" (do-it) state changes to the image are recorded there as well.


This is a great insight but when I read things like this it reminds me the Smalltalk advocates need to do a better job adressing the concerns of the broader development community. It seems like they spend too much time addressing things that aren't concerns and not enough time on things that are.


That can happen, but typically you're not keeping state around for huge periods of time (though you can if you want), it's just a convenience while you rapidly iterate on the design of the code. Once you've got code that seems to hang together well, it's time to start thinking about what the right way to instantiate the objects, to consistently bring them to a correct state. Unit tests are useful for this, and with a brief (ab)use of a global variable, you can often make the tests run against your hand-made object, and verify that the test results are the same as when testing a properly instantiated object. After that you can dispense with your hand-made instance.

Somewhat related, you can use unit tests of as-yet unimplemented functionality as a jumping-off point for live-coding your way towards the right implementation, with the debugger acting as a combined code editor and REPL (since the formal parameter names in the code will have real, evaluatable values behind them - as supplied by the test case).

Were I a major Test Driven Development adherent, I might claim that this is the non-cargo-cult way of doing TDD.


All this works perfectly well in Common Lisp too.


Simply a) keep a copy of the original image [clean slate] b) keep a copy of your changes/additions [use version control if you like] c) import b into a.

Repeat daily or weekly as you please.

> You always modify code on the fly

Since back in the '70s when Smalltalk was being created at Xerox PARC and used there for experimental systems development, changes were automagically recorded in a changes .cha text file.

For more information on the primitive techniques from back in those days see -- "Managing the Evolution of Smalltalk-80 Systems" in Smalltalk-80: Bits of History, Words of Advice

http://sdmeta.gforge.inria.fr/FreeBooks/BitsOfHistory/BitsOf...


> Simply a) keep a copy of the original image [clean slate] b) keep a copy of your changes/additions [version control] c) import b into a.

Really? So we're back to "MyImage.img.bak.2.old.works", "MyImage.img.bak.3.works", "MyImage.img.bak.2.test"?

Now that is an experience I do not want to ever have to experience again.


No you don't manage and back up using images (you can of course). Instead you manage and back up diffs just like you would in any other language. You can do that from inside or outside the VM. From the outside, the VM writes it's changes to a change (diff or journal) file and you get to choose when and if you're going to commit those changes. You can use that file to make commits to your SCM.


> So we're back to…

No, that's a bizarre suggestion you just invented, it has nothing to do with what I wrote.


The development workflow for Pharo is that every code change has a CI performs a bootstrap build of the whole system pulled from a git repository. Then your CI adds your production code on top of that.

So it doesn't get lost in the mass of other comments, here again is some info on Pharo's bootstrap process... http://www.esug.org/data/ESUG2016/04-Thursday/1000-1030%20Mi...


You may be interested in the bootstrap work Pharo has been doing...

http://www.esug.org/data/ESUG2016/04-Thursday/1000-1030%20Mi...


Lots of other languages work/worked that way. System images were a common feature of many Lisp systems and some Forth systems in the 1980s.


The image is just one reason why compiling an SBCL executable results in such a large file. It has state as well...or so I've read.


When you load Lisp files, they get compiled; this compilation is saved as binary files (often, "fast load files"), that do what it says on the tin: They allow you to, next time, load your program really quickly.

Now, your program also has state. If you want, you can also save the state of the program (i.e. by using the "save-lisp-and-die" command). This can create large files, because this allows you not only to quickly "run" the program again, but to also run it with the same state that it had when you did the save.


Thanks for clarifying my comment with actual experience. Much appreciated!


You're welcome! Forgot to mention, the other reason executable files (if produced) get big, is that compilation of a Lisp program not only produces the machine language form of your program, but it also includes a Lisp runtime.

The runtime makes possible having the condition-restart system, and the full power of macros (your program can compile lisp code at runtime if needed, thanks to the runtime.)


Also self


Opposite feeling here - mutable/persistent images kept me away from Smalltalk.


Because you have had experience with them, or because you haven't had experience with them?


I fell opposite: I appreciate simplicity of Smalltalk syntax, but I prefer environment bases of files


Here's a "Pharo Cheat Sheet" PDF from pharo.org http://files.pharo.org/media/pharoCheatSheet.pdf


I always find LearnXinYminutes to be a cool "quick look" at a language syntax: https://learnxinyminutes.com/docs/smalltalk/


I love this site for quick syntax intros: https://learnxinyminutes.com/docs/smalltalk/


You can download whole books with Pharo examples http://files.pharo.org/books/


Maybe a whole book is overkill. When I'm checking out a new language I like to see a couple of short, accessible examples to get a feel for the language.

Like this clock[0]:

  Time now asValueHolder in: [ :clock |
    [ [ 
        1 second asDelay wait. 
        clock value: Time now ] repeat ] fork. 
    clock inspect ]
[0] https://medium.com/concerning-pharo/elegant-pharo-code-bb590...


I have found that O'Reilly's "Nutshell" books tell me everything I need to know when learning most new languages, and then some. For some languages, though, they have features that might make this sort of overview challenging if you do not understand the core paradigms (such as Rust's ownership concepts).


Not really: https://rustbyexample.com/

There's no excuse for not having any examples of a programming language on that programming language's home page. Here are some languages that do it right:

https://ceylon-lang.org/

https://www.dartlang.org/

https://golang.org/

https://www.rust-lang.org/en-US/

Notice there at least one example (often executable!) on the home page of each site.

I'm actually pleasantly surprised how well all those sites do. Most smaller programming languages get this bit horribly wrong.


> There's no excuse for not having any examples of a programming language…

https://pharo.org/

I see examples on their home page.


There is an image showing many IDE windows, one of which does actually show code you would find if you already knew what the code you were looking for looked like. You could still not copy and paste it.

Then there is a textual example consisting of two lines of Posix shell, embedded in which is indeed a tiny Pharo program in a string.

The parent's point mostly stands.

(Oh, and there is a frickin' popup for a frickin' email newsletter hiding the content.)


> You could still not copy and paste it.

Why would you copy and paste code before you'd done anything more than glance at a language home page?

Perhaps the better comparison is with some other languge IDE:

https://www.jetbrains.com/go/


Yeah maybe if Pharo was just a Smalltalk IDE, but apparently it is a distinct language.


More like a distinct Smalltalk language implementation. For decades, different Smalltalk language implementations have introduced novel things while still being recognizably implementations of Smalltalk.

I haven't been able to find a clear statement of language differences between Pharo and other Smalltalks. The closest thing I've come across is this statement of intent:

"We want to stress the fact that Pharo will certainly derive from ANSI and other Smalltalks. We will not change for the sake of change. What we want to say is that if there is something that can be improved but does not conform the ANSI Smalltalk, we will do it anyway."

Perhaps a Pharo expert can clarify?


I came to Pharo after the fork from Squeak. What I have picked up is that prior to the fork, there was significant tension between those that wanted to maintain backward compatibility and those that wanted to move the language forward. The latter group forked Pharo and that statement was Pharo seems to have be a response to their previous repression. In practice it hasn't yet diverged greatly.

However one novel thing Pharo has added is Slots... http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.653...


1. Where would you copy/paste it anyway? In a Pharo image of course,

2. Image that you can download (30Mb) and test easily. The installation consists in unzipping the damn thing, that's all you need to run Pharo right away. If you don't like it, you delete the folder. That's the un-install procedure.

3. If you actually do test it for yourself, you'll find plenty of examples in the image itself, ready to copy/paste... OR NOT! Because actually, most of the times you don't even have to copy/paste; you can just select, right click and execute those examples.

The article might be a little too dithyrambic, but your criticism on this particular point shows more your own laziness than anything. Where is the adventurous programmer that bravely goes off the beaten tracks in order to discover new exciting things?


> If you actually do test it for yourself, you'll find plenty of examples in the image itself, ready to copy/paste

Over the last 15 years or so, I have regularly played around with Squeak and Pharo, and I have not found this to be the case. I mean, yes, there is code, but that's like saying "Oh, you wanna learn C? Here is the Linux source code."

Maybe I just didn't manage to find these great examples because the Pharo community's approach is "it's there, but I won't tell you where exactly; if you can't find it yourself, you are lazy/dumb/not a real programmer".


I've asked the same things many times, but that's largely irrelevant. Smalltalk is just different. I'm more of a Vim/Awk/Python guy, but Smalltalk is quite beautiful in it's own way and images are really cool.


Smalltalk is not "yet another programming language"; Smalltalk is the language all those other OO programming languages copied. You should look into it because it is the source of the object oriented paradigm and it'll make you a better OO programmer in all of those other languages.


Sorry to be that guy but a lot of what we've come to know as OO is more directly descended from Simula because that was a big inspiration for Bjarne.

As such, C++, Java and C#, which constitute a significant chunk of OO programming, are probably better thought of as descended from Simula (and C).

There's a clearer lineage to the likes of Ruby and Objective-C, and to a lesser extent Javascript and Python.

I would definitely concur regarding looking into it, it definitely makes you think about things in a different way.

Whether or not it makes one a better programmer, I can't say. I only programmed professionally in it for a relatively brief time and it was a hugely frustrating experience. I was glad to get out of it.

In the sense that it made me understand that a programming environment has a big influence on how well a codebase can scale then, yes, I learnt loads. But that was because it really wasn't very good at scaling without an awful lot of TLC. I moved onto a Java application which was bliss by comparison (ironically, given its reputation for classpath hell etc).

This was some years ago mind so the state of the art of Smalltalk has, I'm sure, moved on.


> what we've come to know as OO is more directly descended from Simula

True, what is often called object oriented is often more about classes and inheritance, and less about (instantiated) objects communicating via messages.

It's really rather odd how Smalltalk, Strongtalk and Self could be major influences behind the jvm, jre and java - when you look at were java ended up...

[ed: on the other hand if you start with Self and add Algol syntax you get javascript - maybe it makes sense that Strongtalk and Algol makes java...]


I love representations of language history like this one, https://calvinx.com/wp-content/uploads/2012/07/evo-prog-lang...


Ditto, but that one is terribly wrong.


Mind telling me why and pointing me to a correct resource?


Well look at it; it says Java derives solely from C++, that's not remotely true. It's simplistic and misleading, here's some better ones...

https://i.pinimg.com/564x/b9/45/71/b9457106d7a5d602a2923597d...

https://ccrma.stanford.edu/courses/250a-fall-2005/docs/Compu...


> it says Java derives solely from C++, that's not remotely true

Not really, I just assumed the one I posted was trying to highlight syntax similarity. The ones you posted are just as terse, there's no way I can figure out if the Lisp arrow to Java in your first link is something about the type system or how it handles reference or the like


Well, I'll be that guy, I don't care what inspired Bjarne, Simula created the idea of an object, but it wasn't until Smalltalk that object orientation became a paradigm: Smalltalk created OO, not Simula. Object != Object Orientation, Simula was and is a procedural language with objects bolted on after the fact.

C# is a Java clone so I need only address your Java misstatement, Java was far more influenced by Objective C and Smalltalk than by C++ as far as OO goes; it looked to C++ only for syntax. Java is semantically a direct descendant of Smalltalk and was inspired directly by Smalltalk as both of its creators knew Smalltalk and Objective C (another Smalltalk derivative). [1] Direct from the co-creator of java not to mention that Gosling himself was a Smalltalker.

So no, what we know as modern OO came directly from Smalltalk.

[1] https://cs.gmu.edu/~sean/stuff/java-objc.html


If you look at the actual semantics of classes and objects in C++ and Java, they're arguably closer to Simula than they are to Smalltalk. In C++, this is even more evident by the fact that even some of the syntax is reused, such as "virtual" (although in Simula it originally meant what we today call "abstract").

The difference between the two is that Smalltalk methods semantics are message passing. In Simula, method calls are just that, function calls generalized to have a receiver. And Java follows that pattern.

If Java was a direct descendant of Smalltalk, it would look a lot different. For one thing, it would have a lot less syntax baked into the language, and a lot more closures, from the get go.


I just provided direct quotes from one of the creators of Java, sorry but you're simply wrong to argue you know better what inspired them than they did. Java is a decedent of Smalltalk via Objective C, that is simply a fact. It's well known and accepted they took syntax from C++ as deliberate attempt to entice C++ programmers into Java, that is not evidence they didn't base their inspiration on Smalltalk.

And I quote..

> When I left Sun to go to NeXT, I thought Objective-C was the coolest thing since sliced bread, and I hated C++. So, naturally when I stayed to start the eventually) Java project, Obj-C had a big influence. James Gosling, being much older than I was, he had lots of experience with SmallTalk and Simula68, which we also borrowed from liberally.


Perhaps what inspired them and what their creation most resembles are not necessarily the same thing. It would do some good if both you and your parent poster could agree or disagree with that statement.


Yes, that's exactly what I had in mind. Regardless of what inspired the development of Java (and as this quote makes clear, both Smalltalk and Simula were on the list), the result clearly bears more semblance to Simula.

A relatively simple mental exercise to prove the point is to look at various Simula and Smalltalk constructs, and see how well they map to Java (1.0) constructs. For Simula, you'll find a nearly 1:1 correspondence on syntax alone, with nested functions being the primary pain point. With Smalltalk, you'd stumble as soon as you run into the first block.


Java was far more influenced by Objective C and Smalltalk than by C++ as far as OO goes

Objective-C is message-passing, Java and C++ are not.


You apparently don't know Java's history.

To start Java's interfaces are loosey based on Objective-C protocols.

As for the rest,

https://cs.gmu.edu/~sean/stuff/java-objc.html


>Smalltalk has the cleanest, purest implementation of object-oriented concepts; not even Java, Ruby, nor CLOS can lay claim to that.

I'll take "powerful" versus "cleanest and purest" any day, thank you very much. Sorry but i'm staying with CLOS whenever i want to do object-oriented programming without feeling limited.

The author is on a pro-Smalltalk crusade (which I find just fine, Smalltalk is a great lang, and in a perfect world, it would be as popular as Javascript is today), but does so at the expense of constantly deriding Clojure, Common Lisp and Racket, which I find silly.


i would take "large ecosystem" over "powerful" or "cleanest and purest"

whenever i am in the process of picking a language for a project, i check if there is a library for what i want to do


Yes but on the other hand Smalltalk is an established language with a long history, i wouldn't be surprised if you are able to find all the libraries you need.


Every time I use Clojure for the nuts and bolts of software engineering it reminds me why I prefer Common Lisp.

Every time I need to get something done of any magnitude, it reminds me why I prefer Clojure to Common Lisp.

So... What "systems" said. Truly, Clojure is a Lisp for Getting Stuff Done, as it has access to an astounding number of libraries targeting the JVM, largely allowing you to focus on your product's core.


Sorry, but the author has never derided Clojure and Racket. Common Lisp, yes, but not Clojure and Racket. He actually likes Scheme.

He has factually pointed out that most people are turned off by Lisp syntax. This is not an insult, simply a statement of fact.


I like Pharo. I was able to build a widget that scraped the front page of HN in an afternoon with it just by following the built-in tutorial and googling.

One interesting "killer app" might be the Moose platform [0]. It's basically an interactive environment for the analysis of software. Writing a parser is rather straight-forward and turning the AST into a visualization is also quite easy. This sort of feels like how I imagine a good IDE should be.

[0] http://www.moosetechnology.org/

update spelling.


can confirm. My day job is coding in Clojure, which I love, but if I get a spare Sunday afternoon I'll do some coding in Pharo, playing with Roassal


There's a Mooc starting in december by the INRIA ( French Institute for Research in Computer Science and Automation )

https://www.fun-mooc.fr/courses/course-v1:inria+41010+sessio...


Oddly, I'm more fascinated that I'll be able to learn French reading through the materials of that course. Perhaps Smalltalk will follow on the side :)


You're probably joking, but fwiw I'm 7 weeks into Duolingo's French lessons right now and found most of this course page to be easily readable without reference to the English. It's much easier than Le Petit Prince, a children's book for which I still need to hit the dictionary a lot.


No, not joking. I have some French courses under my belt from my childhood, but I never got very fluent with it because I never had any use for it. Having an actual need to use the language would be great.


Great! I'd be tempted too if I hadn't done enough Smalltalk to feel comfy already. (I'll have to find other stuff in French. Maybe Laplace on probability? Or more likely Tin-tin...)


The course is bilingual.


I could never get the posted English vids to work


Beat me to posting it. :)

Edit: Actually, the course starts on October 16.


They need to work on the presentation. How do you get started ? How does the code look like ? etc. Not just "download this program and buy this book"


FWIW the PDF of the book "Pharo By Example" is available for free. It has also been revised for version 5 - I tried using edition 1 with Pharo 4 and kept having to look up the new names for things, to the point where it was frustrating to try and follow. They appear to have put a lot of work into updating the guide.



There is a profStef tutorial once you load the image. I think you just need to send "go" to the object.

Something like:

ProfStef go.

And right-click do after highlighting. Stefan Decasse is a French professor that does a lot for the project.


iirc correctly once you launch it after download there is a wealth of help w/in the (vastly superior to anything still even though it's literally 40 years old) IDE/workspace. It makes sense I think to do it there because then the documentation can be interactive


Also... http://pharo.org/documentation Too much to click on the "documentation" link in the header?


My beef with Smalltalk is that it's far too much a world onto itself for my taste. Java is already a bad enough citizen of Unix but Smalltalk takes it to a new level. If Lisp and Scheme can integrate well into Unix, why can't Smalltalk?


Pharo, like GNU Smalltalk, has a command line mode so that you can use your favourite editor. However, without the live coding IDE, you lose the biggest benefit of the language: highly accelerated development and enormous programmer productivity.

Yes, Pharo (and Smalltalk) is a world unto itself but that's the price you pay for a highly productive, easy-to-program software development environment. How are you going to achieve this by retrofitting to an archaic methodology based on text files and over-engineered IDEs like Visual Studio and Eclipse? Java and C++ impose severe constraints and compromises in this respect.

At the end of the day, it's all about a programmer's ability to adapt to new methodologies. If they remain rigid and stick to old, familiar ways, there can be no great improvement in the way we create software.


> Pharo, like GNU Smalltalk, has a command line mode so that you can use your favourite editor.

That's good news that does not appear in official documentation (last time I checked).

> Yes, Pharo (and Smalltalk) is a world unto itself but that's the price you pay for a highly productive, easy-to-program software development environment.

Users want standalone software. They don't want to be forced to run programs in your highly productive IDE. If your IDE is marketed to programmers as "a shiny IDE you will never be able to escape from", programmers won't use it for fear of not being able to deploy software in a way that users would accept.

> remain rigid and stick to old, familiar ways

You know what has never ever worked for promoting programming languages? Insulting people who don't use your language.


> remain rigid and stick to old, familiar ways

> Insulting people who don't use your language.

How am I insulting people??? I'm making a factual assertion, completely devoid of judgment.


Lisp and Scheme don't actually integrate with UNIX.

Their UNIX versions are handicapped versions of themselves.

Languages with rich runtimes and developer tooling are always shoehorned into POSIX model to "feel UNIX".


I get what you mean about that for Lisp (although, if I'm not mistaken, early LISPs were more like SBCL than Allegro or Symbolics in turns of user environment), but what Scheme version ever offered such a rich environment as the Lisp or Smalltalk examples mentioned above?


Dr. Scheme, nowadays known as Raket.


Nitpick, but:

PLT Scheme (language) → Racket

DrScheme (environment) → DrRacket


Could you explain?


For example, the Interlisp-D of Xerox PARC, ZetaLisp of Genera or even Alegro Common Lisp.

They provide a rich graphical developer experience, with many features that are the genesis of modern IDEs, and nothing on their standard library and runtime depends on anything POSIX related.

The Lisps that "integrate well" with UNIX, like SBCL, do so by providing a UNIX text based repl without that graphical power, while using Emacs, an editor based on Lisp Machines, that even with SLIME is not quite like the commercial Lisps.

Same applies to any other language with a rich runtime, that makes the underlying OS irrelevant.


As an example, Lisp has an amazingly full-featured condition system. It enables all sorts of stuff like detecting an error condition, changing arguments, rerunning code, replacing code while it's running &c. If it were plumbed all the way down into the OS, I could call lispy_mmap with the wrong arguments, detect that they're wrong, fix them and then return from lispy_mmap as though nothing had happened.

Instead, in a Lisp on Unix, I'll call mmap and either have to manually check for an error or use a wrapper which does that for me. If there is an error, I'll have to re-call mmap.

It's not terrible, and it's still a lot better than using e.g. C — but it's not as good as it could be in a Lisp-all-the-way-down system.


Try GNU smalltalk if you want it "integrated" into linux: http://smalltalk.gnu.org/

However, you completely miss the point of smalltalk by doing this.


To suit your tastes, not Pharo, but:

    "GNU Smalltalk -- The Smalltalk for those who can type" 

    http://smalltalk.gnu.org/


It can read files and talk to databases and make network connections etc... Are you just talking about using an editor on Unix files? iirc, the in IDE editor takes advantage of the meta-data in the compiled classes in order to provide a better editing experience that a file system approach could only replicate with a separate parser...


Coming from a place of ignorance, how does Smalltalk not integrate?


The default mode of interaction with Pharo and most other Smalltalk-based systems is not "launch an application which interacts on the console or opens some windows", but rather "launch Pharo, then inside the big Pharo window launch an application which interacts on the Pharo console or opens some windows inside the big Pharo window".

I think there are ways around this, but you may have to dig deep to find out how.

GNU Smalltalk is different: It doesn't have this traditional interaction mode. Many Smalltalk fans will probably find that that's a disadvantage.


> is not "launch an application which interacts on the console or opens some windows"

Actually, the standard end-user experience is to launch an application which interacts on the console or opens some windows.

(There'll be some system startup methods which define what happens when the image launches -- don't open the development environment windows, open the application windows).


A Smalltalk environment is practically its own operating system, complete with its own isolated UI/window manager, shells and desktop environment.


I'm not really sure what you are claiming here. My experiences with Smalltalk ended 20 years ago with IBM Smalltalk and Digitalk Smalltalk/V. At that time, they both used the host operating system (Windows or OS/2) for UI widgets, windows, and such, and any applications you built in it could be packaged up to be launched as any other application. One could use such an application and have no particular sense of isolation beyond an application written in a more mainstream language (like C or C++). Have modern Smalltalks regressed in this regard?


Take a look at the Pharo intro on youtube, you'll see what I mean:

https://www.youtube.com/watch?v=WLoXXFxU8lw

The images on the current website look very similar, so I don't it's changed much in this regard. This has been my typical experience with Smalltalk languages, with the exception of GNU Smalltalk whose specific goal is to integrate with POSIX instead of creating a walled garden.


Do you want to perhaps point to a specific time in that video, and compare it to a non-Smalltalk environment in a way that makes this purported isolation apparent, because I don't see what you mean.

I don't recognize whatever operating system the demo was done on, so if the Pharo system is not using native widgets I would not know, you'll have to explicitly state if this is the case.


The presenter is in the host operating system (Mac OSX) until the Pharo image is "up and running" at the 0:40 mark. Everything until the presenter opens up debian at 5:00 is custom Pharo based desktop / window management / even the mouse cursor if you look closely.


Then this just means that Pharo is one of the Smalltalks that does its own window management. I think Squeak might be the same. It is not a general characteristic of Smalltalks though, and certainly is not part of their essential nature. As I said, IBM Smalltalk used native widgets and windows, and had good interaction with the rest of the operating system.

I don't think you can draw a general conclusion about Smalltalk from a specific example, especially like this one.


GNU Smalltalk is file based and integrates with Emacas...oh, nevermind.


There's Shampoo [1] but I'll be damned if I've ever been able to get it to work.

[1] http://dmitrymatveev.co.uk/shampoo/


Smalltalk does not use text-based source files, with object source code saved as part of a binary vm image. Smalltalk is completely incomparable with unix editors, version control, and developer tools, relying instead on integrated dev tools inside the vm. Because all development and tools are inside a monolithic image, it's not very practical for writing shell scripts


>Smalltalk does not use text-based source files, with object source code saved as part of a binary vm image.

This is a misleading claim often made by the author of this Medium article. Smalltalk code does reside in text files and the IDE keeps them. This is apart of the "image" that is also kept by the environment to enable faster loading and store state.


What you mean is, why can't you take everything that makes Smalltalk great away, and make it work like every other file based language. The answer is, because then it would suck.


>like every other file based language

As I mentioned above, Smalltalk is also file-based; when you distribute a smalltalk program source, you distribute a set of source text files.

Just like any other typical programming language.


I'm a Smalltalk'er, and that's completely disingenuous and frankly intellectually dishonest.

What Smalltalk does is not remotely what you do in other languages and when we say file based we're referring to that difference, file oriented programming vs image oriented programming.

A Smalltalk program is not a collection of files one works with, it doesn't fit into the standard file based workflow, you cannot without jumping through many hoops, work on a Smalltalk program from your standard editor using your standard unix tools and file based workflow. So when we say file based, it's this we're referring to, do not lie to people and claim Smalltalk is file based, it is not. Smalltalk is image based, you work with its dev tools on a running object model in an image; having the option to export that to a file after the fact is not remotely the same as being file based; that the image stores source code in a changes file, or that we share code between each other with st exports does not a file based language make.

St files by the way are a serialization format, they are not meant to be hand editable and are not treated as such and contain all kinds of non-Smalltalk stuff related to the serialization format; we don't edit st files and compile them, we edit in the image and import/export st files to share code between images.


The IDE keeps the text files, and that's​ what your source code is made of. Go to any Smalltalk github project and you will find .st files, which are plain text files, and there's your code.

I'm a Lisper, i do know what Image-based development is, because that's what I use*

You're misunderstanding Smalltalk, probably​ because of hype mongers like the author of this article. Source is text files as usual. This is not the same as the image. Your environment, and the compiled classes, are contained in the image, but the IDE also keeps the source, text files.

>St files by the way are a serialization format, they are not meant to be hand editable and are not treated as such and contain all kinds

.st __source__ files are text files. You are confusing them with the image files.


No I'm not misunderstanding Smalltalk, that Smalltalk now has a git plugin to be able to expose itself in that manner is exactly the kind of jumping through hoops I was referring to, it's taken many years for that to become stable and most of us still don't use it, we use Monticello. And both of those are for sharing code, not for developing, we don't work on those st files, we export them.

Don't tell me what I'm thinking and because of who, I make my living with Smalltalk (Squeak and now Pharo) and have for well over a decade and have done hundreds of millions in revenue through my Smalltalk apps.

> .st source files are text files.

I didn't say they weren't, they're still a plain text serialization format that is not directly what Smalltalk looks like and we still don't work on code by editing those files.

> You are confusing them with the image files.

No I'm not, if you actually read what I wrote, you'd see that.

Lisp is not Smalltalk, do not confuse how Lisp does image based development with how Smalltalk does it; they are not the same. When you have a few years experience actually working with Smalltalk doing production level stuff, then come talk to me, right now you're repeating nonsense that you're inferring based on apparently some light reading and no actual experience in the culture of and use of an actual Smalltalk.


Smalltalk's image file(s) contain only the compiled code, not the original source code, which is on the changes and source files. You could decompile the image and get most of the source but not in its original, complete form.

If your image crashes it gets reconstructed from those two files.

It would be great if you Smalltalk fans would explain its source handling in these terms above, instead of promoting "image based" as some sort of magic where there aren't any text files, because in this forum some programmers are getting (needlessly) scared about the image-based system and (needlessly) fearing it.


I'm sorry but you are really completely missing the point. You are conflating how Smalltalk is implemented under the hood (using files) with how Smalltalk is used for programming (using the image). Under the hood, Smalltalk has to adapt to the host platform, whether that be Windows, macOS, or Linux. In the original Smalltalk implementation over four decades ago, Smalltalk was the host platform (or operating system), so there were no files for source code.


Correct - and the only time someone would directly interact with the .changes or .sources text files (as-text-files without using the IDE), is in the unlikely event that the image file had become corrupted in some way, and they were trying to recover work that had been done.

The .changes and .sources text files are maintained in-the-background by the IDE and kept in-sync with the image file.


Correct, and not remotely the point being made. Just stop, seriously, you don't know what you're talking about.


You only threw attacks and condescending comments instead of explaining Smalltalk's IDE way of keeping files, which I did. You are doing a disservice to the Smalltalk community with such an attitude.


> You're misunderstanding Smalltalk, probably​ because of hype mongers like the author of this article.

With that comment, you lost any good will I had for you. Despite that, I tried to explain to you anyway what we mean by file based and you simply ignored it and chose to argue with me about st files being plain text which is entirely irrelevant to the conversation. What more do you want? You're wrong, Smalltalk isn't file based, but you don't seem to know what Smalltalk'ers mean by that term, and you refuse to admit you're wrong despite you not even being a Smalltalker. That's willful ignorance, I have no patience for willful ignorance nor do I have any duty to the Smalltalk community, something I know vastly more about than you as I've been a member of it for a very very long time.


Correct. iirc some Lispers also have such an attitude ;-)


Getting off topic you mentioned doing production work in Smalltalk for a decade and even said "hundreds of millions" in reveue. To me that is quite impressive. Any chance you can point to a project you've done or some prominent Smalltalk apps? Pharo has some minor ones on their site and the author of the article frequently mentions JWARS. I'd like to see more though.


The projects I'm talking about are closed source business apps. My app is listed on the Seaside.st success stories page, but I'd rather not talk about it here.


Thanks! The link might be dead...or at least was for several of the success stories. Best of luck in your endeavors.


My link isn't dead ;)


My personal experience has been that the live coding aspect makes a huge difference to my development speed. A while ago I was going through Project Euler in less-mainstream languages, just as a warm-up/distraction from work. I would do one problem at a time and then go back to work. One day I switched from Object Pascal (with Lazarus) to Pharo. I completed the problem (which I hadn't attempted before, so no prior knowledge) so quickly, that I proceeded to complete five problems in the time it usually took me to do one. Because everything was so immediate, it was really easy to maintain a flow state. I had to force myself to stop and get back to work.

The object inspector is really nice, also being able to redefine methods in the debugger and continue the current computation is super cool. Beats poring over Java stack traces.

It would be nice if there were more open source libraries available, but SmalltalkHub is getting better: http://smalltalkhub.com/list


I start from stupid since I was 8 on Programming Languages. I taught myself Assembly and Pascal before I was a teenager.

I learned Racket and Smalltalk to be a better problem solver. I ended up becoming a MUCH better programmer due to these two. Racket stuck and I use it for all my personal projects but Pharo is a great learning tool at the very least.


After starting out in Python, I did exactly the same thing with Racket and Smalltalk, which substantially improved my programming ability. I'm glad to know that I'm not the only crazy person here. :) I haven't used Pharo recently, but when using other languages (especially dynamic ones) I really miss it!


I enjoyed playing around with Pharo a few years back, and often look at what else the people working on it have been thinking of lately.

Having said that, the PharoJS website mentioned in the article could use some love, I just get an unstyled webpage[0]. Now, I love avoiding website bloat as much as the next guy, but from the point of view of a web developer who might be interested in exploring what Pharo and Smalltalk in general might have to offer, that seems a bit too minimal.

Amber, by comparison, runs a full SmallTalk on the website itself, which is pretty cool[1]. Doesn't seem to have maintained momentum beyond 2014 though.

[0] https://pharojs.github.io/

[1] http://www.amber-lang.net/index.html


FYI for anyone reading / interested: Amber is apparently still under active development, but they moved from Github to a self hosted platform [1]. Last code update was 3 days ago.

[1] https://lolg.it/amber/amber


Oh, that's good! But the website and documentation is pretty outdated then. I guess all current development goes into code?


I wouldn't take Capers Jones' estimates of SLOC/function point as evidence of anything. In most cases (including these two) this seems to be Jones taking a look at the language Wikipedia page and guessing a number.


Capers Jones is a well-respected expert in software metrics. He's done some ground-breaking work in this area. Unless you're an expert too, I wouldn't denigrate him.


> this seems to be

This seems to be you maligning Capes Jones without evidence.


Smalltalk’s use of live coding is easy and elegant; not even Common Lisp, Forth, nor Java (hot swapping) can lay claim to that.

Does anyone understand what this is talking about? I may not understand exactly what is meant by "live coding", but I think I do it in Common Lisp (via SLIME) all the time. How is it better in Smalltalk?


This is certainly an exaggeration, but I think they are referring to the integration between the language and UI elements, which can be easily changed live. The difference is that the Smalltalk UI was designed so that you can swap the code behind it during a development session and save the result in an image file, while other toolkits use a more traditional build-and-display approach.


In Smalltalk, you can pause your application and inspect the objects alive in a stack at the time you paused it, go backwards and forwards in the stack, change them to see an alternative future, make changes and resume. It is the weirdest shit.


And because it's been around for decades, people figure out how create something like that functionality for other languages:

JavaScript Time-Travel Debugger

https://www.microsoft.com/en-us/research/project/javascript-...

https://channel9.msdn.com/blogs/Marron/Time-Travel-Debugging...


Common Lisp implementations admittedly vary in how well they support interacting with the stack in this way, but some of them do it just fine, as did the Lisp Machines. (The Lisp Machine developers were heavily influenced by Smalltalk, so I'm not saying Smalltalk doesn't deserve credit for the innovation; I'm just wondering what I'm missing, if anything, by using CL today.)


For those wondering what it's like to program in Pharo or why there aren't a lot of code snippets floating around in Pharo materials: it's because the way you program in Pharo somewhat different than most languages. Pharo is an IDE in the true sense, i.e. while it's technically possible to open up a workspace (text editor) window and write a new class all on one screen this is not how things are done in practice.

Programming in Pharo is usually done either in the class browser or the debugger so that you're only ever seeing the code for one method (called a message in Pharo) at a time. Pharo and other Smalltalk variants tout simplicity of syntax but leave off the fairly complicated class hierarchy and message coupling semantics ergo the necessity for an extremely powerful browser. In the browser, messages for each class are further separated into 'protocols' such as methods for 'accessing' or 'initialization' (these are not part of the Smalltalk syntax, just a convenient layer of organization). At each level in the hierarchy, the Pharo code browser gives you a nice template to edit when you want to make a new package, class, or message. The overall effect is that you're only ever working with a handful of lines at a time and, indeed, Pharo will warn you if it thinks your message is too complex. Doing things this way actually makes everything quite manageable. One of the nice features of being pure OO is that everything is a pure black box so you just need to know that a class exists and take a peek at its interface to use it effectively.

To that end, Pharo actually has an excellent search tool that's not present in other Smalltalk variants like Squeak or Cuis. It does some kind of intelligent voodoo and can find anything from definitions to instantiated objects to senders and receivers of a certain message and so on. You can also open up a playground window to experiment with whatever code in the REPL style. But it's actually a little bit more robust than a traditional REPL because of the pure OO nature of Smalltalk. The thing you get back from evaluation isn't just some text. It's an object with all the associated possibility of reflection and manipulation (which can all be done from a UI, not just from evaluating more code).

One of the things Pharo does better than almost every other language is debugger integration. Pharo is like LISP in the sense that you can start an application, have it encounter an error (or just pause execution at will), drop into the debugger and change some stuff, reify whichever execution stack frame, then resume the program as if nothing ever happened. This is the essence of the other common Pharo workflow: write some partial code and then fill it in incrementally in the debugger until you have a fully functional and bug-free application. In addition, Pharo has its own robust unit testing system called Sunit that, coupled with the debugger workflow, creates a fantastically ergonomic TDD experience.

No matter where you are in the Pharo environment, Smalltalk code gets full treatment (E.G. syntax highlighting, code completion). So what does the syntax look like? Well, it actually has that concatenative elegance of Forth plus a few other constructs. Pretty much everything is a message send. Message sends come in three flavors: unary, binary, and keyword. Constructs like conditionals are also just message sends. In addition, there are first-class lambdas (called blocks in Smalltalk). Here's the canonical factorial program:

"Factorial function" fac := [ :n | (n = 0) ifTrue: 1 ifFalse: [ n * (fac value: (n - 1)) ] ].

where " ... " is a comment, ':=' is assignment, '[ ... ]' is a block, ':n' is the block's argument, arithmetic operators are actually binary message sends, things like 'ifTrue:' are keyword message sends (unary message sends are similar but don't have colons or parameters e.g. 'SomeObject new.'), and the statement is terminated with a period. Apparent recursion is fine because Smalltalk uses late binding. Aside from some syntax for strings and class declaration, that's basically it.

Pharo also has a lot of other nice features such as keeping a log of code changes in case of program crash or power outage, an integrated package manager/version control system, and optional git integration. It's all pretty easy to use and overall the system is quite impressive with a high degree of polish and decent performance (comes close to or exceeds node in my experience). However, as others have stated, it's a walled garden. All UI interaction happens within the Pharo environment with no option for native. If you want to break out on UNIX, you have write some kind of server and use sockets or the filesystem (which isn't a huge handicap in the grand scheme of things). On the other hand, application deployment is a little iffy. There's no readily apparent scheme to pare an image down to just what your project uses and then distribute that; users would have to install your package from within their own Pharo environment.


>This is the essence of the other common Pharo workflow: write some partial code and then fill it in incrementally in the debugger until you have a fully functional and bug-free application.

This way of developing, called by some as "Living in the Debugger", is strangely not promoted all that much by the Pharo community as far as I can see. It is quite astounding for productivity. In essence, you write some very high level code in a space, "do it", and Pharo will prompt you all the way for what it needs to make that high level code work. So you end up with code you need and no more. I have changed my whole thinking about writing software according to this pattern, even when writing in other languages (Guile, Erlang, Ada, Lua...). My Pharo remains my favourite.


If you want to get into Pharo, there's a MOOC by France Université Numérique starting October 16th:

http://files.pharo.org/mooc/



"Wrong"? That URL is linked from the page I posted. Click on "France Université Numérique".


Okay, so lot's of praise for a language. But I have three questions that aren't answered by the article:

1.) How fast are programs written in Pharao?

2.) Is it possible to write complete and halfway modern looking desktop end-consumer GUI applications in Pharao?

3.) How good is it at parallel programming (i.e. multicore support, not just concurrency with green threads)?

I'm always interested in learning a new language, if not just for fun. Currently my new language on the Todo list is Nim. However, I do not want to take a look at a language for which the answer to all of the above questions is "Meh".


1) Last time I tried it was reasonably fast for a dynamic language - somewhat slower than javascript (V8) but faster than python (cpython) to give you a ballpark

2) Yes, but ou will not use native widgets. The way you write applications is: you write code by modifying the behaviour of objects in the Pharo application (which is your editor, debugger, GUI, version control system and so on), then you strip off the parts you don't need (such as what you used to write the application in the first place). Hence you will probably use the default Pharo widget system (take a look at some Pharo screenshots to get an idea)

3) Last time I checked it was planned, but there was nothing yet


My current main language for my own projects is Racket, but there are performance issues with text% and the support for parallelism is not good enough. So I guess with this respect Pharao will not be a good alternative for me either.

However, I've looked at screenshots and the default widget system seems fairly reasonable. So I'll check it out anyway.

Thanks a lot for the replies, they were helpful!


1) Last time I tried it was reasonably fast for a dynamic language - somewhat slower than javascript (V8) but faster than python (cpython) to give you a ballpark

If this is true, then it's much slower than LuaJIT, Lisp (SBCL) and probably Chez Scheme: Three great dynamic programming languages worth checking out, by the way.


How do you get started with GUI programming? I can't seem to find anything on this for Pharo6...and barely anything for earlier versions (which I'm assuming are now obsolete).


Spec [1] is one way. You can also find a list of books on the Pharo website [2].

[1] http://files.pharo.org/books/spec-tutorial/ [2] http://books.pharo.org


To an inexperienced eye, Smalltalk's syntax seems to be suffering from colon "cancer". (I don't get a similar feeling from Lisp, for some reason.)


*ACM, want to see how bad things are, read this thread....

To understand Smalltalk in general one neeeds to understand the impetus; and behind it is Alan Kay. What we do today isn’t really “computing” as envisioned and then created in the 70s. Lots of those terms used back then are used now, but the meaning has been transformed into something entirely different.

It’s unfortunate that most of the things we call “state of the art” are bastardized and horrible versions of those from the 60s and 70s. Yet here we are in 2017 and we can’t have the majority of “computer users” create an essay defending his/her views on climate change with an actual editable running model upon which a civil discussion could be based on. But hey, we will have an iPhone X, so who cares?

Smalltalk is like a gem, a remnant from a magical world that existed and went away - but still possible - if we just took a look way, way back as to where it all originated.

For the CS students out there, get your money’s worth and start asking where all this stuff we have now came from and more importantly, why.

Here’s a good start:

A Personal Computer for Children of All Ages: https://www.mprove.de/diplom/gui/kay72.html “The basic idea is to exploit the duality between functions and tables (or processes and memory). English has nouns which refer to "objects", and verbs which refer to "actors" and "relators". This is a Newtonian epistemology. Modern physics and philosophy tend towards the idea that both "objects" and "actors" are just different aspects of the notion of process. A process has state (a set of relations having only to do with it) which changes as time (defined as interactions with other objects) passes. Using this view "data" is a process which changes "slowly", "function" is a process which changes more rapidly. Each process has the logical attributes of a complete "micro" computer: they can have inputs, give back outputs, act as a memory on file system, perform computations, be interrupted, etc. Since a "computer" can simulate all other computers (modulo time and space), having the notion of a process in a language allows useful idea such as arrays, records, recursive procedures, etc., to be added to the the repertoire at any time.”


Any good article describing Smalltalk features for C/Python/Go/JS developer?


Is Pharo open source?


Yes. MIT license.


On a tangent: I wonder how everybody who writes for Medium feels about the new Quora-style nag screens.

(I can only go on tangents since I saw the nag screen and bounced.)


No nag screens with NoScript!


It strikes me as identical to the newspapers' paywalls, in that they need the income. Except in this case, the income is from your information, not from your wallet.

I think some system of anonymous digital micropayments, integrated with the browser, is the only thing that's going to save us from paywall/adwall hell.


[flagged]


Please don't post unless it's going to be within the guidelines, like we've asked before.

https://news.ycombinator.com/newsguidelines.html


When have you asked before? And how is this not within the guidelines?


I'm sorry but the 3d image of the light house is horrible. It reminds me of POV-Ray renders from the 90s. Is Medium so poor that they can't afford a competent artist?


Medium is just a platform for posting content. The image was selected by the author.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: