• 1 Post
  • 397 Comments
Joined 1 year ago
cake
Cake day: September 24th, 2023

help-circle


  • Well, if you want to have Pip-installed tools available generally (e.g. until distros started screwing it up, pip was the best way to install CMake), the suggestion was to have a venv for the user that would be activated in your .bashrc or whatever.

    I think that would work, but then what happens if you want to use a project-level venv, which is really what they’re designed for? If you create and activate a venv when you already have one activated does it all work sensibly? My guess would be that it doesn’t.




  • They definitely didn’t. Yes it is technically better to use their own new fancy system, but they’re a business. Backwards compatibility is killer, even if you don’t want it from a technical point of view.

    I guarantee they looked at the numbers, interviewed users and asked them why they weren’t using Deno, and the number one reason would have been “we’d love to but we need to be able to use the X node package”.

    They probably have to improve Node compatibility, but the Node API surface is actually not that big. They’ll get there.


  • Yes, and then pass the context from the call sites of that function, and all the way up to main(). Oh look you’re refactored the entire app.

    That’s best cases too, you’d better hope your program isn’t actually a shared library running in a SystemVerilog simulator with state instantiated from separate modules via DPI, or whatever.

    30 years my ass

    lol when you have 30 years experience you will have actually tried to do this a few times and realised it isn’t usually as trivial as you hope it would be.










  • There are arguments to be made either way, but normally you’d scope your variables in a way that the ones specific to a particular bit of code are not accessible from elsewhere.

    Sounds like you agree with that one to me? I’m not sure I follow their arguments about regions there (I’ve never used regions), but the example of declaring a variable in a block way before it is every used is spot on. I’ve seen code written like that and 99% of the time it’s a bad idea. I think a lot of it comes from people who learnt C where you have to do that (or maybe Javascript which has weird rules for var).

    Suggest writing a custom class to do what most languages can solve with inheritance or even better: the ? syntax.

    Yeah I’ll give you that one. They even suggest using Optional as a solution, which is what their “smelly” code did in the first place!

    Yes, it can be annoying. No, clarity is more important than insisting on removing that extra underscore.

    Not sure what your point is here. Of course inconsistent naming is a code smell. Do you want inconsistent names?

    They’re advocating the use of a function to replace an expression. Sometimes this works, but the task of a boolean expression is not always easily expressed in a couple words. And so you can end up with misleading function names. Instead, just put a comment in the code.

    Erm, yeah that’s why this is a code smell. They aren’t saying never have complex boolean expressions - just that if you do you’d better have a good reason because probably you’d be better off splitting it up into named parts.

    callback hell - Not even a code smell. It’s an issue from back when languages like JavaScript didn’t support promises yet, but callbacks were popular.

    Indeed, so now it is a code smell.



  • Any specific ones? I’ve seen this before and I thought I would feel the same way as you before I read them, but actually the vast majority are pretty basic things that are not really arguable.

    It’s definitely nice to have a list like this to point inexperienced colleagues to in code reviews. It’s a bit more authoritative than “trust me bro, I’ve written a lot of code”.