8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions
comment 5y ago · link · parent
- protocols and abcs. Depend only on builtins, this sits at the top of the hierarchy and can be used anywhere
- top-level types/models, data structures. Only depends on external libraries
- config and logging. Depends on pydantic, which handles all init config validation, sets up log level. Many things import this
- specific class implementations, pure functions, transforms. imports from all the above
- dependency-injected stuff
- application logic
- routers and endpoints
I've had some close calls since I type check heavily, but protocols (since 3...6? 3.7 for sure) are a fantastic tool for both structuring and appeasing mypy.
comment 5y ago · link · parent
- everything is structured as a module
- options and args are stored in their own module for easy reuse
- the whole stack has one cleo.Application, with however many subcommands. Usually of the form "mytool domain verb" e.g. "mytool backend start."
- cleo args/options are parsed into pydantic objects for automatic validation (you could do this with argparse and dataclasses to skip the deps but it's more work)
- each subcommand has a `main(args: CliArgsModel)` which takes that parsed structure and does its thing. This makes it super easy to unit test
I install into a venv with `poetry install` or `pip install -e` for editable installs.
It all just works, no fuss, and so damn modular.
comment 5y ago · link · parent
Would it be emitting objects that gcc/ld would link against?
comment 5y ago · link · parent
But yeah bottom line, nowhere does Rustc "stop" you from doing things. Just strongly discourage :)
comment 5y ago · link · parent
Other folks are masochists and get their jollies from cryptic errors, segfault debugging, pouring through valgrind traces, and of course manually managing memory. If you aren't suffering, are you really programming?
I tease, but not entirely. Sometimes I do in fact enjoy the challenge of C programming. But it's squarely type 2 fun.
comment 5y ago · link · parent
This feels like putting the cart before the horse. "we shouldn't integrate Rust into the kernel in a modular sort of way cause it's not as optimal as more thorough type-aware integration."
Like, cross that bridge when you come to it, eh? The kernel is currently comprised of hundreds if not thousands of components, talking to each other via C API/ABIs. And talking to hardware is almost entirely ABI. That is how the kernel do.
Would we benefit from more type knowledge across boundaries? Absolutely, but this is hard (especially given how different the c and rust approaches to allocation are), and shouldn't stand in the way of progress.
comment 5y ago · link · parent
It's pretty much what people are trying to accomplish already; this just makes it explicit.
Would be neat to see how people react to hitting "max volume". You could model it in all sorts of ways. Do you silently accumulate, or do you keep hysteresis, such that you need a constant stream of positive engagement to keep it up?
comment 5y ago · link · parent
Not only is "there is no info provided by which button was clicked" a really odd take when we humans explicitly assign semantic to up/down vote, this contradicts your other point, which is that "having your post read is the real reward," since there is no guarantee the post was read before voting.
comment 5y ago · link · parent
I guess session savers? Never really got into them because (at the time a few years back) they weren't great for indexing within pages. Might give it a try again.
comment 5y ago · link · parent
I use the exact same trick - just let the search bar index it.
What I really want is a system like a personal search engine. Bookmarking starts a flow which downloads the page, strips out all the garbage, indexes it in something like Elasticsearch or Bleve, tags some metadata, and organizes it by facets.
Google is decent at getting back to places I once found, but there are still 404s that Archive misses. There's also sites like stackexchange where it's easy to get drowned out by irrelevant results. It would be nice to have a more personally curated view into it.
comment 5y ago · link · parent
Another thing: I was using the free version in beta so it was effectively the full blown version. It worked super well. I changed jobs, changed hardware, and haven't set up my key yet (hopefully still grandfathered in) but it's felt not as good - the output is a lot shorter, for one. I would likely get the paid version if I lose my beta key. But it's weird that you have the paid version and it's not useful.
It's also possible they nerfed the models over time in the name of some other tradeoff, like cpu or memory. May still be able to configure it. But I distinctly remember it spitting out entire lines or chunks of code, exactly as I would have written them.
It works best when you are writing stuff similar to your own codebase. Perhaps try vendoring some Swift or Kotlin in your project dir to get the engine to fine-tune on it?
comment 5y ago · link · parent
Of course, you are expected to not let it get to that point. But re: the comment about hostages, yeah, Uncle Sam would not hesitate to disable a nuke or material, even if it meant casualties of NMCs held hostage.
Civilian casualties, no idea. That is the kind of fodder of actual classified conops. But in the metaphorical trolley problem between "N civilian casualties" and "nuke gets away", yeah my guess is N will be nonzero.
comment 5y ago · link · parent
It would not surprise me in the slightest to hear that contingency plans prioritized preventing material from falling into the wrong hands over basically all forms of collateral damage. I'm sure the NMCs are well aware they'd be hellfire missile'd before letting a nuke slip away, if those were the only choices.
comment 5y ago · link · parent
> Does this Add operator have a Result type now?
Essentially yes. There could be other APIs which accomplish the same results but have different constraints, such as not being able to mutate strings without also creating a Result to be handled. Yeah you lose some ergonomics but even that feels more ergonomic than C.
I think Rust is in a unique position in that zero / extremely few panics is actually achievable, and easier to achieve, with less manual discipline, than C.
comment 5y ago · link · parent
Also, this is just what words do over time. Punk used to mean prostitute. Then it generalized to any ruffian. See also, words like: gay, awesome, nice, robot/bot, slave.
comment 5y ago · link · parent
Is it their rainforest though? It raises some interesting philosophical and geopolitical questions. Paving the Amazon rainforest would almost certainty disrupt many things outside Brazil's borders.
I think it's tantamount to discussions about putting carbon, cfc, and pollution into our atmosphere.
comment 5y ago · link · parent
But also, bigger corps are bigger revenue streams for Google. Google has less to lose by alienating indie devs than Twitter.
comment 5y ago · link · parent
I suspect the arrow goes:
X -> brain degradation
brain degradation -> cognitive decline
cognitive decline -> driving bad
brain degradation -> post-mortem Alzheimers diagnosis
The loose link there is the path from brain degradation to cognitive decline. The 90+ findings (plus other findings on TBI and plasticity) suggest that by maintaining high plasticity through brain assaults (old age, trauma), it seems the brain can "route around damage" and remain comparatively functional.[0] The 90+ study: https://mind.uci.edu/research-studies/90plus-study/
60 Minutes on Superagers - Video + Transcript: https://www.cbsnews.com/news/long-life-retirement-community-...
comment 5y ago · link · parent
Like I look at the prompt "sheep grazing on a hillside by tim burton". I look at the pic. Brain goes, "yup, that checks out". You wouldn't necessarily derive the domain from the range (preimage attack), but I can readily say, "if I fell asleep after watching Wallace and Gromit - Close Shave, and Nightmare Before Christmas, this is what I would dream".
comment 5y ago · link · parent
b) The mistake was picking base-10 as the basis of the metric system. The Base-12/Reciprocal-halves (2^63/2^4) system of feet, inches, fractional inches, is hands-down the best way to engineer and build things on the human scale. It makes it super easy to scale measurements by N/2, N/3, N/4, N/6, N/8, N/12, N/2^m. Three weeks ago had to make 9 evenly spaced holes in a 24' board, with an inch of buffer on either side, which works out to 35-3/4". This results in really convenient interval of N3'-less-N/4" (35-3/4, 71-1/2, 107-1/4, 143"), so convenient I still remember them weeks later.
The yucky part is when you have to use a base(2*5) calculator. Now you get 35.75, 71.5, 107.25, 143", which is a much less obvious pattern.
Every day I'm in the shop, I yearn for a dozenal calculator and measuring tape.
One can dream.
Base 6 is also nice:
comment 5y ago · link · parent
I actually find it pretty convenient since the dynamic range is actually useful (unlike most phones which have a step-change from 0 to 1).
I'm sure it's somewhat deliberate, "only plebs lack understanding of dBs and log scaling. I'm a refined audiophile! "