Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't find Smalltalk's syntax bad per se, but I think there's too much of it. When I see it, my eyes glaze over. Not because I don't understand the concepts behind what is being represented, but because I have a hard time getting a handle on the shape of things.

It's a matter of familiarity, and while I've spent some time looking at the object model I haven't written a lot of code in it. So perhaps that complaint is only really valid for newcomers. On the other hand, I still think it's a bit convoluted since a language like Io can express much the same stuff with less. The postcard version is something like:

    Object setSlot("foo", 12);
That demonstrates the entire informal BNF description at http://iolanguage.org/scm/io/docs/IoGuide.html#Syntax-Expres...

That doesn't account for [] and {} being translated to messages (with their contents as arguments) or for the infix operator stuff (sends the operator message—eg. +, xyzzy, etc.—to LHS with RHS as the argument) which also has precedence. Aside from that there's nothing much going on. Everything except infix operators always look like like regular message sends unless you're using a DSL. I think that's shat Smalltalk ought to look like, since that's what it's trying to be about.

Edit: Before anyone gets the wrong idea, I don't mean Smalltalk should look like Io, but that it should have little more shape than looking like message sends.



Unless you always stick to languages with the same familiar "look", learning a new language will always need more time to acclimate to. I've used FORTRAN, Tandem TAL, C/C++/C#/Objective-C, Java, Python, Go, and Smalltalk. No real problems with picking any of these up, but I always struggle with Lisp.

Language design is often a balance between making something terse and something human readable. Smalltalk strikes the perfect balance, AFAIC. Having English-like method names and variables is really quite nice. And Smalltalk still manages to be a lot less verbose than every other language I've ever used.


and Smalltalk would be:

  Object setSlot:"foo" to:12.
I have always liked Smalltalk's (via Objective-C) message syntax as it put the meaning of the function call slots where I am calling them. I hate what they've done in Swift however.

I have toyed with a scripting language that had:

  Object.[setSlot:"foo" to:12]
Still not sure on that. I immensely respect the creator of Io but it didn't click with me (my fault, not the language).


I think you misunderstand. The Smalltalk is this:

    exampleWithNumber: x
    "[ *wall-of-text elided* ]"
    | y |
    true & false not & (nil isNil) ifFalse: [self halt].
    y := self size + super size.
    #($a #a "a" 1 1.0)
        do: [ :each |
            Transcript show: (each class name);
                       show: ' '].
    ^x < y
I'm talking about an Io equivalent of the "Syntax In a Postcard" link provided above, partly reproduced here for convenience. What the code does isn't so important as how much of the syntax it covers.


Oh, sorry, yes, I got your meaning totally wrong.




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

Search: