Walnut356

joined 1 year ago
[–] Walnut356 3 points 1 year ago* (last edited 1 year ago) (2 children)

Pyo3 doesnt generate type hints at all iirc. There's some more info here

The gist, as i recall, is that you're supposed to maintain a .pyi file in the rust project folder that gets automatically added in by maturin when building. I'm no regex wizard, but i was able to whip together a small script that generates simple function and class stubs that also have the rust docstring. Iirc they're planning on adding some official support for generating type hints, but i have no idea how far along it is or where it is on the priority list

[–] Walnut356 2 points 1 year ago

It's most useful when you're using some data you already have as the dictionary key. A usecase i had for this was a binary file parser with 10 types of event markers. It was originally coded with if/elif, but performance was a pretty big consideration. Using the event markers as keys to a dictionary dispatch improved performance by about 15% and made the code significantly more readable.

[–] Walnut356 1 points 1 year ago

I can vouch, i got one of their previous bundles that includes some of these items. Their tutorials are great, much better than random youtube videos if you're serious about getting started. I only went through one of the courses so far, but when i get back to game dev it's one of the first resources on my list

[–] Walnut356 2 points 1 year ago

I read the book. It's not too difficult to replicate their test's functionality with rust tests, but i still ended up using their software suite a few times to verify some behavior and get a better understanding of the step-by-step logic for the alu and cpu

[–] Walnut356 7 points 1 year ago (2 children)

Hopefully this month i can finally finish up nand2tetris. I did more or less all of it in rust to learn the language, and i feel like I'm now about as comfortable in it as i am in python. Learning how to build a computer from logic gates was sick, but debugging the compiler has been really draining. The way compilers work is neat, but all sorts of little problems keep coming up that force me to restructure large pieces of it over and over and i've lost almost all my momentum.

I'm not sure what I'll move on to next, maybe something more front-facing like a gui library, or maybe I'll finally look into anything that might actually provide me skills that will get me a job lol.

[–] Walnut356 3 points 1 year ago

People in different socioeconomic situations/locations experience new technology at different points in time. Just because the internet existed doesnt mean they (or anyone in their immediate vicinity) had internet, state of the art computers, etc.

[–] Walnut356 2 points 1 year ago (1 children)

it makes what looks like formatting an arbitrary complex operation and that it doesn't improve readability that much.

What's silly to me about that reasoning is that all workarounds are equally less convenient, have less readability, and the effect is identical to just letting me put whatever between the brackets. I genuinely dont understand the downside i guess.

Calling .join on a vector can have side effects too, except the "we're concatting strings" is at the end rather than the beginning (and could obfuscate the fact that the end result is a string). It has just as much room for abuse as a long format!(). Even with just format!(), anything you could do inbetween the brackets, you can do outside the brackets in the arguments anyway. At least when it's between the brackets, i know exactly where it's going and when without having to juggle the string pieces and assemble them in my head.

[–] Walnut356 4 points 1 year ago (4 children)

in this case it's about 80% function calls. They're convenience functions for assembly instructions, so they're of the form:

load(Reg::D, "A"),
load_const(5),

which is more useful than variables would be. I guess i could use .join or a crate like concat_string? Either way i sorely miss arbitrary expression format strings from python =(

view more: ‹ prev next ›