Wither method references?

John Nilsson john at milsson.nu
Tue Jun 21 18:30:36 PDT 2011


Hmm, I would write those with the left brace on the same row.

BigLongGenerifiedSamDeclaration foo = #(a, b, c) {
  ...
};

BigLongGenerifiedSamDeclaration foo = {a, b, c ->
  ...
};

BigLongGenerifiedSamDeclaration foo = {(a, b, c) ->
  ...
};

BigLongGenerifiedSamDeclaration foo = #{(a, b, c) ->
  ...
};

BigLongGenerifiedSamDeclaration foo = (a, b, c) -> {
  ...
};




thatObject.apply(#(a, b, c) {
  ...
});

thatObject.apply({a, b, c ->
  ...
});

thatObject.apply({(a, b, c) ->
  ...
});

thatObject.apply(#{(a, b, c) ->
  ...
});

thatObject.apply((a, b, c) -> {
  ...
});




Also consider optional braces:

//SotL, BGGA+#
thatObject.apply(#(a, b, c)
  ...
);

//BGGA, Redmond
thatObject.apply((a, b, c) ->
  ...
);




The BGGA versions + optional braces allows for an interesting compromise though:

BigLongGenerifiedSamDeclaration foo = {
  (a, b, c) ->
  ...
};

thatObject.apply(
  (a, b, c) ->
  ...
);


BR,
John


More information about the lambda-dev mailing list