On Sun, 02 Aug 2009 14:02:37 -0400, Leandro Lucarella <llu...@gmail.com> wrote:

Michiel Helvensteijn, el  2 de agosto a las 16:25 me escribiste:
KennyTM~ wrote:

>> Interesting.  I don't think I've seen this angle yet.
>>
>> Could you provide code examples, please?
>
> "<p>yes?</p>".replace("<", "&lt;").replace(">", "&gt;");

Sure, but they have parameters, so they require parentheses anyway. Robert Jacques was talking about omissible parentheses for function chaining. That
would require parameter-less functions.

Well, just take parameter-less functions then:

" hello   ".strip.toupper.replace("O", "A"); // "HELLA"

(I don't know if that even compiles in D2)

I think it's better to have mandatory (), though. Even when you save
a couple of strokes there, I find that code way more confusing than the
same with () (from that code it looks like hello has a strip property
which in case have a toupper property which then have a replace method).

Again, is a tradeoff between writeability and readability. I think is way
more important to prioritize readability.


I think its better to prioritize readability too, it's just that to me "hello".strip.toupper; is more readable than "hello".strip().toupper();. I've long since ceased to use () on zero argument functions and have never looked back.

BTW, I think you meant a strip field, since a property is just a method call with some syntactic sugar.

Reply via email to