• 6 Posts
  • 592 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!


  • Isn’t one of the reasons it’s argued that it could be a cosmic ray that in millions of automated run-throughs, they haven’t been able to reproduce it? That is: Something extremely unlikely, and quite possibly non-deterministic (i.e not a software bug) clearly happened.

    Also, I believe they pinpointed that there was exactly one bit-flip. I’m not disagreeing that a bit flip caused by a cosmic ray is astronomically unlikely, but it’s not unprecedented either. It does happen, though rarely, and I have yet to see a more convincing explanation for what we saw in that speed run.








  • You spin the mouse wheel to control the scroll bar, so of course spinning the wheel towards you (down, if you align the mouse with the screen), should make the scroll bar go down.

    This was, for a long time, uncontroversial. However, after touch screens became widely used, people started incorrectly assuming that the mouse wheel “moves the screen” (absolutely ludicrous), and decided that down was up and up was down, and that the sane way to scroll with a mouse wheel or touch pad was “inverted” and not “sane”/“normal”.


  • Honestly, after re-reading my own comment, I’m considering just putting some stupid-simple wrapper around mv that moves files to a dedicated trash bin. I’ll just delete the trash bin every now and then…

    -Proceeds to collect 300 GB of build files and scrapped virtual environments over the coming month-


  • I usually don’t think about it at all, but every now and then I’m struck by how terrifyingly destructive rm -r can be.

    I’ll use it to delete some build files or whatever, then I’ll suddenly have a streak of paranoia and need to triple check that I’m actually deleting the right thing. It would be nice to have a “safe” option that made recovery trivial, then I could just toggle “safe” to be on by default.





  • Sorry for taking some time, monday morning suddenly hit me in the face… I’ve put up some files here that you should be able to download. The files can be opened with any plain-text editor (notepad, textedit, or similar).

    My recommendation is to create an account on overleaf, click “create new project”, and upload the files there. Then you can hit “recompile” to see how the document looks. My guess is that you’ll figure out how stuff works pretty quickly just by modifying that file. If what you want to write is a simple document, you can really just get going :)

    Feel free to let me know if you have any issues :)


  • Ahh, now I understand! I’ll try my best to make it less scary :)

    To start off

    why is there a need for external packages for a text document?

    There usually isn’t, as long as you only want a simple document. The most basic thinkable document would be

    \documentclass{article}
    \begin{document}
    This is the text in my document
    \end{document}
    

    However, you’ll likely want a title and author, so you can start off with

    \documentclass{article}
    \title{Fishes are nice}
    \author{Definitely not Jason Mamoa}
    \begin{document}
    
    \maketitle
    
    \section{Introduction}
    This is a text about why fishes are nice.
    
    \end{document}
    

    You have your “Super basic document”, with at title and author. You can make simple formatting changes by modifying the documentclass statement at the top. My recommendation with all the external packages (usepackage) is to look them up one-by-one as you need them. You’ll typically find a small handfull of packages that you need very often, and then you’ll probably end up copy-pasting those declarations over whenever you create a new document. For most basic documents I’m using like 2-5 packages at most (fancy math fonts, hyperlinks, pretty bibliography, etc.)

    Tables are straight up scary

    They take a little getting used to, I agree. For someone working a lot with tables, I would recommend getting used to them, but if you only very rarely need them, there are “graphical editors” that let you build a table in a GUI and then give you the Latex code for it. Overleaf has an integrated “visual editing” mode that makes the barrier to entry lower. However I don’t really recommend it for someone that really wants to learn to use Latex, because I think it prevents people from progressing past the very basics.

    plotting - I didn’t even try to comprehend it

    I’ve used Latex for years, specifically writing documents with a lot of plots. I have yet to attempt to learn to plot directly in Latex. I know some people that will create figures and plots directly in Latex, and I respect them. I use inkscape for figures, and python for plotting, and can get stuff looking pretty awesome that way. Learning to draw/plot directly in Latex is by no means a must.

    Please, make it any sort of user-friendly!

    As with other powerful tools, I think people are often overwhelmed coming in because of the massive number of possibilities, and the fine-grained control that is possible. My recommendation is to start out with something like the above, and progressively add complexity as you need it. Most people don’t require more than basic section (and sub- subsub- etc.) headers, tables, figures, and equations. In that case, you’ll need like 3-5 external packages and 3-5 “commands” (stuff like \begin{equation}). If you start out with the above example, you’ll probably learn the basics on your own in a couple hours :)

    I’ve held some latex-courses for beginners, so if you want, I could send you the “basic starting file” that the people taking the course have completed writing (with help) after about two hours :) I’ve been told that most of them feel pretty comfortable learning on their own once they have that.


  • Ohhh, I can sign off on this.

    The amount of 20 year old university students that do not understand how to save a file to a specific location on their computer and then retrieve that file later has skyrocketed the last five years.

    This is very obviously a consequence of them only ever having worked through tablet- or phone-type interfaces, where the file system is completely hidden to the user. I teach these people to program, and their eyes gloss over when I ask them where they put the data file they need to parse for the assignment. Once they understand the question they’ll typically open the file explorer, click on “recent files”, and ask me why their python script won’t open it, when the files are right there next to each other in “recent files”.