Tuesday, 14 December 2010

And It’s I-o Silver Lining

Will Io finally find a way to win me over, or will the silver lining just be that this is the last day of Io, and I can soon move on to the next language? Let’s find out.

In the opening paragraph of day 3 the author tells us that he found the first few days frustrating but after a couple of weeks it had started to click & helped change the way he thinks. Spurred on by these words I fired up the interactive console again, and took me straight back to the non-existent .io_history error message :( I think that fate doesn’t want me to like Io.

The book went on to describe how to create DSLs with Io. Following on from the previous day showing us how we can create custom operators etc. this seems like a good fit, but not so much that I was bubbling over with delight by the end of that section.

Following that we had a section on concurrency. It started with coroutines, this is a way of writing asynchronous code where the developer states exactly where control can be yielded to another thread which should lead to fewer heisenbugs. This struck me as a nice design. Then came actors and finally futures which seem a lot like Tasks in .netland. The provided sample called URL to retrieve a page from the web, but this library doesn’t seem to be included by default, so I was left with an error message stating that Object does not respond to URL. Once again these issues left me feeling like I didn’t want to dive into the self study section which dealt with expanding upon the DSL code from earlier in the chapter.

I’ve wanted to like Io. The intro to it had sparked some interest, but the constant niggles to get anything to happen have sapped my enthusiasm too quickly. As he sums up the language, Bruce mentions how syntactic sugar is a matter of taste, Ruby has lots whereas Io has none, based on the preferences of their creators. Personally I find myself drawn in to the Ruby style (even if I dislike the excessive use of the underscore in names). Add this to the problems that I’ve had getting anything to run and it just lead me further away from embracing Io. Still, no-one said I need to end up loving them all.

Next up, Prolog.

I-o, I-o, It’s Back To Work I Go

It’s been a while since I last had the chance to do a bit more learning, but I’m back with it so lets see how day 2 of Io goes.

The chapter started off with standard control flow stuff in the form of conditionals and loops, stuff that I would probably have expected to see in day 1 really. Nothing too remarkable here, and it quickly moved into creating custom operators which was pleasant, but I’m not sure how useful that is on a day to day basis. I can’t remember ever feeling a need to so much as override an operator in .net, let alone create a new one.

Next up was more about message passing. Io is all about messages, to the point that pretty much anything that isn’t a comment or a comma is a message. This allows you to create control structures in code that would typically need to be keywords implemented by the language creators. Messages are only evaluated when they are specifically required rather than the typical evaluate the parameters, push the values on the stack and call the method approach that typifies most languages. That has a quite a nice functional feel, and no need to start a call with “() => “

The chapter ends with a section on reflection. The supplied code here worked fine for me when run in a file, but trying to get it to work in the interactive mode was a non-starter sadly. Of course I spent a while trying to enter and run it before going the file route, so yet again I spent more time mucking around trying to get things to work with Io rather than learning about it. By the time I arrived at the self study page I’d pretty much decided that I was going to leave it off.

Still, the book continues to be engaging even if this language keeps throwing up obstacles to using it cleanly. I particularly enjoyed sending messages to princessButtercup, and the ambiguous animal noises.

Friday, 3 December 2010

Io day 1.5

A little time had gone by, I was ready to forgive Io and see what I could pick up as I continued on with the bulk of the chapter. Sadly Io still wasn’t ready to make friends. Trying to fire up the REPL I got an error proudly proclaiming “Exception: while loading history file '/Volumes/Data/User Data/tobz/.io_history', reason: No such file or directory” I had a look and there was a file of that name there, I tried chmod-777-ing it to no avail, and my limited Unix skills were pretty much done. Fortunately simply removing the file seemed to do the trick.

Io day 1 then followed roughly the same pattern as Ruby day 1, but due to the sparse nature of its syntax it felt far less familiar. The tasks to find info online are tricky enough compared to Ruby just because of the difference in user base and associated sites/posts about each, when you factor in the commonness of the term io, it becomes even worse. Got there in the end though.

So far I’m not feeling the love. All the pain just getting it up and running certainly left a bad taste in my mouth about the whole thing, and the unfamiliar feel to the syntax leaves me feeling a bit disconnected so far. Still, I’ve only just scraped the surface so far, maybe once we get in a little deeper I’ll see something special that it does in a particularly nice way and start to warm to it. We shall see.

I should mention that there were some amusing giggles in the film references used to show off a few of the features. Even if the language has yet to grab me, at least the book continues to be good :)