A lot of programmers start with C, or C++, or Java. They’re currently the big three in the industry, with good reason: they’re time-tried, and cross-platform.
Other areas have their own (preferred) languages:
- Ruby (Rails, Sinatra, Padrino)
- Python (Django, Flask)
- Java/Scala (Play)
- Academia (PLT):
- Standard ML
- Systems Programming:
- C/C++ (especially embedded)
Of course, these languages can also be used for general-use programming. I regularly use Ruby for quick prototyping, and then move to another language more suited to what I actually need.
Functional programming is based on Alonzo Church’s λ-calculus.
One of the first real implementations of this was LISP in the late 1950’s. Lisp attempted to offer a simple mathematical style of programming to the then only imperitive field.
Later, other so-called “functional” languages emerged: Standard ML, Clean, Scheme, Common Lisp, Caml, OCaml, Haskell, Pure, etc. Only two of these are object-oriented: Common Lisp and OCaml, and neither are languages that traditional O-O programmers feel comfortable just look at. Common Lisp is obviously a Lisp, and OCaml is obviously an ML. Both are very powerful, but the syntax takes some getting used to.
This is something I’d like to have. Objects in functional language, that looks something like Ruby or Python. So I came up with Brick.
Brick is functional.
Brick is object-oriented.
Brick looks (something) like Ruby, Python, and Scala.
Here’s a taste:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
So let’s look at this. We have classes, declared with the
class keyword. Following that is the class’ name, the default constructor, and the list of traits that we implement, here just
After that is the members list, which lists all the slots our class has.
After the members list comes method declarations. Methods specifically all have the type of
ThisClass -> something..... This means that there is an implicit first parameter that has the type of the current class. The name of this parameter is
The previous example can be simplified to
1 2 3 4 5 6 7 8 9
So what do you think? Do you like this syntax? I like it. (It’s pretty clean)