The State of Async/Await

The State of Async/Await

A long time ago, asynchronous programming was an exotic practice.  Not many people were doing it, and their code was punctuated with things like assembly language and processor interrupts.  Less anciently, preemptive multitasking OS’s made asynchronous programming more accessible, albeit often still with arcane and unnatural boilerplate, not to mention hazards of sharing mutable data.

Today asynchronous programming is mainstream — more than that, it’s a firm expectation of polished software for desktop, mobile, and web.  The tools for asynchronous programming have gotten better, even as far as adding syntactic sugar, which async/await certainly is.


Radically Cross Platform: Scripting with Kablooie

Photo of dog on screen of Apple Iic monitor by believekevin on Flickr.

This Dog is Turing Complete. (believekevin on Flickr)

How would you design your own ideal scripting language?  Would you go with a functional language in the LISP family, or with a more procedural style?  Would you offer object oriented organization?  Would large parts of your ideal language be recognizable as C or another common language, or would you "go for broke" with a domain specific language that (probably) only you will be able to read?

One of the fun things about computer science is that people will answer this question in very different ways, and they can all be right.  Almost everything (including your dog) is probably Turing complete.  And since the ultimate goal is accomplishing whatever operations the script is performing, whatever helps you express that well is the right answer, for you.

When implementing my cross platform graphical app engine, a set of characteristics began to crystalize for my ideal scripting language: (more…)

You Got LISP in my Python!

You Got LISP in my Python!

I’ve always been intrigued by the idea that Peter Norvig put forward, that "Basically, Python can be seen as a dialect of Lisp with "traditional" syntax."

Apparently, there are folks who don’t find this sufficient. Enter "Hy". As its creator says:

Hy is a wonderful dialect of Lisp that’s embedded in Python. Since Hy transforms its lisp code into the python Abstract Syntax Tree, you have the whole beautiful world of python at your fingertips, in lisp form!

If this is something that appeals to you (speaking for myself, having a LISP that’s got the full batteries-included libraries that are available for Python is pretty cool and could get me to take another stab at Structure and Interpretation of Computer Programs), you should check out this 47-minute talk by Paul Tagliamonte from a February meeting of the Boston Python group.

(or just scan through the slides from that talk).

Looking at some samples from the Hy documentation lets us compare the syntactical similarities and differences — this bit of Python code:

def simple_conversation():
    print "Hello!  I'd like to get to know you.  Tell me about yourself!"
    name = raw_input("What is your name? ")
    age = raw_input("What is your age? ")
    print "Hello " + name + "!  I see you are " + age + " years old."


…would be written in Hy as:

(defn simple-conversation []
   (print "Hello!  I'd like to get to know you.  Tell me about yourself!")
   (setv name (raw_input "What is your name? "))
   (setv age (raw_input "What is your age? "))
   (print (+ "Hello " name "!  I see you are "
              age " years old.")))


Why bother?

Again, from the Hy docs:

There are some advantages to having a code structure that’s actually a very simple datastructure as the core of lisp is based on. For one thing, it means that your programs are easy to parse and that the entire actual structure of the program is very clearly exposed to you. (There’s an extra step in hy where the structure you see is converted to python’s own representations… in more “pure” lisps such as common lisp or emacs lisp, the data structure you see for the code and the data structure that is executed is much more literally close.)

Another implication of this is macros: if a program’s structure is a simple data structure, that means you can write code that can write code very easily, meaning that implementing entirely new language features can be very fast. Previous to hy, this wasn’t very possible for python programmers… now you too can make use of macros’ incredible power (just be careful to not aim them footward)!

Contact Us