
Atomo, the programmer's programmable programming language - steveklabnik
http://atomo-lang.org/
======
swannodette
This looks really cool and reminds me a lot of Io. Speaking of Io, this make
me curious about the performance of Atomo. Io while an amazing experiment in
expressivity has terrible performance. Does Atomo similarly prioritize
expressivity to the detriment of reasonable performance?

~~~
vito
Right now, my priority with Atomo is consistency in the design and simplicity
in the implementation. It's acting as an incubator for a ton of interesting
language features at the moment (both for myself and for Slate), so I haven't
made optimization a priority yet as major parts of it are constantly changing.
For example, the version on Hackage has a traditional exception system, while
the latest darcs changes have replaced that entirely with a condition/restart
system written in Atomo.

I'd call it "fast enough," but it's no speed demon. It's pretty early on; I
just started planning Atomo's design this June. There's almost certainly some
low-hanging fruit when it comes to optimization, and it is something I've been
keeping a close eye on for a while now. It's only been getting faster, and in
my testing of GHC 7 I saw pretty substantial performance boosts for free. And
that's the nice thing. It's built on a fantastic platform, which you can drop
into very easily whenever you want with a nice DSL.

Glad you like it, though. I completely understand the caution when it comes to
performance of such a high-level language.

~~~
swannodette
Sounds reasonable. So is it possible to mix Haskell in with Atomo to get to
the metal so speak? Do you have any examples of this?

~~~
vito
Yes; all of Atomo's kernel is defined using this Haskell DSL. For example,
here's Atomo's ports system:
[http://darcsden.com/alex/atomo/browse/src/Atomo/Kernel/Ports...](http://darcsden.com/alex/atomo/browse/src/Atomo/Kernel/Ports.hs)

I've also written a few wrappers for Haskell libraries over at
<http://darcsden.com/alex> \- see http, json, and command.

Basically, you define your methods in Haskell, and call them from Atomo; these
methods can be defined as an expression (=:::), a value (=::), or some
arbitrary VM action to be executed to yield a value (=:). (Admittedly those
operators have gotten a bit silly.)

The definitions use QuasiQuotes for the method pattern, and can use them for
expressions as well, though that's not encouraged (operator precedence and
macros make it a tricky thing to do at compile time). They look a bit noisy -
[$p|x foo: y|] but that'll be fixed come GHC 7, where that pesky $ is removed.

------
gregschlom
Looks cool, but what are the use cases for Atomo? Would be nice if there was a
section "Why Atomo", on the website.

More specifically, what prompted the creation of Atomo? Is it only for
fun/personal research? Is it a school project? Is there a business problem
that Atomo is solving?

(I'm just curious, this is not a "do we need another programing language?"
criticism. I always wanted to write my own programming language for fun :)

------
ash
Here's what I needed to do to install and run Atomo under (latest) Ubuntu:

    
    
      $ sudo apt-get install haskell-platform libghc6-terminfo-dev
      $ cabal update
      $ cabal install atomo
      $ ~/.cabal/bin/atomo
      > 1 + 1
      2

~~~
vito
Hackage has been down all day; I've uploaded a new version (0.2.1) just now
which has the new condition/restart system, new REPL, and other goodies.
Should be just a "cabal update; cabal install atomo" away! :)

------
jashkenas
Many bits of Atomo are written in Atomo, including Eco (the package manager),
the REPL, and so on...

<http://darcsden.com/alex/atomo/browse/prelude/>

~~~
sliverstorm
Are there any languages out there that are, or virtually are, written entirely
in themselves?

~~~
jashkenas
I was interested in Atomo-in-Atomo, because I'm working on CoffeeScript, a
language that is written in itself:

[http://jashkenas.github.com/coffee-
script/documentation/docs...](http://jashkenas.github.com/coffee-
script/documentation/docs/grammar.html)

~~~
jhrobert
Come on! by now everybody knows what you're working on! ;-)

------
apl

      0 fib = 1
      1 fib = 1
      (n: Integer) fib :=
        (n - 2) fib + (n - 1) fib
    

Reading the first line as "For zero, 'fib' is 1" is surprisingly intuitive.
Not sure if this translates to something like

    
    
      x = Object clone
    

though. Maybe some conventions shouldn't be touched?

~~~
steveklabnik
<http://en.wikipedia.org/wiki/Pattern_matching>

~~~
apl
Sure, but I'm surprised by the "reversed" notation. Wouldn't it be

    
    
      fib 0 = 1
    

in Haskell? I just felt that this order works well for pattern matching
functions, but not as well in other contexts. No CS background here, by the
way; maybe I'm just missing your point.

~~~
vito
Both of those uses of = above are actually pretty consistent, given how
Atomo's scoping and dispatch system works.

When you said "for 0, fib is 1," you could just as easily say "for the current
scope object, x is Object clone." This is exactly how it works. Method
dispatch is 100% pattern-matching, and Atomo's scopes are 100% message
dispatch, combined with delegation.

When you say "0 fib = 1", the method is inserted on Integer. When you send a
message to an Integer, you're sending (pseudocode) `Single "fib" (Integer 0)`.
The methods on Integer pattern-match on that, in this case with `PSingle "fib"
(PMatch (Integer 0))`. If that pattern fails, it moves on to "1 fib = ...",
and finally to the least-precise "(n: Integer) fib := ...".

Not sure if that answers your question, but I thought I'd expand on it a bit.

------
draegtun
Like others have already mentioned it does (at first glance) seem have a
passing resemblance to Io (<http://iolanguage.com>).

Here is the _Greeter_ example in Io:

    
    
        Greeter := Object clone
    
        Greeter new := method (n,
            Greeter clone do (name ::= nil) setName(n)
        )
    
        Greeter sayHi := method (
            (name .. ": Hi!") println
        )
    
        Greeter new("Alex") sayHi
    

Very close. However even though I've tried to make it look _identical_ you can
see the differences poking through. And reading through the Atomo docs there
are (naturally) other divergences.

I would say that Atomo is probably more closer to Ioke (<http://Ioke.org>)
than Io. The philosophy behind Io is to keep it small & simple. Whereas Ioke
is Io + extra syntax, literals, etc baked in.

Worth keeping an eye on Atomo... as is Io & Ioke. For reference here are the
other examples in Io:

    
    
        File with("out-file") open do (
            write("hello, world!\n")
        )
    
        fib := method (n,
            if (n == 0, return 1)
            if (n == 1, return 1)
            fib(n - 2) + fib(n - 1)
        )
    
        list(1, 2, 3) sum
        Range 0 to(5) map(* 2)

------
jhrobert
I love the "Particule" concept, a nice extension of atoms (and a much nicer
name than "tuple"). Where is it coming from?

Without going into Prolog, now that you have some pattern matching, maybe you
could have some notion of success/failure, like in Icon, this is very
expressive. <http://en.wikipedia.org/wiki/Icon_(programming_language)>

------
ivanmantova
Just when I thought I wouldn't be surprised by a new language anytime soon.

Getting the source right now to see what's inside.

------
russellallen
Very cool - you mention Slate, are you in contact with Brian Rice? Because if
not you should be.

~~~
vito
Yep! He's in #atomo, and I'm in #slate; there's a ton of back-and-forth.

