HackerTrans
TopNewTrendsCommentsPastAskShowJobs

ssokolow

no profile record

comments

ssokolow
·4 maanden geleden·discuss
*nod* As-is, we're stuck with hacks like custom shortcodes and emoji.

...though, given the inconsistent naming of consistently laid-out buttons, I think anything that makes its way into Unicode should include something that follows the lead of what Batocera Linux does on their Wiki and with custom emojis in their Discord.

See https://wiki.batocera.org/configure_a_controller for an example of how they look inline but the gist is that it's an outline of the SNES-originated diamond of action buttons that pretty much everyone but Nintendo uses these days and which is embodied in XInput and the SDL Gamepad API, with one of the circles filled in to represent the button in question.
ssokolow
·4 maanden geleden·discuss
By "game tutorials", I think they mean modern successors to the role GameFAQs used to play.

There is a combining character that, by its description, sounds like it should be implemented to do the desired thing (U+20DD Combining Enclosing Circle), but my fonts don't render it very well when I stuff geometric characters matching the PlayStation buttons into it.

Without spaces: △⃝□⃝×⃝○⃝

With two spaces between each one so you can see how "enclosing" is getting interpreted: △⃝ □⃝ ×⃝ ○⃝

For the Markdown renderer I'm working on to replace WordPress for my blog, I resorted to shortcodes which resolve to CSS styling the `<kbd>` tag with `title` attributes to clarify and the occasional bit of inline SVG for things where I didn't want to specify a fixed font to get sufficient consistency, like PlayStation button glyphs.

https://imgur.com/a/1EPm7QV

