Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ErrorCode enum with error codes #1132

Open
FroMage opened this issue Oct 31, 2014 · 5 comments
Open

Add ErrorCode enum with error codes #1132

FroMage opened this issue Oct 31, 2014 · 5 comments
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Oct 31, 2014

Insted of using numbers and luck all over the code.

@FroMage FroMage added this to the 1.1.5 milestone Oct 31, 2014
@gavinking gavinking modified the milestones: 1.2, 1.1.5 Nov 11, 2014
@gavinking
Copy link
Member

Definitely not for 1.1.5 since that would be a huge breaking change to the contract b/w typechecker and IDE.

@gavinking
Copy link
Member

Plus what would be much better would be to create subclasses of AnalysisError, which would also allow transmission of extra info to the IDE. This would be a misuse of enums, since you're talking about a large, open-ended set of options.

@FroMage
Copy link
Member Author

FroMage commented Nov 12, 2014

huge breaking change

What? Turning a bunch of ints into enums? That's a big change? It's annoying because it's manual, since you never defined constants instead of literals, but that's a pretty trivial manual change.

Perhaps subclasses of error would work too, but if we're talking about 100 error codes, you will still need enums (which BTW is what it's made for) because you're not going to create 100 subclasses.

@gavinking
Copy link
Member

That's a big change?

Sure, it immediately makes the 1.1.5 IDE incompatible with the 1.1.0 compiler and vice-versa.

@FroMage
Copy link
Member Author

FroMage commented Nov 12, 2014

Well, not really because they don't talk to eachother since the IDE ships with its own version of the compiler. And that will be true anyways when we add features in the AST like if expressions. So that's a really weak point. Look, if you truely hate having to learn how to declare an enum (I have nailed it, haven't I?) then define some old-fashion static final int ERROR_CODE_X constats at least ;)

These magic numbers are used in at least three projects now so it really looks ridiculous. When these were 2-3 constants it was OK, but now, it just looks bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants