Better HN
topnewbestaskshowjobs
Log inSign up

coolreader18

460 karma · joined Jan 22, 2019 (7y ago) · 144 submissions

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 ]

Submissions

comment 6y ago · link · parent

I'm hyped for this; RustPython uses gitter as its main communication platform for developers and contributors, and while it's certainly worked quite well for us so far, I was slightly worried the slow pace of development and the deprecation of mobile apps. It seemed (to me, at least, and I don't follow the gitter changelogs or anything - edit: just looked at them now, so yeah, what follows is pretty unfounded. Anyway,) like gitter was sorta becoming a ghost ship, still running along smoothly but not much was happening at the helm -- this also might be because I mainly use the Android app, which is deprecated, so I see very few updates to gitter if any. Anyway, yeah, I think this is a great direction to go for gitter, if only so I'll have an updated mobile app :)

comment 6y ago · link · parent

You've got the mobile version twice there, I think you probably wanted to remove the "m." from one of them.

comment 6y ago · link · parent

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

comment 6y ago · link · parent

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)

comment 6y ago · link · parent

> 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.

comment 6y ago · link · parent

Some would probably find that superior to firebug

comment 6y ago · link · parent

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"

comment 6y ago · link · parent

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/

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

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...

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

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

comment 6y ago · link · parent

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

comment 6y ago · link · parent

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).

comment 6y ago · link · parent

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...

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

Well, yeah, that's their bargaining chip. If Microsoft wants to keep their workers, they should listen to their demands.

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

I don't think encouraging a security department to keep working with a corporation would necessarily help stop the military/industrial complex.

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

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!

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

> 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.

comment 6y ago · link · parent

Do you mean emoji? I don't see what the issue would be with [{}:();P\[\],.<>/~-_+=XD]

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

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?"

comment 6y ago · link · parent

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.

comment 6y ago · link · parent

There doesn't have to be something wrong with a solution to deprecate it, there just has to be a better alternative.

comment 6y ago · link · parent

I just undef'ed and re-define-d int before and after the main declaration with clang, and it seems to work fine.

comment 6y ago · link · parent

ls is a shortening of "list", i.e. list directory contents, and grep is apparently Global Regular Expression Print.
12345