Sunday, January 20, 2008

My Small Problem with the Scala Actor Model

Something seems wrong to with the whole send/! idea. The Scala guys say ! apparently means "send", but it really means "add message to actors mailbox", or "put". Take this example:

actor ! message
actor send message

If ! means "send", then it certainly seems like the actor is sending the message. Of course, you have no idea who its sending it to, so by that logic it must be getting the message, but it still just seems confusing. I think the API might be more readable if it used one of the following:

actor <-- message
message --> actor

I've demonstrated that you can use --> and <-- as method names already, so, why not use them here?

1 comment:

  1. yeah, there are always painful parts of any language's syntax, and once it gets into use it is hard to change (cf. the old saw about how they didn't want to change the syntax for Makefiles because a good dozen people were already using it, haw haw). for example, an even in my mind grosser problem with Scala syntax is the one letter difference between val and var. blah.

    ReplyDelete