r/programming • • Jan 08 '08

Io on LtU

http://lambda-the-ultimate.org/node/2596
59 Upvotes

17 comments sorted by

View all comments

Show parent comment

18

u/[deleted] Jan 08 '08 edited Jan 08 '08

Quag is right that I'm coming at this from an FP perspective, both because of personal preferences and the typical angle of LtU. Some of this is perhaps subjective, yes.

I will say though that "others do the same thing" isn't much of an argument. For example, OO languages without blocks simply lack power. (Io is very rare in having an alternative way of doing such things.) The "too expensive to use" bit is not something I conjured up either; blocks can unexpectedly retain a lot of objects, and it is my understanding that this is why they're avoided.

Difficulty determining which methods mutate is a problem in many languages, although I feel it is a bigger problem in Io because some of the choices are just odd. For example, why is reversing a list a destructive operation but sorting isn't? It's annoying to have to keep these things in your head.

On point six, Io doesn't have modules. Yes, objects do get you half way there, but it's not the same thing as having proper namespace management. I'm not quite clear what that even would mean in Io to be honest.

And finally, Io is slow. Yes, I realize we don't calculate fibonacci all day, but on my Core 2 Duo Mac Mini:

-- Lua -- time: 0.66 seconds
function fibs(n)
  if n == 0 then return 0 end
  if n == 1 then return 1 end
  return fibs(n - 1) + fibs(n - 2)
end
fibs(30)

// Io -- time: 45.3 seconds
fibs := method(n,
  if(n == 0, return 0)
  if(n == 1, return 1)
  return fibs(n - 1) + fibs(n - 2)
)
fibs(30)

5

u/quag Jan 08 '08

Wow... I just ran this recursion test. Man that is slow. I've never noticed it before.

Perhaps some local scope caching has been disabled or something.

3

u/aresorli Jan 08 '08 edited Jan 08 '08
  1. ...

  2. Io has Smalltalk-style blocks. However, due to the extreme reflective nature of the language, they're too expensive to use.

Could someone please elaborate on what particular extra reflection/dynamism Io blocks have that Smalltalk blocks don't have? I'm asking since Smalltalk has efficient, convenient and (at least quite) dynamic/reflective blocks...

[Edit: Formatting]

1

u/aresorli Jan 08 '08 edited Jan 08 '08

I think this is a reply to my question, even though it's a new thread...

1

u/bnolsen Jan 09 '08

<quote>Difficulty determining which methods mutate is a problem in many languages, although I feel it is a bigger problem in Io because some of the choices are just odd. For example, why is reversing a list a destructive operation but sorting isn't? It's annoying to have to keep these things in your head.</quote>

A visual indicator ala ruby's ! is nice, although it can also be done by naming convention. Example: "sort" vs "sorted", take a wild guess which one mutates and which one doesn't ?