• 22 Posts
  • 872 Comments
Joined 5 years ago
cake
Cake day: May 31st, 2020

help-circle
  • Well, it certainly wouldn’t be the first time that I call some code unnecessarily hard to read and others call it pythonic.

    I understand that truthiness has an advantage when you don’t have static types, because it deals somewhat reasonably with most types, and then that is why many experienced Python programmers tend to use it. But I maintain the position that it therefore necessarily also makes it harder to read the code, because you necessarily provide the reader with fewer hints as to what is actually in that variable. It is very much like code using lots of generics in statically typed code.

    As for if Enum.empty?(var), I actually prefer that to checking the length. That syntax in particular, I find a bit too complex – my preferred version is if var.is_empty() – but I still think it makes it easier to read than a length check.
    Of course, there’s the nuance that it’s more syntax to remember for actually writing the code. And in particular in dynamically typed languages, your editor may not be able to auto-complete that, so I can understand just not bothering with the extra syntax and doing len == 0 instead. It’s fine.




  • Yeah, that is a very good question. It’s one of the last commands in the script and initially I thought they had set up the script so that it would abort, if any of the commands before it would fail.

    But then a colleague pointed out that it’s actually the opposite. So, you can tell the shell to abort execution on error by running set -e. But what they had written at the top was set +e, which explicitly turns that off (even though it should be off by default).
    The last command in the script is also exit 0, so it always indicates success.
    So, yeah, they seem to have knowingly made it so that if the script fails, then it doesn’t retry or anything. It tries to plough through as many of the commands as it can manage (ignoring any that fail on the way) and then it always deletes itself.

    I guess, it’s not as egregious of an assumption, because it only runs on a fresh OS. That’s a pretty controlled environment to be executing in, so the chance of something going wrong is rather low.
    Well, and the other question is what else would you do? If the script fails and you don’t delete it, it’s going to re-run on the next boot. What’s going to be different on the next boot to make it succeed then? Might as well do as much as you can and then quit…


  • Ephera@lemmy.mltoLinux@lemmy.mlHow I use Kate Editor
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    1 day ago

    renaming symbols, presenting documentation, formatting files,

    Yes, these are supported via the Language Server Protocol (LSP). I’ve mostly been using it with the Rust LSP server (rust-analyzer) and well, it typically works, but sometimes you have to tell it to restart the LSP server and stuff (which isn’t a huge ordeal, but don’t expect everything to always work as well as in a full-fledged IDE).
    I believe, for formatting, there’s also some non-LSP support.

    showing code diagnostics beyond syntax errors (for example code smells or so),

    This is supported in principle via LSP, too, but it depends on the specific LSP server, how much info it provides. The Rust compiler gives out relatively much on its own, which is passed on by the LSP server, but you can apparently also configure it to use the linter on save.

    have AI integration (explain this, rewrite this, replace this with prompt output, …),

    Not out of the box. There’s a way to define “External Tools”, which basically allows you to run commands and pass arguments to them and then use their output. For example, you should be able to define an External Tool, where you can select some text, then press your keyboard shortcut for that tool, so it sends the selected text to that tool and then it takes the command output and inserts it instead of the selected text.
    While this is a powerful concept, I don’t know, if you hit limitations at some point.

    specific framework integrations (reactjs, django, actix, …),

    Nope, except where this might be covered by LSP. But there’s no obvious way to just install additional plugins, for example. You get about thirty built-in plugins and that’s it.

    and stuff like expanding macros in C/C++ and Rust?

    Well, expanding macros is also possible with the Rust LSP server. Don’t know about other languages.



  • Yeah, I’m talking less deep than that. Plenty programming beginners will be reading Python code. And personally, I’m a fulltime software engineer, but just don’t do much Python, so while I had it in the back of my mind that Python does truthiness, I would have still thought that var must be a boolean, because it’s being negated. Obviously, a different variable name might’ve given me more of a clue, but it really doesn’t reduce mental complexity when I can’t be sure what’s actually in a variable.




  • I’m not sure, if that will show up everywhere where the Dolphin icon is used, but you can change it in the menu and, I believe, the panel, by editing the Dolphin entry in the “Menu Editor” application. There’s a button to select the icon there:

    In that dialog, if you select “All” in the dropdown and then search for “stock_folder”, that icon looks pretty close to the old Dolphin icon. Of course, if you’ve got the old Dolphin icon on disk somewhere, you can also select it with the “Browse…” button.






  • Yeah, I’m building more-or-less an alternative to make. Major difference is that I’m not using shell commands, but rather users will define their build code in Rust …because it’s intended to be a build tool for Rust applications (beyond what cargo does).

    Thanks for the comment, though. So far, I haven’t limited inputs to just be files, so I don’t actually assume to have a last-modified timestamp. Rather, my assumption is that I can get some value which changes when the input changes. In the case of a file, that’s the last-modified timestamp, but theoretically, it could also be a hash. But that means I have to store these values to be able to detect a change. Being able to just say that one thing is newer than the other without storing anything, that is pretty cool and might be worth changing my assumption for.




  • openSUSE is now one big btrfs partition. They dropped the separate xfs for the home partition maybe two years ago or so. It makes it less likely to run into a situation where the snapshots fill up the root partition (which is really ugly to recover from, because users will try to uninstall packages, which doesn’t help, since the files are still contained in a previous snapshot)…


  • To be more precise, you don’t really want to use the snapshotting in the home-directory. You can still use btrfs itself and for example, openSUSE sets it up so the home-directory is in a btrfs subvolume that’s excluded from snapshots.
    At the very least, you’d want the snapshots in the home-directory to be independent from the rest of the OS, so that you don’t end up rolling back what you’ve worked on when you want to roll back a faulty OS update.

    Well, and you also just want proper backups of your home-directory, so the snapshots are not as useful…



  • Hmm, thinking about it now, I actually don’t have much beyond the Breeze (Light/Dark) themes preinstalled either. I have the openSUSE themes, because I am on openSUSE.
    Aside from that:

    • In Window Decorations, there’s the Plastik theme.
    • In Application Style, there’s “Fusion” and “MS Windows 9x”.
    • In System Sounds, I’ve got “Ocean” and “FreeDesktop”.
    • And in “Login Screen (SDDM)”, I have “Elarun” and “Maldives”.

    I believe, the Oxygen themes got removed from the default themes, possibly with Plasma 6.
    But yeah, maybe you also just had additional theme packages installed. The Arch Wiki lists some of those, too.