• 6 Posts
  • 288 Comments
Joined 2 years ago
cake
Cake day: June 18th, 2023

help-circle

  • Similarly, what would you gain by saying uint32_t const* x = my_var.get<uint32_t>();

    To be frank: You gain the information that MyConcreteType::get<uint32_t> returns a uint32_t, which I otherwise couldn’t infer from the docs. Of course, I could assume it, based on the template parameter, but I don’t want to go around assuming a bunch of stuff in order to read docs.

    Take an example like auto x = my_var.to_reduced_form(), it’s very clear that x is the “reduced form” of my_var, which could be meaningful in itself, but what type is it? I need to know that if I want to do anything with x. Can I do x += 1? If I do, will that modify my_var? Let’s say I want to make a vector of whatever to_reduced_form returns… and so on.

    All these questions are very easily answered by MyConcreteType x = my_var.to_reduced_form(). Now I immediately know that everything I can do with my_var, I can also do with x. This makes me happy, because I need to do less digging, and the code becomes clearer to read.


  • Thanks, that was a good read :)

    However, my impression is that he’s largely using the existence of templates and polymorphism as arguments that “we don’t really care about type”. I disagree: A template is essentially a generic type description that says something about what types are acceptable. When working with something polymorphic, I’ll prefer ParentClass&, to indicate what kind of interface I’m working with.

    Sure, it can be very useful to hide exact type information in order to generalise the code, but I think that’s a weak argument for hiding all type information by default, which is what auto does.


  • I really like C++ (I know, shoot me), and I think auto should be avoided at (almost) all costs.

    One of the things I love about a language like C++ is that I can take one glance at the code and immediately know what types I’m working with. auto takes that away while adding almost no benefit outside of a little convenience while writing.

    If I’m working with some very big template type that I don’t want to write out, 99/100 times I’ll just have a using somewhere to make it more concise. Hell, I’ll have using vectord = std::vector<double> if I’m using a lot of them, because I think it makes the code more readable. Just don’t throw auto at me.

    Of course, the worst thing ever (which I’ve seen far too often) is the use of auto in examples in documentation. Fucking hell! I’m reading the docs because I don’t know the library well! When you first bother to write examples, at least let me know the return type without needing to dig through your source code!





  • Exactly this. The whole premise of the tax system is based around the historically correct idea that you need to physically move goods in order to sell them, or physically be somewhere to sell services.

    Companies like google are making buckets of money all over the world, and don’t need to tax a dime most places, because they have no physical presence there. This makes it pretty much impossible to compete with the international behemoths, because they have access to a munch of tax-free revenue, while a startup will typically be centred around wherever they’re based, where they also need to pay taxes.



  • That completely depends on what you’re doing. If you’re doing tasks that python can completely offload to some highly optimised library written in C/C++/Fortran, then yes. However at that point you’re not really comparing Python to C anymore, but rather your C implementation to whatever library you used.

    A fair comparison is to compare pure python to pure C, in which case you need to mess up the C-code pretty bad if Python is to stand a chance.









  • Great, it seems like we agree on the major points here! I’m not denying any of the major issues of the Afghan war, nor any of the glaring problems with how the whole “nation building” attempt went about. I’m very well aware of the history of the Afghan war, and have seen several of the documentaries you refer to that point out that it was largely known that the Afghan army would likely desert once the coalition left.

    I’m not saying we don’t care.

    That is quite literally what you said in your first comment, and is literally the only thing I’ve disagreed with you on so far (“the world simply doesn’t care”). If you didn’t mean that, then I don’t see anything I disagree with you on.

    Many individual people did earnestly care, and tried their best.

    This is literally the point I’ve been trying to make, but it seems like you keep misinterpreting me as saying the whole invasion was a misunderstood humanitarian operation. I’m not saying that.