Functional programming piques Ruby founder, picks up Python compiler

Streem's experimental stream-based programming model could surface in Ruby 3.0, says Matsumoto

The horizon for functional programming is expanding with two languages in development, including Streem, from the founder of the Ruby language, and Mochi, which leverages Python.

The brainchild of Ruby founder Yukihiro "Matz" Matsumoto, Streem is described on its GitHub page as a concurrent scripting language based on a programming model similar to shell and influenced by Ruby, Erlang, and other functional programming languages. "Streem is my experiment to implement a stream-based programming language," Matsumoto, chief architect for Ruby at Heroku, said in an email on Sunday. "The primary motivation is to experiment [with ] concurrent programming with stream model that is higher abstraction [and a] stream-based programming model that might be [the] basis for the future Ruby 3.0 concurrent model."

Currently, Matsumoto has no particular audience for Streem since it is still in development. "It's far before [an alpha stage of development]," he said. "In fact, it was supposed to be my personal workplace for the experiment. I was so surprised so many people found it and talked about it. At the same time, I feel the huge possibility of stream programming. It can be used for text processing, data munging, distributed logging, and even Web programming."

Streem will apply functional languages to dynamic environments, analyst John Rymer, of Forrester Research, said in an email. "A request comes in, a data state changes ... and a function is invoked to run in response," Rymer said. "There's a lot out there already. AWS seeks to solve this problem with its Lambda service, which is multi-language Java (Lambda functions) and.Net (F# language) provide functional programming expressions. But if Matz's language is, A) more efficient, B) more expressive, C) more concise than the alternatives available now, that would be useful."

Mochi's description on GitHub, meanwhile, acknowledges a mix of functional and dynamic concepts. "Mochi is a dynamically typed programming language for functional programming and actor-style programming," the description states. "Its interpreter is written in Python3. The interpreter translates a program written in Mochi to Python3's AST/bytecode." Authored by i2Y (Yashushi Ito), the language features a Python-like syntax, tail recursion optimization, a macro similar to the traditional Lisp macro, and pattern matching.

Mochi drew positive reviews from commenters online. "I'm really glad we're starting to see compile-to-Python languages crop up," said one commenter, identified as RussianCow, on Hacker News. "Don't get me wrong, Python is a great language, and the community around it is fantastic, but it's missing key functional/concurrency features that would make certain problems much less tedious to solve. For instance, I love the built-in use of persistent data structures in Mochi -- that's something that's sorely missing from the Python standard library." Version 0.0.9 of Mochi is available for download. Like Streem, Mochi is offered via an MIT license.

Copyright © 2014 IDG Communications, Inc.