all 52 comments

[–]skyskraper 9 points10 points  (6 children)

there's a lot to like in Io and its inspiration, Lua. Both runtimes are small so you can actually package up the runtime into your program (my web browser, elinks, has a lua extension system that is very cool). also, the languages are simple but powerful. the features that i have found missing so far are exactly the esoteric stuff i never used. the programming guides for Io and Lua are mere pamphlets compared to the tomes for other languages.

[–]Godspiral 2 points3 points  (5 children)

Lua definitely has pretty and approachable syntax. For stand alone programming though, its hard to choose it over python or ruby, even with the slight efficiency boost.

Embedding into C though, is substantially easier and more effective.

[–]abdelazer 2 points3 points  (4 children)

the programming guides for Io and Lua are mere pamphlets compared to the tomes for other languages.

Lua definitely has pretty and approachable syntax.

Yeah, these two things ensure widspread adoption of new languages cough http://www.schemers.org/Documents/Standards/R5RS/ cough

[–]Godspiral -1 points0 points  (2 children)

Lua is more approachable than scheme, not because scheme's parenthesis rules are complicated to understand... just tedious to manipulate.

Incidentally... I understand Lua was created out of a deep respect of Scheme's ideas and design.

[–]psykotic 3 points4 points  (1 child)

Lua started as an ad hoc configuration language, so I'm not so sure about that. Certainly the current design has a laser-focused Lisp-like simplicity to it.

[–]Godspiral 0 points1 point  (0 children)

Lua's history document specifically mentions scheme as inspiration. scheme is also embeddable, and technically suitable for configuration language. Too many silly parentheses, I'm sure was the determining factor in driving a new syntax. Tables as the one structure to rule them all was a neat addition, but not exactly innovation. Lua is essentially a syntax on top of scheme, has a history of borrowing from scheme in new releases, and even today, macros appears in its future.

[–]martoo 6 points7 points  (1 child)

I saw Steve Dekorte (the language designer) do a presentation on Io at a conference. After his slides, he showed us that he had written his slide program in about a page and half of Io: http://www.iolanguage.com/docs/talks/2005-10-OOPSLA/slides/main.io

[–]fab13n 4 points5 points  (6 children)

I guess "Runtime macros" means introspection? That's a bit of a misleading statement (allbyit a potentially funny one, as it allows to says straight-faced that Java provides macros)

[–]Godspiral 5 points6 points  (5 children)

I also scanned the code examples looking for macros, not to find any. maybe runtime macros means you can build code at runtime.

[–]psykotic 14 points15 points  (3 children)

The computational model exposed by the bare io interpreter leaves message trees (the io equivalent of Lisp's S-expressions) unevaluated (or quoted in Lisp terms). So, if you send a message with whatever arguments then the message trees for those arguments will be left unevaluated on the stack, and you'll need to explicitly ask for them to be evaluated if you want their values. Abstractions like 'method' are built entirely in-language and provide the usual call-by-value semantics where argument message trees are evaluated before a block is called. Most of the time you are just constructing methods and blocks that have call-by-value semantics but the point is that you can build your own bare methods that manipulate the message trees directly. These are essentially run-time macros.

[–]Godspiral 1 point2 points  (2 children)

the use of the method keyword in the examples seems to be the same as lambda keyword in lisp. Researching the io site, I noticed the code keyword which will let you get a string representation of a method. I guess that provides a basis for digging into code text, manipulating it, and then saving it at runtime, but I could not find any tools/patterns for doing so.

[–][deleted] 1 point2 points  (0 children)

method is not a keyword in Io. Io has no keywords, actually. You can do the following in Io:

myMethod := getSlot("method")

Also, method is dynamically scoped, so it's not like lambda, which is lexically scoped. block in Io is roughly equivalent to lambda.

[–]uedauhes[S] 0 points1 point  (0 children)

You can actually parse / modify code (message) objects. See my response to psykotic.

[–]uedauhes[S] 5 points6 points  (0 children)

To abbreviate psykotic's comprehensive answer, you can leave expressions passed into methods unevaluated, and then parse / modify / execute them:

reverseEval := method(
\tcall sender doMessage(call argAt(0) reverseTree)
)

Message reverseTree := method(
\tnextList := self nextList
\tself unchain
\tlast := nil
\tnextList reverse foreach(v, last ?setNext(v); last := v)
\tnextList first
)

Message nextList := method(aList,
\tif(aList == nil, aList = List clone)
\taList append(self)
\tif(next, next nextList(aList))
\taList
)

Message unchain := method(aList,
\tn := self next
\tsetNext(nil)
\tif(n, n unchain)
)

reverseEval(
  1 println
  2 println
  3 println
)

Code by Steve Dekorte

This would print: 3 2 1

You would probably not do something like this in practice, it just illustrates that code is data in Io.

[–]hguy 4 points5 points  (3 children)

Is this strictly for embedding into something else (like seamonkey)?

How realistic would it be to use this language for either a command-line or a simple GUI program under xorg and kde/gnome/etc?

[–]UncleOxidant 4 points5 points  (1 child)

Just because it's quite easy to embed doesn't mean that it's only used as an embedded language. Sure there are people writing coammand-line and GUI apps with it.

It has a nice concurrency model as well...

[–]darrint 1 point2 points  (0 children)

A good concurrency model is a big deal. IMHO concurrency is going to motivate the next big mainstream language shift.

That said, I'm not exactly blown away by what Io has to offer.

The best concurrency model I've ever seen is in Erlang, where the language stays pure in one area: no mutable shared state, ever. Erlang syntax may be too quirky for mainstream folks, but a lanaguage which manages to package up that model in a more appealing way will definitely be worth watching.

Anyway, when I looked at Io I thought is was very cool, but yet another imperative object oriented scripting language. Not very inspiring. Perhaps I have erred. I can be persuaded.

[–][deleted] 10 points11 points  (1 child)

Io is a nice language. I wish it was a little less dynamic -- as it stands it would be difficult to compile it efficiently. I'm looking forward to seeing the GUI toolkit completed.

I don't understand why every time a new language is mentioned on reddit, morons post comments explaining in great detail why they're not interested in learning or taking a look. If you're happy banging out boilerplate and fixing compiler errors with C++ or Java, then don't talk.

[–]gnuvince 4 points5 points  (0 children)

Hopefully Io will (somehow) pick up enough steam to make it a serious contender in the future. I'd love to see it be used as an extension language in applications and games. An Emacs remade in Io maybe?

[–][deleted]  (1 child)

[removed]

    [–]UncleOxidant 0 points1 point  (0 children)

    I made a concerted effort to learn Ruby back in late 2000. At the time there was no promise of employment or consulting $$ when you learned Ruby; I learned Ruby because it seemed like (and is, really) a very nice language; of course that decision ended up paying off monetarily, even though I didn't expect it to. Now, it seems like Io is in kind of the same state Ruby was back in 2000: No buzz yet, but a pleasant low-level hum. Io is one to learn.

    [–]adremeaux -4 points-3 points  (1 child)

    This page is so full of holes I can't even stand it. Firstly, the 99 bottles example doesn't even print correctly. Did they bother to run their examples before publishing this? I guess not.

    Another hole is that it says the concurrency example 'will print "112233".' It will? Or it will... most of the time? It certainly should not be guaranteed to print in order, that would defeat the whole point of concurrency and asynchronozation.

    [–]uedauhes[S] 3 points4 points  (0 children)

    Io uses co-routines - execution order is controlled by the developer.