3 ms·
I still hope for D here. (Maybe C# as well, but I don't know C# well enough) The D community encourages `people.pick('name').capitalize().sort()`. They call it
by qznc 11y ago
I still hope for D here. (Maybe C# as well, but I don't know C# well enough)
The D community encourages `people.pick('name').capitalize().sort()`. They call it Component-Programming and they make it fast. See [0] for a more realistic example. The trick is to turn the methods into (lazy) iterators (streams in Java land) with static dispatch. Now the compiler can inline everything and optimize it like a C-for-loop.
The problem is that the D garbage collector needs more engineering effort to be on Java level. For example, it is not precise or concurrent yet.
[0] http://wiki.dlang.org/Component_programming_with_ranges#Formatting_a_Year http://wiki.dlang.org/Component_programming_with_ranges#Form...
- vvanders 11y agoRust does something very similar, albeit with lambdas for extra syntax goodness.
- Manishearth 11y ago(to be clear, lambdas aren't necessary for this pattern to work in Rust, just that the stdlib has generic iterator adapters that are created using lambdas letting you do a myriad of things with a single function. Rust lambdas (closures) are on the stack, so this usually gets optimized down to a for loop or something)