hecrj / coffee

An opinionated 2D game engine for Rust
https://docs.rs/coffee
MIT License
1.08k stars 55 forks source link

renaming files to mod.rs where possible #121

Closed adamnemecek closed 4 years ago

adamnemecek commented 4 years ago

renderer mod.rs

hecrj commented 4 years ago

Hey, thanks!

I personally prefer not having mod files. Is there any good reason to switch?

In any case, there are some other nice changes here, so if you can rollback just the mod part we should be able to merge this.

adamnemecek commented 4 years ago

I used to be against mod too but then I realized it gives a better structure to the modules.

hecrj commented 4 years ago

Could you elaborate? It sounds a bit subjective. I personally prefer to use Rust 2018 to its full extent.

adamnemecek commented 4 years ago

Mod gives you consistency. It's a good idea for the same reason as calling your constructor method new is a good idea. If one has a type Thing, one could call the constructor "fn thing" however calling it "fn new" gives you consistency.

twe4ked commented 4 years ago

Mod gives you consistency.

Although, not using mod.rs files would also give you consistency. I'm not sure what style I prefer but I don't think consistency is enough of an argument for something subjective like this.

oguzkocer commented 4 years ago

Using mod.rs makes it much more difficult to navigate the code base, I definitely prefer the current approach.

adamnemecek commented 4 years ago

Do you go by the tab name or something?

oguzkocer commented 4 years ago

No, when I do a fuzzy search, it's much easier to find something by name rather than have a bunch of different results for mod.rs.

I really don't see any benefit to using mod.rs since as @twe4ked put it, not using mod.rs is also very consistent and well within idiomatic Rust. Having said that, these things are completely subjective and I wanted vote on not having mod.rs, but if @hecrj wants to go with that I don't really mind it much. I am not actively working on this library and when I do, it is not that big of a deal.

adamnemecek commented 4 years ago

You don't spend much time in mod files. It makes sense to hide them then.