3 ms·
I wish more languages did something like the D feature where method syntax and function syntax are really just syntax - i.e., str.len() is equivalent to len(str
by juped 7y ago
I wish more languages did something like the D feature where method syntax and function syntax are really just syntax - i.e., str.len() is equivalent to len(str), and you use the syntax that best improves readability at your call site.
- turbinerneiter 7y agohttps://en.m.wikipedia.org/wiki/Uniform_Function_Call_Syntax https://en.m.wikipedia.org/wiki/Uniform_Function_Call_Syntax Called uniform function call syntax, an I idea I first saw in Nim and found really cool, but then found really dumb. Can't remember the reasoning for both opinions, which is a strong indicator of "probably doesn't matter". For a while I was entertaining a thought regarding mutability and returning copy's. Like foo.bar() would mutate, bar(foo) return a modified copy. Don't know if that concept has a name or if it actually makes sense at all.
- im3w1l 7y agoMaybe it's fine, but I'd be concerned about polluting the global namespace
- etbebl 7y agoMATLAB of all languages does this! Although as usual it's quirky about performance: the foo(bar) syntax (which used to be the only syntax) is faster.