★ Announcing Noze.io v0.2 ★

I am pleased to announce the first demo release of Noze.io!

“Server Side Swift aS a Service” a.k.a. Zzzzz

When Apple came out with Swift I didn’t particularily like the idea for Cocoa development - Swifter is much better for this. At the same time I was also playing around with Web frameworks, including Node.js.
While there was a lot to like, three things bothered me about JavaScript: the uglyness of the callback syntax, performance, and the lack of multithreading support.

Swift looks a lot like JavaScript, yet is a very fast, AOT-compiled language. There is libdispatch to distribute workloads to other CPUs. And it happens to come with pretty nice syntax for closures, including trailing closures.

1 + 1 + 1 = 1337: Enter Noze.io.

Noze.io attempts to bring Node.js concepts to Swift. And that is primarily the idea of non-blocking, event-driven I/O streams.

As it turns out, the result really looks a lot like Node code. Original code:

fs.readFile('example_log.txt', function (err, logData) {
  if (err) { console.error("failed:", err); return; }
  console.log("got data:", logData);

Swift version:

fs.readFile("example_log.txt") { err, logData in
  if err { console.error("failed:", err); return }
  console.log("got data:", logData)

Properly compiled code, no “function() {}” syntax for closures. I think it looks a little better while still providing all the Swift features.

Long story short: More and more “Node features” got added to Noze.io and it still really felt a lot like Node++. Today Noze.io seems to be in a state where it starts making some sense. A lot of Node APIs are in (streams, net, http, connect, express) - and seem to work pretty well.
Some ffat pushed me a little to finish things up and release this. So here you go: Noze.io v0.2.3, codename “Less than Prefect”.

So where are we? A lot of stuff is in. A lot of stuff is missing. This is not production quality yet. But it is starting to get somewhere.

“I love Noze.io because leftpad is a builtin”

There is a set of neat Noze.io examples you can browse. An echo daemon, a simple IRC daemon, the obligatory TodoMVC backend, and more.

Isn’t that kinda awesome:

spawn("git", "log", "-100", "--pretty=format:%H|%an|<%ae>|%ad")
  | readlines
  | through2(linesToRecords)
  | through2(recordsToHTML)
  | response

Looks like something you’d like to play with? There is a Noze.io Start Page which explains how to install Swift, Noze.io and some information on how to get started. There is a page for people who know Node.js, and a page for people new to Node concepts.

So, what do you think? Like it? Hate it? Don’t care since you are still happy with WebObjects GETobjects? There is a Slack team and a Mailing list you can join for discussion.

Have fun! hh

Written on June 6, 2016