News for hackers. Stuff that matters.
Re:Pprint: Pretty Printer for Modern C++ by 0db532a0 on Tuesday April 30, 2019 @05:30AM (#19786367)
I agree with you that there are some DSLs which are very difficult to understand at first look. However, to me shifting, and pushing/pulling over streams are not so dissimilar.

There are lots of cases where overriding operators makes sense and is intuitive to the reader, for instance when you are dealing with monoids, groups or rings.

Re:Pprint: Pretty Printer for Modern C++ by arcticbull on Tuesday April 30, 2019 @07:59PM (#19793240)
The issue is not that each one in isolation is particularly problematic, the issue IMO is when they get assembled by an end-user into a pile of mixed metaphors.

  fmt::memory_buffer out1;
  std::ostream out2 = std::cout;
  auto out3 = printer(stream);
  auto out4 = my_printer();

  format_to(out1, ...)
  out2 << "Hi..."
  out3.print(5);
  out3 += 6;
These all do the same but it's a total mess.
Re:Pprint: Pretty Printer for Modern C++ by 0db532a0 on Wednesday May 01, 2019 @04:22AM (#19795396)
Anyone who writes like that needs to have a chat with Uncle Bob.
Re:Pprint: Pretty Printer for Modern C++ by arcticbull on Wednesday May 01, 2019 @04:46AM (#19795492)
Haha, that's fair :) I'm trying to convey that sometimes as an end developer, you pick a number of third party libraries based on what they do -- not what their API definition looks like. Then you end up in an awkward mix-n-match of DSLs that are hard to reason about without a deep knowledge of each because the operators you normally key off of are redefined. Maybe thats why I'm not a C++ developer haha.