[racket-dev] P4P: A Syntax Proposal

From: Joe Marshall (jmarshall at alum.mit.edu)
Date: Thu Jul 29 13:00:22 EDT 2010

On Wed, Jul 28, 2010 at 3:27 PM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> Quoting from our Flapjax paper (pg 12):
> This means that instead of
>
>  var name = calmE(changes($B("name")), 300);
>
> developers can write
>
>  var name = $B("name").changes().calmE(300);
>
> which is arguably more readable than standard functional notation,
> since the left-to-right order of operations corresponds to the
> direction of dataflow.
>
> -----
>
> What I didn't admit there is that *I* prefer the dotted style for this
> kind of sequential pipeline.

There are a couple of serious problems with the dotted style.  First,
in most languages that use this notation, the `method name' (the token
immediately after the dot) is scoped within the class of the object.  Methods
are generally *not* first-class objects.  This means that you cannot write
something like:
  deffun: callit (object, method) =
    object.method()

The second problem is that what is *really* happening is a function call,
but the first (or second, depending how you count) argument is for some
unexplained reason separated from the others and placed in a weird position.
For example, in this:
  >  var name = $B("name").changes().calmE(300);

Is it immediately obvious to you that calmE takes *two* arguments?
Can you explain why the second argument isn't treated the same way?

-- 
~jrm


Posted on the dev mailing list.