News for hackers. Stuff that matters.
Re:Making Coffeescript’s Whitespace More Significant by jashkenas on Wednesday November 30, 2011 @09:09PM (#3297954)
@raganwald -- Lovely post, as always. One (somewhat important) question: If same-level continued calls mean chaining, and indented continued calls mean to use the value of the previous line, then what do outdented continued calls mean?

      first
    .second
Or heading 'offsides', in this fashion:

      first
        .second
    .third
Are those both syntax errors at compile time?

Also, how does this play with things that are not necessarily side-effect-ful? For example:

    object.property
    .value
Currently means `object.property.value`. Under your rubric, would it evaluate to `object.value`? Making any trailing access effectively a no-op?
Re:Making Coffeescript’s Whitespace More Significant by raganwald on Wednesday November 30, 2011 @10:17PM (#3298142)
Outdented calls use the last value in the column to their left. So:

      first
    .second
Never means `first.second`, either `.second` is an error, or it is applied to something above this, such as:

    someValue
      .methodName ->
        first
      .second
...which becomes:

    someValue.methodName(-> first)
    someValue.second
      
If such a value can't be found, it's an error. Of interest is the meaning of `.propertyName` in the leftmost column, as in:

    object
    .property
I suggest it's an error. As long as you can write:

    object.property # or...
    object
      .property
I don't see the value in

    object
    .property
This:

    object.property
      .value
Means `object.property.value`.
Re:Making Coffeescript’s Whitespace More Significant by sausagefeet on Thursday December 01, 2011 @08:07AM (#3299584)
IMHO, Smalltalk got this right using ; rather than whitespace. And it's easier to read.
Re:Making Coffeescript’s Whitespace More Significant by satyr on Thursday December 01, 2011 @11:55AM (#3300362)
> I suggest it's an error.

So we'd have to give up:

    array
    .map (x) ->
      f x
    .reduce (a, b) ->
      g a, b
Re:Making Coffeescript’s Whitespace More Significant by eric-hu on Wednesday November 30, 2011 @09:15PM (#3297967)
What about maintaining backwards compatibility while adding an operator specifically for this purpose. Example

     # same as first.second.third
       first
         .second
       .third

     # same as first.second, first.third
       first
         .second
       ^third

     # same as first.second.third
       first
         .second
     .third

     # syntax error
       first
         .second
     ^third
Re:Making Coffeescript’s Whitespace More Significant by satyr on Wednesday November 30, 2011 @09:28PM (#3298004)
There's no outdented continued call in current CoffeeScript; an outdented line always makes OUTDENT.

(Or are you suggesting to allow such code? I personally see no value in it.)