Archive for the ‘Programming Languages’ Category

Monads on the Cheap I: The Maybe Monad

Sunday, December 16th, 2007

Don’t worry, this isn’t YAMT (Yet Another Monad Tutorial). This is a practical post about a code smell that afflicts everyday code, and about an idiom that eliminates that smell. It just so happens that this idiom corresponds to one of the uses for monads in Haskell, but that’s just theory behind the practice, and I’ve saved the theory for the end.

This post is about style: implementation choices at the level of the expression and the statement. Style doesn’t matter much in a small program, or a write-only program (one that nobody will read later). It isn’t necessary to make a program run: by definition, it doesn’t make a functional difference. Style makes a difference to how easy or pleasant a program is to read; this can make a difference to whether it gets worked on (by its author, or somebody else) later.


Read the rest of this entry »

Overloading Semicolon, or, monads from 10,000 Feet

Sunday, December 2nd, 2007
amichail on reddit asks about understanding monads in one minute. My thoughts ran longer than a comment and more than a minute, so I’ve placed them here.

The main message of this posting is that you already use monads, just without the labels. The complexity in most explanations comes from factoring out the different pieces of what you already know, and from the mathematical exposition in terms of category theory and monad laws. (I like the math, but you won’t find any of it here.) This posting trades away accuracy for ease; I hope it’s a helpful start.


Read the rest of this entry »

Ruby and Laszlo

Tuesday, March 8th, 2005

I first heard of Ruby at the second Lightweight Languages Workshop 2, where Matz and I were both speakers. This was first public disclosure of the then-proprietary Laszlo platform language. I’m afraid I was more worried about preparing my talk then listening to Matz at the time!

Since then, a number of different people have expressed interest in both Laszlo and Ruby. I figured I had finally better take a look at it.


Read the rest of this entry »

Becoming Lisp

Friday, September 10th, 2004

Python really is becoming lisp. With the type/class unification, decorators, and generator expressions, it’s jumped from 80 percent of Common Lisp + CLOS to 90 percent1, and for web tasks the web programming libraries often make up the difference.


Read the rest of this entry »

Designing a Language

Tuesday, May 13th, 2003

One of the things we’re building at Laszlo is LZX, a language for Rich Internet Applications. (Some of the other things we’re building are the client, server, and compiler pieces necessary to make applications written in that language actually do anything.)

Language design is a process, and there’s process-specific knowledge about how to do it. Much of the knowledge is the same that’s needed to design an architecture, or an API; some of it is language-specific. Here are some of the principles I’ve found helpful in designing LZX:
more

Know the Past


Read the rest of this entry »

The DSL Tower

Wednesday, May 7th, 2003

A domain-specific language is a language for dealing with a specific problem domain, such as students at a university or entries in a blog. DSL implementation has become so easy, and some of the domains have become so deep, that there’s now a market for subdomain-specific languages (SDSLs).
more


Read the rest of this entry »