19 comments

[ 4.0 ms ] story [ 56.4 ms ] thread
Move is primarily aimed towards people not previously familiar with programming computers.

i am familiar with programming computers and the brackets, carets, and parentheses needed in the 3-line demo on the home page put me off.

This is really a problem. I have taught a lot of beginners in a university environment and many of them already have problems with the different C-style brackets: ( [ { } ]). Some of them asked me "Where do I find the curly ones?" AFAIK they are not even printed on many Mac keyboards.

Just imagine the hell you get into when you're using a caret/circonflexe - a character a lot of people never use at all. Imagine them finally finding the key, hitting it just to find out that in most environments they'll have to hit the space key to make it appear. A teacher's nightmare!

hello = ^(name){ "Hello "+name } repeat {times: 3} ^{ print hello {name: "John"} }

The syntax makes no sense. How can this be aimed towards people not previously familiar with programming computers?

And how can this be considered intuitive?

>When creating a function, we can specify function arguments, which are sorrounded by parentheses and put in between the "^" and the "{". These "arguments" are just like variables, but which are only available inside our function.

What's wrong with python for newbie programmer?

the code you pasted was presented on 3 lines originally:

hello = ^(name){ "Hello "+name }

repeat {times: 3} ^{

  print hello {name: "John"}
}

what doesn't make sense about it? it clearly does make some kind of sense since move has a working parser.

> What's wrong with python for newbie programmer?

nothing wrong with it, but nothing demanding it either.

i use python daily and wish it had anonymous function constructions, like javascript or, apparently, move. i think it's healthier for new programmers to appreciate code as data as soon as possible.

Maybe it's because we know how to program, but I agree that the syntax looks confusing/poor. But then, the example is confusing. Why are we building a function for what should ultimately be:

do three times print "Hello John end

I guess my point is that, if the goal is to target new developers, why show "advanced" topics (like method) for an example that doesn't even need it?

Well, in Ruby:

  3.times do
    puts "Hello John"
  end
Or

  greeter = lambda {|name| 3.times { puts "Hello " + name}}
  greeter.call "John"
Not sure, what Move offers there…
The CoffeeScript example would be:

    for number in [1..3]
        console.log "Hello, John"
Again, quite a bit simpler than Move. And runs everywhere with a browser :-)

...and if you want to do it exactly as in the example, then:

    hello = (name) -> "Hello, #{name}"
    for number in [1..3]
        console.log hello("John")
>i think it's healthier for new programmers to appreciate code as data as soon as possible.

Disagree. It's important for new programmers to feel comfortable and not confused. Code as data is a relatively overwhelming concept and I don't see any benefit to introducing to someone who doesn't even know the basics yet.

I do wish Python had real anonymous functions too - I use them all the time in CoffeeScript - but I don't think their absence makes Python a worse languages for beginners.

This language seems an awful lot like JavaScript, except you can set default values for arguments, all arguments get passed in via an object literal, and "function" is called "^"

Oh yeah, and no semicolons.

The syntax is more cumbersome than actually needed. It probably should use mandatory indentation as well. We lovers of curly brackets may not like that, but it makes things easier for beginners.[1] In this case, the first listing would have looked like that:

    hello = ^name -> "Hello " + name
    repeat {times: 3}
      print hello {name: "John"}
Or, without the keyword arguments:

    hello = ^name -> "Hello " + name
    repeat 3
      print hello "John"
(the last line is meant to be a function. Indentation is used instead of ^{}) Note that for a syntax that use juxtaposition for function application, I was very surprised to see that

    print hello "John"
    
    ==  print (hello "John")
    !=  (print hello) "John"
It looks like a misfeature (doesn't work well with currying), but maybe there's some justification?

(Edit: the language does look very simple, and I like that. Very good for "I'll show you programming in 10 minutes". For that purpose, fixing the syntax would make it even better.)

[1]: http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-i...

As an aside, who creates all these great-looking websites? I keep seeing very beautiful websites and yet all mine look like crap... Where are all these people with fantastic design sense hiding?
For the curious -- I was wondering what the initial example:

    hello = ^(name){ "Hello "+name }
    repeat {times: 3} ^{
      print hello {name: "John"}
    }
... compiled to as JavaScript. Here's the output, which you can reproduce by calling "move.compile()":

      "use strict";
      var Move, _MoveKWArgsT, Text, extend, create, print, repeat, after, JSON,
        hello;
      Move = __move.runtime, _MoveKWArgsT = Move._MoveKWArgsT, Text = Move.Text,
        extend = Move.extend, create = Move.create, print = Move.print, repeat =
        Move.repeat, after = Move.after, JSON = Move.JSON, require = Move.require;
      return hello = function (name) {
        name !== null && typeof name === "object" && name.__kw === _MoveKWArgsT 
          && (arguments.keywords = name, name = name.name);
        return "Hello " + name;
      }(repeat({
        times: 3,
        __kw: _MoveKWArgsT
      })(function () {
        return print(hello({
          name: "John",
          __kw: _MoveKWArgsT
        }));
      }));
For comparison, here's what the same example in CoffeeScript:

    hello = (name) -> "Hello " + name
    for i in [1..3]
      print hello "John"
... compiles to as JavaScript (which you can reproduce in the "Try CoffeeScript" console):

    var hello, i;
    hello = function(name) {
      return "Hello " + name;
    };
    for (i = 1; i <= 3; i++) {
      print(hello("John"));
    }
coffeescript is only a syntactic change and introduces no new semantics.

it will always win in terms of code generated

The very first part of it is really the injection of Move specific functions like 'repeat' and 'after'. It's just that they are injected as functions instead of being replaced directly in code.

Then it does the enabling of the ability of calling via hello 'x' or hello {name:'x'}, some syntactic sugar.

As my limited knowledge of coffeescript goes, you advocates on having the generated script as readable as possible, so these kind of sugar may irritate you ;-)

    print [1,2,3].unique()
whoops.
Sounds like Coffeescript to me.

Since the reference part points to ECMAScript (without being in the syntax of ECMAScript), I am simply guessing that it is extremely similar to coffeescript that entails a nearly one-to-one bindings to JavaScript.

However I am in no way seeing it sigificantly easier to code than JavaScript itself, given that it's again prototyped language, and it again subjected with the same problems JS has.

There is some interesting aspects of this language though, e.g.

  after {delay: 3000} ^{ print "3 seconds later" }
the thing is after returns an "executor" function which get called with a lambda function. If the same thing has to be written in coffeescript:

  after({delay: 3000}) () -> alert "3 seconds later"
looks not as elegant, as the parameter of the first function call can't be passed without parentheses.

(implementing "after" in coffeescript)

  after = (a) ->
    a? and typeof a == "object" and (arguments.keywords = a;a = a.delay)
    if a
      if typeof a isnt "number"
        throw new TypeError '"delay" argument must be a number'
    (fn) -> setTimeout(fn,a)