Live data from Hacker News

Why I love Smalltalk

pupeno.com

11–20 of 38 posts

Re: Why I love Smalltalk

#11
I like Smalltalk, but like Forth and Lisp it's just not practical in most of my computing tasks, career or hobby-wise. It's a shame that Smalltalk didn't evolve enough to challenge Java in the '90s. But my buds that knew it well and also had some C chops are in demand as Objective C coders.

Re: Why I love Smalltalk

#12
post #8

equals: other ^ PTrue new The implementation of ifTrue isn't done. The branching was just deferred to the equals function, which has to somehow choose between PTrue and PFalse. Will it take advantage of the ifTrue function you're building? Will it resort to some nasty arithmetic? Will it call some baked-in feature of smalltalk? Without an answer here, the "implementation" of if is just an illusion.

I don't think that's fair. Being able to implement if doesn't mean that the entire remainder of the system is built without any conditional instructions anywhere in its implementation. (The point, after all, isn't some sort of mystical purity; it's that if you can implement if then you can probably also implement whatever other control structures you happen to fancy. Which you can.)

The problem is that reading this seems very bait-and-switch-y. Basically, author is doing:

(define (my-if cond t f) (if cond (t) (f)))

(my-if #t (lambda () ....) (lambda () ....))

The trickyness about if lies in the order of argument evaluation. If you ignore that, then it is relatively easy to implement if in any reasonable language. Even C (I had to leave out the function pointer types, as I haven't worked with c in a few years, and forget the syntax):

void my_if(bool cond, t, f) { if(cond) { t(); } else { f(); } }

void if_true() { ... } void if_false() {

}

my_if(true, if_true, if_false);

Point being, I think redxaxder may have been coming from a scheme background, realizing that if needs to be a builtin. It would indeed be fancy to be able to implement an if that doesn't rely upon other logical branching, though!

Re: Why I love Smalltalk

#13
It covers some of the minimal syntax of Smalltalk but didn't touch on Smalltalk images, which is a major signature of Smalltalk.

A Smalltalk image contains every Smalltalk object. This includes classes (which are Smalltalk objects), instances of the classes, source code, the current running state, everything. You work within the image and interact with it.

Think of the image as a copy of your IDE, along with the compiler, your current project's source code, the compiled classes, methods, everything. You can save your image (state) at any time, not unlike the sleep feature of Windows and Mac. It's a live environment. During a programming session, you edit and save the code of class (it's automatically compiled) and every instance of that class is updated. This sounds like what you commonly have in many dynamic languages, but Smalltalk takes it to an extreme. You can re-configure your "IDE" as you go along since they are running in the same image, all the classes and objects are accessible. Or you can set breakpoints and step through code, changing code on the fly and resuming, all without stopping the "program" and starting again. Not unlike a graphical REPL.

Does anyone know if there's a similar tool utilizing the same concept other than Self?

Re: Why I love Smalltalk

#14

Copy of the text, since it's hard to reach the site itself [any layout errors should be assumed to be mine]: This post was extracted from a small talk I gave at Simplificator, where I work, titled “Why I love Smalltalk and Lisp”. There should be another post, “Why I love Lisp” following this one. After I learned my basic coding skill in more or less traditional languages, like C, C++, Python, there were four language…

Yeah, you guys killed my server... it's appreciated anyway.

Re: Why I love Smalltalk

#15
post #7

Copy of the text, since it's hard to reach the site itself [any layout errors should be assumed to be mine]: This post was extracted from a small talk I gave at Simplificator, where I work, titled “Why I love Smalltalk and Lisp”. There should be another post, “Why I love Lisp” following this one. After I learned my basic coding skill in more or less traditional languages, like C, C++, Python, there were four language…

Appreciated :) I'm unable to access the site at all right now. HN traffic might have brought it down.

Indeed it has! My server is smoking :P

Re: Why I love Smalltalk

#16
post #5

The syntax is quite unique to Smalltalk. The message, otherwise known as “method call” in other languages, is called show: (including the colon) and it takes an argument. self also uses this method call syntax. However this syntax can get quite confusing, see this example from http://en.wikipedia.org/wiki/Self_(programming_language) valid: base bottom between: ligature bottom + height and: base top / scale factor. Sm…

As far as I know both Self and Slate are very strongly inspired by Smalltalk.

Re: Why I love Smalltalk

#17
post #13

It covers some of the minimal syntax of Smalltalk but didn't touch on Smalltalk images, which is a major signature of Smalltalk. A Smalltalk image contains every Smalltalk object. This includes classes (which are Smalltalk objects), instances of the classes, source code, the current running state, everything. You work within the image and interact with it. Think of the image as a copy of your IDE, along with the comp…

I consider the image an implementation detail of Squeak or the original Smalltalk-implementation. You can implement Smalltalk the language without the image: http://smalltalk.gnu.org/

Re: Why I love Smalltalk

#18
post #5

The syntax is quite unique to Smalltalk. The message, otherwise known as “method call” in other languages, is called show: (including the colon) and it takes an argument. self also uses this method call syntax. However this syntax can get quite confusing, see this example from http://en.wikipedia.org/wiki/Self_(programming_language) valid: base bottom between: ligature bottom + height and: base top / scale factor. Sm…

Thank you, I wasn't familiar with Io before

Re: Why I love Smalltalk

#19

equals: other ^ PTrue new The implementation of ifTrue isn't done. The branching was just deferred to the equals function, which has to somehow choose between PTrue and PFalse. Will it take advantage of the ifTrue function you're building? Will it resort to some nasty arithmetic? Will it call some baked-in feature of smalltalk? Without an answer here, the "implementation" of if is just an illusion.

In a class like MyClass you would probably use the same ifTrue to compare the different members of the class. Eventually, the comparison boils down to numbers. To answer your question, we may need to look at the implementation of = for Integers or something like that.

If you go deep enough, the comparison and/or branching is built in in the microchip and you use that.

Re: Why I love Smalltalk

#20
post #10
post #8

Earlier quoted context omitted.

I don't think that's fair. Being able to implement if doesn't mean that the entire remainder of the system is built without any conditional instructions anywhere in its implementation. (The point, after all, isn't some sort of mystical purity; it's that if you can implement if then you can probably also implement whatever other control structures you happen to fancy. Which you can.)

Actually, that really is how Smalltalk does if.

In the blog post I include a screenshot of it... but my server is dying at the moment.
Post reply on HN