kitlang / kit

Kit: a magical, high performance programming language, designed for game development.
https://www.kitlang.org
Other
1.02k stars 29 forks source link

Empty prelude kill the std, including Types; #54

Closed quasioy closed 6 years ago

quasioy commented 6 years ago

Describe the problem. What did you see? What did you expect to see?

Creating an empty prelude file in root of the project overwrite the std.

If this is a code issue, provide a minimal code example:

function main() {
    var zero = 0;
}

this lead to:

Error: Sanity check failed: couldn't required trait kit.numeric.Numeric, which should be provided by the standard library; check your kitc installation
----------------------------------------
Error: Sanity check failed: couldn't required trait kit.numeric.Integral, which should be provided by the standard library; check your kitc installation
----------------------------------------
Error: Sanity check failed: couldn't required trait kit.numeric.NumericMixed, which should be provided by the standard library; check your kitc installation
----------------------------------------
Error: Sanity check failed: couldn't required trait kit.iterator.Iterator, which should be provided by the standard library; check your kitc installation
----------------------------------------
Error: Sanity check failed: couldn't required trait kit.iterator.Iterable, which should be provided by the standard library; check your kitc installation
bendmorris commented 6 years ago

Sure does :) https://www.kitlang.org/examples.html#prelude-modules

Unless you know what you’re doing, don’t create a root-level prelude.kit file! The root-level prelude is how Kit imports its own standard library. You can, but probably shouldn’t, override it.

I prefer to keep this functionality as is, and there's a decent error message when it happens, so I'm not sure if there's anything else to do here. Could possibly add an extra hint to the error message if you have a root-level prelude.

quasioy commented 6 years ago

Shame for me, I did not read the docs very carefully.

Could possibly add an extra hint to the error message if you have a root-level prelude.

I kinda like this, also that part of the doc can be highlighted.