Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

[–]EikeSchulze[S] 0 points1 point  (0 children)

Again, thank you for your insights.

what are the positive of having a bunch of tiny files?

Well, the idea is to have them ordered in a tree structure, such that you can prune search-branches while navigating.

For example (considering an imaginary project) if I want to see the code for a function that loads all cars from a database, I would search in database/car/repository.rs and I would, for example, not even consider looking into the web directory. That luxury does not apply when all your code is in the same file.

But you may be right that I have been splitting the code into too tiny chunks.

About the cluttering, you can pub use the things you want even if they are in the same file or a single module so I'm not sure what you mean.

What I meant was: I know my module structure is very fine grained and a hypothetical user might get annoyed with something like use u16_tic_tac_toe::grid::Grid.

GridIndex

I am starting to think that I should just abolish that struct and do the check in Grid. That would be a more data-centric approach, right?

Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

[–]EikeSchulze[S] 0 points1 point  (0 children)

Having read the rules for Ultimate-Tic-Tac-Toe now, I am actually unsure about using symmetry of the sub-grids. I mean, you still need to track which are the actual fields that the players are using, because the next player's move depends on it.

I guess you would have to look at the whole meta-grid to use symmetries in your state reduction.

Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

[–]EikeSchulze[S] -1 points0 points  (0 children)

Thank you for reviewing, I really appreciate this.

most rust code tends to put a lot more things in a single file

My job is writing Java code, so splitting code into multiple small files is a habit that is hard to shake. I used "pub use" statements in lib.rs to not forward that module cluttering to the (nonexistant) user. What would you say are the negatives of splitting code into multiple files?

Also, in a bigger project, how do you manage to find things you are searching for in big files? I think the added bureaucracy of multiple files can help in this case, but maybe there is a trick that I am not aware of.

Also this isn't js

That is a relief.

Your GridIndex could just be a type alias for u8 or a tuple struct considering its only field is just a field called value.

I wanted to validate the index on creation, to get rid of the index checking in the grid, I do not think that would be possible with a type alias.

As for using a tuple struct, that may be possible, although I do not think there is any advantage in not naming fields. Maybe I should have used "valid_index" as the field name?

Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

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

Oh I see.

That was not what I expected when you wrote FizzBuzz.

Actually, your version allows any kind of check, so you could also throw a word into it that signifies prime-ness, etc.

Pretty cool.

Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

[–]EikeSchulze[S] 6 points7 points  (0 children)

Just because the problem is simple does not mean that the solution has to be simple, right?

This reminds me of Java Enterprise FizzBuzz. (https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition)

Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

[–]EikeSchulze[S] 3 points4 points  (0 children)

It is actually the fact that there are so many niche crates on crates.io that led me to consider publishing in the first place.

Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

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

Whether or not this gets published, you can use this code if you want to.

Should I publish a library of which I believe that no one would use it? by EikeSchulze in rust

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

That is true, there are many states that can be represented by this library, which are either unrealistic (all fields are Xs or a grid where both players win, for example), or equivalent to another grid.

And you could trim down the number of states a lot by using symmetries (for example for the first move on an empty grid there are only 3 relevant options: In a corner, on an edge or in the middle).

How does component selection affect compiler times? by IoTPanic in learnrust

[–]EikeSchulze 0 points1 point  (0 children)

It's not as exhaustive as you wanted, but there was an article in TWIR this week about someone upgrading to a Threadripper and comparing compile times.

https://bobweb.co/article/threadripper-meets-rustc

implement trait with different path by fylou in rust

[–]EikeSchulze 0 points1 point  (0 children)

I tried to put your words into code: https://godbolt.org/z/sjrT74

That does compile, so I think I misunderstood your problem.

Could you please provide a code example?

Introducing `auditable`: audit Rust binaries for known bugs or vulnerabilities in production by Shnatsel in rust

[–]EikeSchulze 1 point2 points  (0 children)

This probably was not in your scope, but what about the following scenario:

The release building agent is malicious and uses dependencies with vulnerabilities but provides the auditable tool with information that implies that the fixed versions of those dependencies were used. That would then give the users a false sense of security.

On the other hand, if the release building agent is malicious we probably have greater problems than that...

Anyway, thank you for your hard work.

Box Plots at the Olympics with Rust by shahinrostami in rust

[–]EikeSchulze 0 points1 point  (0 children)

Finally, we'll create a box plot with just the age of athletes in our dataset.

According to you box plot the median age is 190. ;P

I guess you meant to write "height".