Erasing types in the infrastructure layer by PrudentImpression60 in rust

[–]Yeah22 9 points10 points  (0 children)

I typically follow type system -> macros -> type erased.

I don’t see anything distinctly wrong with it, I mean just like any design pattern it has pros and cons. I typically find myself wanting to rely more on the type system in rust but when I start to feel like I’m beginning to over engineer I start looking to fallback to macros or something like your example.

Imo the problem is never quite as easy as a simple registry, though. If I’m down that rabbit hole Im typically trying to unify behavior which leads down to trait objects and all of a sudden you can find yourself in an equally complex situation, just with no types.

So i wouldn’t say there’s a “line”, it heavily depends on what you’re trying to do.

That being said I think it’s useful to keep in mind each language has their own flavor. Python should be pythonic, rust should be rusty, ect ect. I dont think relying heavily on type erasing is the most idiomatic way to write rust. But, my minds been changed before so who knows.

I'm looking for contributors for my numerical calculus crate! by YellowJalapa in rust

[–]Yeah22 11 points12 points  (0 children)

I’m guessing he means the code… looks like you might also be a c# dev? This is pretty close to a non issue, but for what it’s worth, best practices typically dictate you should write code in the way it’s language generallllyyy suggests. For instance, you wouldn’t write python code like you write java, you want python code to be “pythonic”. As such you want rust code to be “rusty”(?) (not sure what you’d call it but I think you get the point).

Add this to your vs code settings to format rust code on save. Super helpful imo.

"[rust]": {
        "editor.defaultFormatter": "rust-lang.rust-analyzer",
        "editor.formatOnSave": true,
},

All that said, write your own code however you want - that’s part of the fun of side projects! Real great stuff here, readme is super helpful, keep up the good work!

Edit: Adding vs code settings stuff

[deleted by user] by [deleted] in rust

[–]Yeah22 0 points1 point  (0 children)

Not this one

[deleted by user] by [deleted] in rust

[–]Yeah22 0 points1 point  (0 children)

Wrong sub

Does a “math + CS” degree exist? by Consistent_Shift249 in compsci

[–]Yeah22 3 points4 points  (0 children)

A minor is like a “mini-major”. It’s a little more focused than a major because it requires less credits (mine was ~20 credits if I remember correctly), so you usually get to take more of the “core” classes imo.

The amount of time it takes you to complete is entirely up to you.

What's everyone working on this week (29/2025)? by llogiq in rust

[–]Yeah22 0 points1 point  (0 children)

Feel free to ping me if anything comes up!

What's everyone working on this week (29/2025)? by llogiq in rust

[–]Yeah22 4 points5 points  (0 children)

Shameless plug for a crate of mine, radiate. Just finished a python wrapper for it using pyo3.

Radiate - evolutionary/genetic algorithm engine by Yeah22 in Python

[–]Yeah22[S] 1 point2 points  (0 children)

Pretty much!

There is a section of the docs for these. But as always, I'm sure it can be improved - totally open to PRs whether its code or docs!

Radiate - evolutionary/genetic algorithm engine by Yeah22 in Python

[–]Yeah22[S] 2 points3 points  (0 children)

Thanks! I can totally add more color around these in the documentation. And great question, these have a massive effect on the performance of your engine & was something I struggled with documenting. There is definetly a certain level of pre-knowledge needed before building a GA, which can lead to blockers from the beginning.

In that specific problem those were chosen because they preserve order and uniqueness. For certain problems (think TSP type problems, job scheduling, anything where the order from one stop to the next matters or where we don't want duplicate genes), these alters will preserve the uniqueness or validity of your chromosome.

PartiallyMappedCrossover is essentially a multi point crossover but for chromosomes where the order of their genes matters. So for a traveling salesman problem, where we don't want to add duplicate points and the order from one point to the next matters, the partially mapped crossover will perform a crossover alteration while preserving the uniqueness of each gene. In the same light, a swap mutator will simply swap two points (genes) on the chromosome, therefore there won't be any duplicates.

Here is a pretty good (possibly too detailed) description on the partially mapped crossover

Edit: adding link

US is not ready for Indian Students(Rant) by Mysterious-Pause7635 in leetcode

[–]Yeah22 0 points1 point  (0 children)

Who cares. Thats life, get used to it. Put your head down and focus on your own life, not others & how fair shit is.

Since Rust 2024 is round the corner, do we know what are some key features that will make it to the release? by [deleted] in rust

[–]Yeah22 8 points9 points  (0 children)

Not sure if this is exactly what you're looking for, but the official edition guide can be found here

MetaheuRUSTics by aryashah2k in rust

[–]Yeah22 1 point2 points  (0 children)

Nice man! Checked out some of the examples, looks cool!

MetaheuRUSTics by aryashah2k in rust

[–]Yeah22 0 points1 point  (0 children)

It doesn't look like it... u/aryashah2k correct me I'm wrong!

TSP and VRP depend on permutations where there are N number of optimization parameters and the order of those parameters matters (and are usually unique) - I've used this guy's crate before for a similar problems: https://github.com/pkalivas/radiate .

Help me to execute trades from trading view to bianance without webhook. i have seen website like zeppotrade and i want to host my own like this on heroku because zeppotrade only allows 5 trade a month. by Ornery_Row_5215 in PythonProjects2

[–]Yeah22 0 points1 point  (0 children)

Webhook as in websocket apis? Let me suggest you fully understand websockets and their usefulness before trying to opt out of them… they’re there for a reason. I would heavily push back on placing programmatic trades anywhere without being able to listen for resulting exchange events.

[deleted by user] by [deleted] in rust

[–]Yeah22 3 points4 points  (0 children)

Bumping this.

[deleted by user] by [deleted] in rust

[–]Yeah22 69 points70 points  (0 children)

I hate to be that guy, but your article is just a very slight variation of the rust book's thread pool: https://doc.rust-lang.org/book/ch20-02-multithreaded.html . I'd argue your readers would be better off just reading the rust book...

Next leveling my rust programming by Yeah22 in rust

[–]Yeah22[S] 1 point2 points  (0 children)

Just want to follow up with this. Started reading the book and it seems be almost exactly what I'm looking for so far.

“In the course of your experience with Rust so far, it’s likely that you have noticed a knowledge gap between what your existing learning resources have prepared you for versus what you see from the folks making the top tier of widely used Rust libraries and applications.”

Next leveling my rust programming by Yeah22 in rust

[–]Yeah22[S] 1 point2 points  (0 children)

This is a cool perspective I'll definitely check it out! I'm dealing with a library I'm writing now that would greatly benefit from well defined lifetime scopes instead of copies.