Removing 'using' on by default has ruined a huge part of the language. #6305
Replies: 2 comments
-
|
I understand the complaint, but it's just been empirically such a bad thing, especially when working on teams or refactoring code. It might be "fine" for the individual programmer, but it was a failure of an "experiment". |
Beta Was this translation helpful? Give feedback.
-
|
For what it's worth, I second this. It seems like for projects with solo developers/smaller teams this is a really handy feature. Could this be something akin to a "house-style" that can be enabled with a compiler flag or something? Apologies if this is a naive question relative to Odin's priorities as a language, as I'm new to the language. For example when writing entity code, it's really handy to be able to write: player_update(using it: ^Entity) {
position += 1;
}I actually came here to suggest top-level using for a similar reason, and was looking forward to using engine/
a.odin
b.odin
game.odinThe problem is I want to write an "engine" library that all my game projects use. And for convenience, I would prefer to keep it in a single directory so I can just copy that around between projects. But, when I'm writing game code I want it to feel as much like I'm "in the engine" as possible (as in, have all symbols from engine available in every game file). Currently I have a structure like this (so that all files can use the same package): So that leaves me with two, rather awkward options:
// File: engine_link.odin
import "engine"
draw_rect :: engine.draw_rect
draw_triangle :: engine.draw_triangle
// ...With either of these approaches, as either 1) the number of engine files increases or 2) the number of engine symbols increases this becomes a little bit unwieldy. I understand that top-level using may be a bad idea for other reasons. But IMO it would be a shame if the using feature went away entirely. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Went to update and hit with this, having to put a stupid directive on every file. I don't care if some people find it 'controversial' don't use the features you don't like, we do it for any other language. Or better yet why not make it a directive to opt-out if the complainers need comforting. People just don't know a good thing when they have it and will ruin it for everyone.
There's no point in fighting for it, but I'll just say I found it so useful for reasoning, and never had any issues or anything hard to track with it. But now I have to feel like I'm doing something wrong every time I use it in a new file. Bah humbug.
Beta Was this translation helpful? Give feedback.
All reactions