04 July 2016

A friend of mine gave me an Esquilo Air for my birthday a while ago, and I decided to try to use it for an over-engineered clock I’m in the process of building.

Picture of the Esquilo Air. Credit www.esquilo.io.

The Esquilo Air features an embedded a 120MHz ARM processor, embedded WiFi, μSD card slot, built-in cloud features, and a slew of the usual inputs and outputs. Its headline feature is its built-in browser IDE running the Squirrel language — no other programming option exists. On paper, it seems like a great introduction to IoT and embedded development. Unfortunately, it has a number of issues, one of which made it simply unworkable for my purposes.

Squirrel, the Language

Squirrel is an interesting language. It seems to primarily compte with good ol’ Lua, the small embedded language of choice for game devs for ages. Both Lua and Squirrel feature very easy integration and small, efficient interpreters. I am lukewarm on Lua; its type system and (lack of) OOP does not endear me to it but I wouldn’t complain too much about having to use it if I needed to. Before I get to the rant, I’m going to be fair and list off the things that I like about Squirrel, especially comparing to Lua:

  • Actual OOP support, with classes, inheritance, and static methods. Lua has none of that (although it can be bolted on via metamethods).
  • Slightly more elegant lambda syntax than Lua.
  • Functional programming constructs (specifically map, reduce, and filter) built-in.
  • Default/optional arguments to functions.

Squirrel, the Rant

On the other hand, Squirrel has some design decisions that strike me as simply bizarre:

  • Almost a complete lack of string manipulation. Specifically, there is no string.replace, nor string.join (although that can be implemented with reduce). If I wanted to deal with C’s useless string library I would just use C.
  • The syntax is inconsistent. The left-arrow operator (<-) is used to “create slots” (AKA store values in new variables) while = is used only to assign to already-existing slots (variables). Except if you’re dealing with a local variable. Then you use = exclusively: local x <- 3 is not correct; local x = 3 is. By comparison x = 3 is an error (assuming x doesn’t exist previously), while x <- 3 is correct.
  • Default function parameters cannot refer to class members. In other words, the following code will not work:
class Foo {
	x = null;
	function bar(y = x) {
		print(y);
	}
}

Esquilo, the Rant

The Esquilo iteslf is not without its own problems, either:

  • The getting started guide is out of date: It tells you to use a menu to load libraries when they switched to programmatic library loading (require('lib')) in one of the first updates released.
  • The HTTP library errors when it receives a response that is too large for it to handle. The error it throws is identical to the one thrown when the response is not properly formed per the HTTP specification, and the specific error (or the max content size) is not documented anywhere.

The last one is what really sunk it for use in my project — It couldn’t handle almost any of the forecast.io API.

Conclusion

In short: The Esquilo Air is a nice, albeit limited piece of hardware running a language that has good ideas but some extremely poor design decisions made along the way.


Categories

Tags