samuelgoto / proposal-block-params

A syntactical simplification in JS to enable DSLs
205 stars 8 forks source link

Syntactic look-a-likes? #17

Open rwaldron opened 7 years ago

rwaldron commented 7 years ago
function f(message, callback) {
  console.log(message);
  callback();
}

let message = "The Message";

// A
let o = {
  f(message) {
    console.log(message);
  }
};

// B
o: {
  f(message) {
    console.log(message);
  }
}

// C
{
  f(message) {
    console.log(message);
  }
}

A is valid today, B and C are possible with the syntax in this proposal. The "look-a-like" problem is subjective, so maybe not a concern? I just wanted to make a record—feel free to close if this is considered "not an issue"

ljharb commented 7 years ago

Good call - the block/object literal similarity seems like an issue there.

samuelgoto commented 7 years ago

Apologies for the silly question, but just to see if I understand this correctly:

Is the confusion between A and B in that it is hard to tell the difference between the two?

ljharb commented 7 years ago

I think it's hard to tell the difference between all of A, B, and C - especially B and C.