(In all fairness, it's a nerd-snipe made based on the idea that I'll be more willing to blog about things I have nice tools for. I don't currently typeset button presses in any form.)
ssokolow
·3 jaar geleden·discuss
The argument that generics should have used [] generally goes hand in hand with the argument that [] for panicking indexing is a wart on Rust's "pit of success" design philosophy and that panicking indexing should have been more verbose to type than the .get() for Result-returning indexing... but probably less verbose to type than the `unsafe`, potentially UB-inducing `.get_unchecked()`.
ssokolow
·3 jaar geleden·discuss
> Any programmer worth their salt knows this.

Rust is one big "C and C++ have proven that 'hire better programmers' isn't a viable solution". You might as well use the same logic to argue against C and C++ restricting and complicating assembly language with a type system and the removal of unconstrained GOTO.

> And, so, Rust builds on that by renaming that to i32, to further entrench the poor practices.

The rationale is that a program's logic should function the same on different targets, or fail with a compile-time error if that's not feasible.

THAT is why the default is to use fixed-size variables except for the `size_t` equivalent which is intended to fit any valid memory offset, and to encourage use of correct types for various applications by making it more bothersome to convert types. (eg. Does a file format use a 16-bit integer for an image dimension? Expose that in the parser's API.)

> Of course, you will not win any popularity contest by appealing to people who know what they are doing, who are the minority.

I dunno. I know what I'm doing, but I choose Rust over every other language because it's refreshing and de-stressing to teach the compiler to watch my back as much as possible.

Everyone has bad days, and distracted days, and tired days, and, unless everything you write is closed-source hobby code, you have to deal with code other people have touched.
ssokolow
·3 jaar geleden·discuss
That was proposed and rejected for Rust recently:

https://github.com/rust-lang/rfcs/pull/3267

I was against because I felt that there should always be parens/brackets/braces (macros can use any of them) for better scannability when you're invoking an unclear amount of extra stuff behind the scenes.

(An appeal to the "make costs explicit" side of Rust's philosophy that also requires explicit .clone() rather than copy constructors.)

Here's the summary of why the consensus was "no":

https://github.com/rust-lang/rfcs/pull/3267#issuecomment-128...
ssokolow
·3 jaar geleden·discuss
To be honest, I've always been unnerved by "Why is that block ending without a } or END? Is the indentation significant? Is the number of arguments for each construct back-fed into the lexer?" languages like Ante, Ocaml, and Haskell.
ssokolow
·3 jaar geleden·discuss
Which is why Rust has `usize` for indexes and memory offsets. Beyond that, a good programming language can't fix a bad programmer.

Were you aware that, because people use `int` so liberally, the LLP64 model 64-bit Windows uses and the LP64 model Linux, macOS, and the BSDs use keep `int` 32-bit on 64-bit platforms? Hello, risk of integer overflow.

LLP64 even keeps `long` at 32-bit.

https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_m...

It turned out that the C approach was so bad for portability in practice that it de-facto standardized `int` as 32 bits wide.
ssokolow
·3 jaar geleden·discuss
I think they're saying that it's counter-intuitive that the specialization relationship between Fn, FnMut, and FnOnce is the reverse of foo, &mut foo, and &foo.

I know it took me a long time for that to stick.
ssokolow
·3 jaar geleden·discuss
> * standard library doesn't have HTTP, requires third-party libraries that are still immature / suck.

> * widespread & prevalent abuse of .unwrap()

[citation needed]

> * rust's async requires third-party libraries like tokio

As opposed to baking Tokio in and having people lament that they can't replace the executor for stuff like embedded use-cases?

I remember hearing that there's interest in using async/await inside the Linux kernel with a custom executor.
ssokolow
·3 jaar geleden·discuss
If it really matters, you could always use the #[momo] procedural macro by Andre "llogiq" Bogus, one of the big names in the Rust community:

https://lib.rs/crates/momo
ssokolow
·3 jaar geleden·discuss
"return" wasn't "abbreviated to an empty string", it's that Rust is expression-oriented, the value of a block is the value of its last expression, adding ; turns expressions into statements, and a function with no terminal expression returns (), which serves the same role as void.

    fn foo(x: u8) -> u8 {
        let y = {
            let z = something();
            x + z
        };
    
        y
    }
TL;DR: It's not a property of the function, it's a property of the curly braces.
ssokolow
·3 jaar geleden·discuss
It's directly responsible for Rust needing the "turbofish" syntax to pin down generic return types as in

let foo.iter().map(|x| x*2).collect::<Vec<_>>()

If they'd used something like [T] for generics, then there'd be no collision with the < and > operators needing disambiguation in some contexts.

They even have a Book of Mozilla-esque entry in their test suite named "Bastion of the Turbofish" to pin down an example of the problem case, complete with

https://github.com/rust-lang/rust/blob/43192ca3d72ed0ca42ba9...
ssokolow
·3 jaar geleden·discuss
It means "DANGER: This may hide an early return or other things which violate the expectations for how control flow works."
ssokolow
·3 jaar geleden·discuss
Because Rust is, in effect, a GC-less Ocaml derivative with a coat of cherry-picked C++ syntax as paint.

That's why the semantics are so different. It's more of the lineage that began with ML in 1973 than of the ALGOL 68 lineage like C is.

The Rust compiler was even originally written in Ocaml before it became self-hosting.

That's also where syntax elements like these come from:

- let for variable declaration and postfix type annotations separated with colons

- 'a (Ocaml's equivalent to <T> for generics, because, on an abstract/theoretical level, Rust's lifetimes are a special type of generic parameter, right down to "a" apparently being the habitual default type variable name, just like "T" is in C++)

- Option (option in Ocaml), Some, and None

- match

- fn (fun or function in Ocaml)

- -> and => (just -> in Ocaml) for function returns and match arms

- ()
ssokolow
·3 jaar geleden·discuss
I'm migrating everything that's feasible (eg. not stuff where I need Django's ecosystem) from Python to Rust for its combination of a powerful type system that can encode my invariants better than MyPy annotations, sum types, no exceptions, no null, an ecosystem that values "fearless upgrades", PyO3 so my Rust code can be reused in projects that still need Python without me having to get memory-unsafe code right, and not being something as alien as Haskell.

Golang specifically has three things that turned me off as a replacement for Python in the early days before I got hooked on what Rust offers:

1. A disgust-inducing level of boilerplate use for things like error-handling and poor support for metaprogramming. 2. A design that not only lacks things like PyO3, but is implicitly hostile to FFI. 3. Git repository URLs as dependency references and "you figure it out" for ensuring they don't go away.