Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Smalltalk, but not quite

Name: Anonymous 2012-02-20 12:28

A dozen years ago, smalltalk was considered the number one graphical interface language, pretty much defining what is nowadays known as turtle graphics.

Unfortunately, smalltalk has a very old object system, one that is considered ancient today; So I decided to whip out a design for a less verbose object system, one that may be easier to learn.

What do you think?


import System.
import Extra/Qt [QtGui].

class Example uses (QtGui/QWidget) [
    new := [
        super: new.
        self initUI.
    ]

    initUI := [
        self setGeometry: [300, 300, 250, 150].
        self setWindowTitle: "Icon".
        self setWindowIcon: (QtGui/QIcon new: "web.png").
        self show.
    ]
].


define [app, ex]
app := QtGui/QApplication new: System/ARGV.
ex := Example new.
System/Exit: (app: exec).

Name: Anonymous 2012-02-20 12:33

I'm not really familiar with Smalltalk. It looks like both arrays(?) and lambdas(?) can be used as rvalues. How does the parser make the distinction without exponential lookahead blowup?

How does the old object model differ from the new one? What exactly are your improvements? I can't tell what you're trying to do.

Name: Anonymous 2012-02-20 12:36

>>2
How does the parser make the distinction without exponential lookahead blowup?

It doesn't have to. In smalltalk, everything is an object, that goes for blocks as well (a '[ ... ]' construct is a block). In this case, it's a block of values. A function is also just a block.

How does the old object model differ from the new one? What exactly are your improvements? I can't tell what you're trying to do.

It's all about syntax here, really.

Name: Anonymous 2012-02-20 12:42

turtle graphics
U MENA ROGO

Name: Anonymous 2012-02-20 12:46

>>3
I don't know stuff about Smalltalk. Assume I know nothing and detail your improvements accordingly.

Name: Anonymous 2012-02-20 13:15

Smalltalk has generally been superseded by D. Learn D.

Name: Anonymous 2012-02-20 13:56

Those points in the end of statements are directly from COBOL, amirite?

Name: Anonymous 2012-02-20 14:14

>>7
Nope, smalltalk.

Name: Anonymous 2012-02-21 4:35

I don't know if stuff like QtGui/QIcon would work out if you were going to support the symbolic arithmetic operators. What if QtGui and QIcon where both floating point numbers in this case? But maybe it could work. I suppose the / would be a method implemented in QtGui (whatever it might be), and in this case, it would take one unevaluated name argument QIcon and retrieve the QIcon inner type of QtGui?

Name: Anonymous 2012-02-21 9:46

i don't really like the class inheritance part where you have a "new" function that has to be sure to call "super new"

Name: Anonymous 2012-02-21 11:11

check 'em

>>11 at 11:11

get on my level

Name: Anonymous 2012-02-21 12:10

Smalldubs

Name: Anonymous 2012-02-21 12:29

>>9
QtGui in this case, would be an uninitiated class object, not a class instance. So, operator overloading wouldn't apply. Besides, the '/' syntax is just module namespacing eyecandy.

>>10
Could be done better... frankly, I never attempted to read into smalltalks Object system, because it's very frustrating.

Back then, these overly verbose "AuthorName", "AuthorEmail", etc, attributes may have seemed like a good idea, but nowadays, they are close to pointless.

Name: Anonymous 2012-02-22 2:25

>>1
props to op for posting some smalltalk code, which is something you almost never see (unless you are a part of their insular community)

Name: Anonymous 2012-02-22 4:27

I like it

Name: Anonymous 2012-02-22 6:52

using Smalltalk
born after 1979
ISHYGGDT

Just switch to Ruby already and stop trying to teach an old language new concepts.

Name: Anonymous 2012-02-22 11:17

>>16
Smalltalk is a consistent language with a nice object system. Ruby is shit.

Don't change these.
Name: Email:
Entire Thread Thread List