• 1 Post
  • 13 Comments
Joined 2 years ago
cake
Cake day: June 15th, 2023

help-circle
  • I actually don’t have a preference. I usually just use the default locate implementation my distribution provides. I used mlocate before and when the distros switched to plocate, I rolled along with that without making efforts installing mlocate from a different source. Its the easiest and safest way to me. Usage and performance between mlocate and plocate seems to be identical in my experience (no benchmark, just how it “felt”). plocate is actually mlocate with a few patches for edge cases, if I understand it right.

    I have it currently uninstalled due to an issue:

    However, recently I had some issues with the locate and KDEs baloo (baloo can do content indexing too but I set it to only filename indexing, so its similar to locate). Those tools may have killed my previous system SSD and on my new one I noticed they used up Gigabytes of RAM and seem to be stuck. After investigating both tools seem to have choked on few filenames that contain unusual characters. Therefore I have disabled them for now until figured out how to deal with this (probably renaming) and try later again.




  • Is the linked .org site correct? I got this one https://vlang.io/

    I never programmed in V, but it surely looks interesting. One interesting part is to have multiple paradigms and ways to manage the memory:

    There are 4 ways to manage memory in V.

    The default is a minimal and a well performing tracing GC.

    The second way is autofree, it can be enabled with -autofree. It takes care of most objects (~90-100%): the compiler inserts necessary free calls automatically during compilation. Remaining small percentage of objects is freed via GC. The developer doesn’t need to change anything in their code. “It just works”, like in Python, Go, or Java, except there’s no heavy GC tracing everything or expensive RC for each object. Autofree is still experimental and not production ready yet. That’s planned for V 1.0.

    For developers willing to have more low level control, memory can be managed manually with -gc none.

    Arena allocation is available via v -prealloc.





  • Sorry for late reply. I actually like the idea to use words to indicate start and end as well. But with additional “math like” features it gets a little bit complicated to parse for simple slicing as an option in a program. It makes much more sense to do this flexible thing in a language. BTW its shouldn’t be needed to have an end if you already have a negative number.

    I use the empty string as indicator for start or end "..2" (BTW I switched to .. separator after long thinking, reading arguments and debating with myself).

    Just as an idea, you could provide another variable mid so one could start counting from there (mid+2:end). And man the idea sounds really elegant to use [ or ( to indicate if the number is inclusive or exclusive. But I fear it could be a little bit confusing and people could forget which one is which. I would rather prefer special characters that are not used otherwise. In example both sides are always inclusive and there is a special character before or after the number to indicate its exclusion. A character that is not used otherwise in numbers or slices and is representing the exclusion unmistakably, and I have absolute no idea what this could be.

    I have to say the usage of brackets to indicate its inclusion or exclusion is creative thinking!


  • A dash is a bit problematic from practical point of view. In example I allow single numbers without a colon like just 6 which would be interpreted as 6:6. And each element is optional as well, which would make -6 either be a negative number, an commandline option or a range? Some languages also use dots .. instead. If I want ever support negative numbers, then the hypen, dash or minus character would be in the way.

    I mean I could just do a duck typing like stuff, where I accept “any” non digit character (maybe except the minus and plus characters) with regex. Hell even a space could be used… But I think in general a standardized character is the better option for something like this. Because from practical point of view, there is no real benefit for the end user using a different character in my opinion. Initially I even thought about what format to use and a colon is pretty much set in stone for me (Edit: this part didn’t age well) I recently switched to .. after long thinking.


  • I think that I’m going with these approaches. For the ‘0’, I’m now accepting it as the 0 element. Which is not 0 based index, but it really means before the first element. So any slice with an END of 0 is always nothing. Anything that starts at 0 will basically give you as many elements as END points to.

    • 0: is equivalent to : and 1: (meaning everything)
    • 0 is equivalent to 0:0 and :0 (meaning empty)
    • 1:0 still empty, because it starts after it ended, which reads like “start by 1, give me 0 elements”
    • 1:1 gives one element, the first, which reads like “start by 1, give me 1 element”

    I feel confident about this solution. And thanks for everyone here, this was really what I needed. After trying it out in the test data I have, I personally like this model. This isn’t anything surprising, right?


  • First, thanks for the answer. As for the user base, its actually gaming oriented and they typically do not interact with 0 base. So I guess that makes for an obvious choice. And at the moment its also “inclusive”. To get one element user needs to 2:2. If user gives only one element, such as 2, then I could convert it into 2:2, to get one element. Sounds logical, right? Sorry for having so many follow up questions, my head is currently spinning.

    Do you think this interferes somehow with the logic of a “missing” slice element, which would default to “the rest of the list”. In example 2: would then get the second element and until rest. This is the default behavior in Rust.

    If I have a 1 based index, how would you interpret the 0? Currently program panics at Argument interpretation phase.




  • With how many new Linux users we get recently, I don’t like this joke at all without a disclaimer. Yes yes, its your own fault if you execute commands without knowing what it does. But that should not punish someone by deleting every important personal file on the system.

    In case any reader don’t know, rm is a command to delete files and with the option rm -r everything recursively will be searched and deleted on the filesystem. Option -f (here bundled together as -rf) will never prompt for any non existing file. The / here means start from the root directory of you system, which in combination with the recursive option will search down everything, home folder included, and find every file. Normally this is protected todo, but the extra option --no-preserve-root makes sure this command is run with the root / path.

    Haha I know its funny. Until someone loses data. Jokes like these are harmful in my opinion.