5 ms·
Using line breaks between member function calls is an interesting syntax style I haven't seen before: ezl::rise(readFile<string> (argv[1]).rowSeparator('s').co
by hellofunk 11y ago
Using line breaks between member function calls is an interesting syntax style I haven't seen before:
ezl::rise(readFile<string>
(argv[1]).rowSeparator('s').colSeparator(""))
.reduce<1>(ezl::count(), 0).dump()
.run();
- haptork 11y agoHere is an article around this style (ExpressionBuilder) by martin fowler: http://martinfowler.com/bliki/ExpressionBuilder.html http://martinfowler.com/bliki/ExpressionBuilder.html
- lorenzhs 11y agoIt's very common when chaining lots of operations, each of which transforms the result of the previous one (functional style). I've seen tons of Scala code do it. Writing it all in one line would be quite the unreadable mess.
- hellofunk 11y agoI've seen it in other languages, just not in C++ before. I like it.
- skeuomorf 11y agoYeah, it's pretty common with code that uses the builder pattern as well. I also like to use it with rust combinators e.g. https://github.com/skeuomorf/conshash/blob/master/src/lib.rs#L90 https://github.com/skeuomorf/conshash/blob/master/src/lib.rs...
- sjw_12302198 11y ago[flagged] And why is this downvoted? Do the downvoters disagree with the assertion that hellofunk hasn't seen this idiom before? Really, dang, you can remove posts like mine but you do nothing to address the real problem here.
- frou_dh 11y agoPresumably it's seen as bikeshedding
- hellofunk 11y agoI'm a little confused, did I write something inappropriate? What is bikeshedding?
- lorenzhs 11y agoIt's an argument that communities and organizations give disproportionate weight to trivial issues (like coding style) instead of discussing content. I agree that there are more interesting things to discuss about easyLambda than the placement of newlines.
- jevinskie 11y agoIt lets you pass around a FooObject/FooContext and offers you a lot of the powers of a DSL while still being boring, stock BarLanguage. I find it to be very helpful for making declarative-style APIs.