HNHacker News
TopNewBestAskShowJobs

coolreader18

460 karma · joined January 22, 2019

I'm into Rust and programming languages/compilers.

I'm a core developer of RustPython (https://github.com/RustPython/RustPython).

https://github.com/coolreader18

email: coolreader18 AT gmail DOT com

[ my public key: https://keybase.io/coolreader18; my proof: https://keybase.io/coolreader18/sigs/Su2GDvjtDUUEwvoh46jH6urxEk39D7-LCSgTRN5v56s ]

submissionscomments
coolreader18··on Small Tech
Had no idea that SQLite is actually created/"owned" by a company, I figured it was just a group of people or small foundation that was sponsored by a lot of companies. I find it kinda funny that in the same page where they list SQLite as one of their products[0] they also have a Java applet from 1996 where you move blocks around to get one of them in the right spot[1]. It's pretty fun though, works great with the CheerpJ Applet Runner extension for chromium.

[0] http://www.hwaci.com/sw/index.html

[1] http://www.hwaci.com/sw/puzzle/ex7.html

coolreader18··on My least favorite Rust type
I guess the same reason that `impl AsRef<T> for T` isn't implemented. (Not sure exactly what that is, but that would probably be a better question to look into, since you could argue that `AsRef<T>` should be manually implemented for any std type T with your argument)
coolreader18··on My least favorite Rust type
> I get a strong sense of Rust demanding that users subjugate themselves to all the choices and opinions of the architects [..]

I don't really get where you're coming from here, especially with regards to this issue -- it seems like almost everyone, including Rust core team members, agree that `impl Iterator for Range` was an API design mistake, that came out of (IIRC) Iterator existing prior to IntoIterator in the pre-1.0 days. This seems to me to just be an unfixable design flaw due to backwards-compatibility rules, not something that really speaks to the design of the language as a whole.

coolreader18··on Firebug
Some would probably find that superior to firebug
coolreader18··on Show HN: Base32H, a human-friendly duotrigesimal number system
Huh, interesting. For stuff like this (human-friendly numbers/ids/codes) I tend to use google's base20 Open Location Code alphabet[0] that I read an explanation of a long time ago on their website[1] :P. Whereas this project aliases some similar letters together, the OLC alphabet avoids similar looking letters altogether and tries to avoid spelling any words at all. Keep in mind that "oh, letters are aliases for each other" doesn't necessarily help now that "passwords are case sensitive" is also drilled into users' heads, and no distinction between I/l is even more rare than case sensitivity, so users might unnecessarily remember the difference or make a fuss about it (speaking from experience working with my grandmother and technology).

Anyway, usually I just copy/paste a piece of code like below to use the OLC alphabet and randomly generate an id, and you could just copy the literal to use as a radix alphabet as well.

    "".join(random.choices("23456789CFGHJMPQRVWX", k=5))
    # check against id in dict
    if userinput.toupper() in idmapping: ...
[0]: https://github.com/google/open-location-code/blob/master/js/...

[1]: https://github.com/google/open-location-code/blob/master/doc..., under "Easy to use"

coolreader18··on Elevated rates of autism in transgender and gender-diverse individuals
Post-transition transgender people have lower suicide rates and better mental health overall than those that are pre-transition[0].

[0]: https://pubmed.ncbi.nlm.nih.gov/24344788/

coolreader18··on Import – A Simple and Fast Module System for Bash and Other Unix Shells
To be fair, it is an immutable shortened url, but it could still point to a random site that then redirects to a git url (when it's being benevolent). Definitely better to point directly to a git commit hash, though still a bit sketchy regardless.
coolreader18··on Bringing the print statement back
Nim does this, and the whitespace is significant[0][1]:

    echo $foo
    # is parsed as
    echo($foo)
[..]

    echo(1, 2) # pass 1 and 2 to echo
    echo (1, 2) # pass the tuple (1, 2) to echo
[..]

    proc optarg(x: int, y: int = 0): int = x + y
    proc singlearg(x: int): int = 20*x
    
    echo optarg 1, " ", singlearg 2 # prints "1 40"
    
    let fail = optarg 1, optarg 8 # Wrong. Too many arguments for a command call
    let x = optarg(1, optarg 8) # traditional procedure call with 2 arguments
    let y = 1.optarg optarg 8 # same thing as above, w/o the parenthesis
    assert x == y

[0]: https://nim-lang.org/docs/manual.html#syntax-precedence

[1]: https://nim-lang.org/docs/manual.html#procedures-command-inv...

coolreader18··on Booting a 486 from floppy with the most up-to-date stable Linux kernel
You can also always just find an old desktop box and install a lightweight distro on it -- my grandpa got a new computer a year or so ago so I took his ~10 year old HP box, wiped it, and installed alpine. Now I have it just plugged into my router and I have a few cron jobs and docker services that I run on it.
coolreader18··on A Deep Introduction to JIT Compilers: JITs are not very Just-in-time
I suppose I can answer this, as a high school kid: because it's interesting! I'm really interested in compilers and interpreters as well, I suppose because I think it's cool how they're so integral to all kinds of programming, and how it takes so much work to build one that can then almost magically understand what you tell it to do. I work on RustPython[0], and even though I've seen and edited the bytecode interpreter loop and the parser and the ast->bytecode compiler and all of the builtin functions and types, it's still hard to fathom that all of that is running under the hood when I type something at the REPL and it just runs.

[0]: https://github.com/RustPython/RustPython

coolreader18··on Abstract Wikipedia
Perhaps, but this seems to be moving towards a more holistic machine-readable article graph. If you look at a page from wikidata[0], it seems to be basically a key-value database (e.g. earth.highest point = [ mount everest { from sea level, 8000m } ], while the "full article" terminology used in the announcement seems like it may be even more connected/informative/structured than that.

[0]: https://www.wikidata.org/wiki/Q2

coolreader18··on I Just Hit $100k/year On GitHub Sponsors
While the term open-source is a bit more vague, I'd argue that the software he's developing fits squarely into the term "free" (as in speech), as the FSF defines it. The source code is available to modify and fork, even if you must pay to access it -- which is allowed while still considering it "Free". I've always wondered how the FSF thought that would work exactly, since it seems weird to have something be forkable to only a select group of people, but this makes a lot of sense; it will be open sourced to everyone after enough people pay for it.

I'd also argue that this is one of the most ethical ways to pay developers fairly for their work, even if the author wasn't able to make that much money from it. The product the developer creates is FOSS, available to everyone after some time, and they still get paid for it (bonus; they're paid by the open source community for their work, rather than from one person/corporation that dictates their salary).

coolreader18··on The Next Step for Generics
Let's take Rust's hash map entry api[0], for example. How would you represent the return type of `.entry()` using only a class hierarchy?

    let v = match map.entry(key) {
        Entry::Occupied(o) => {
            o.get_mut() += 1;
            o.into_mut()
        }
        Entry::Vacant(v) => {
            update_vacant_count(v.key());
            v.insert(0)
        }
    };
I view sum types as enabling the exact same exactness as you describe in your last line; especially since you can easily switch/match based on a specific subtype if you realize you need that, without adding another method to the base class and copying into the x subclasses that you have for implementing the different behavior.

[0]: https://doc.rust-lang.org/std/collections/hash_map/enum.Entr...

coolreader18··on The Next Step for Generics
I believe you can just use `.flatten()` instead of `.flat_map(|v| v)`:

    let mut output: Vec<_> =  
        foo.stuff.into_iter()
            .flatten()
            .chain(bar.stuff)
            .collect();
I might make it slightly more clear what the intent is by doing this:

    let mut output: Vec<_> =
        Iterator::chain(foo.stuff.into_iter().flatten(), bar.stuff)
            .collect();
But still basically the same.
coolreader18··on After GitHub CEO backs Black Lives Matter, workers demand an end to ICE contract
Well, yeah, that's their bargaining chip. If Microsoft wants to keep their workers, they should listen to their demands.
coolreader18··on After GitHub CEO backs Black Lives Matter, workers demand an end to ICE contract
ICE only was founded after 9/11, and given that in their short history they've caused so much suffering, it's not unreasonable to demand that the agency be shut down.
coolreader18··on After GitHub CEO backs Black Lives Matter, workers demand an end to ICE contract
I don't think encouraging a security department to keep working with a corporation would necessarily help stop the military/industrial complex.
coolreader18··on After GitHub CEO backs Black Lives Matter, workers demand an end to ICE contract
It's really not that different of an issue (black lives matter but Latino lives don't?); I think the word you're looking for is not partisanship but intersectionality.
coolreader18··on Largest Known Maya Structure Found
I unironically thought this was about Maya the 3d modelling software when I first read the headline, like that the maximum size limit for a Maya model had been found out or something like that. ️

Very interesting article though!

coolreader18··on GitHub Classroom
I really do agree that this is peak hackernews, but I'm a kid (or legal minor, at least) and I wrote both my AP exam essays in Markdown in vim; it's not really that crazy for kids to learn a plain-text prose format.
coolreader18··on Random person name generator
> Probably they're sticking with just Anglo-Saxon names

I don't think so, I got "Johanna Nagata", and Nagata is apparently a Japanese surname.

coolreader18··on UTF-8 Everywhere
Do you mean emoji? I don't see what the issue would be with [{}:();P\[\],.<>/~-_+=XD]
coolreader18··on Musth
Maybe civilized elephants wouldn't really look like the elephants we know. Although people are fairly similar to apes, it would be hard to look at an ape and imagine them to evolve to humans as we are now, with bipedalism and hairlessness and all that. Maybe elephants would evolve to be smaller and more nimble, or even more dexterous than they are now, if they were to evolve to a civilized form.
coolreader18··on Was Knuth Really Framed?
I really like the idea of the Unix model as well, but you're not going to be able to use it effectively to write an actual application. If you're writing a word processor and you need to find the levenshtein distance between the most frequent word pairs (maybe some measure of how alliterative/consonant/assonant your document is?) then you're probably not going to be building the word processor using the Unix model, and even if you are (the closest you can get is probably using Tcl/Tk?) then it's still best to write out what you're doing as clear as possible. Note that it took me about 5 minutes to figure out what the shell pipeline presented in the article actually does, and multiple times my reasoning about it lead me to think "wait, does this actually do what it's supposed to do?"
coolreader18··on Dogelang – A Python with Haskell Syntax
What? this seems to work:

    func(
        lambda: otherfunc(
            1, 2, 3, 4
        )
    )
And you don't need statements, given that with haskell semantics there are no statements.
coolreader18··on Request Node lib used by 48k modules is now deprecated
There doesn't have to be something wrong with a solution to deprecate it, there just has to be a better alternative.
coolreader18··on C4: C in Four Functions (2014)
I just undef'ed and re-define-d int before and after the main declaration with clang, and it seems to work fine.
coolreader18··on C4: C in Four Functions (2014)
ls is a shortening of "list", i.e. list directory contents, and grep is apparently Global Regular Expression Print.
coolreader18··on GitHub CLI is now in beta
Hub[1], the previous Github CLI, was written in Go too, so I don't think this is much of a surprise.

[1]: https://github.com/github/hub

coolreader18··on Unexpected places you can and can’t use null bytes
Others have mentioned "arbitrary binary data", but a concrete example of that (that I know of, not that would be particularly useful to pass around) is the WASM bytecode format: it starts with '\0ASM', using the NUL byte to signify to tools reading it that it isn't text and they shouldn't attempt to display it (or anything like that). However, it is a _byte_code format, and as such, it would be represented with a `char*` pointer in C. Yet, any APIs that use NUL terminated [byte]strings would stop at the very first byte, and not keep any more data beyond than that.
← PreviousPage 3 of 5Next →