dictu-lang / Dictu

Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language.
https://dictu-lang.com
MIT License
267 stars 53 forks source link

[BUG] - Unable to Create class, var, or const with the Name "C" #637

Closed briandowns closed 1 year ago

briandowns commented 1 year ago

Is there an existing issue for this?

Current Behavior

I ran into an issue while testing other code when I tried to create a class named "C". I think it's conflicting with the internal module of the same name. I tested with const's and var's and it's the same behavior.

Expected Behavior

No response

Steps To Reproduce

Using the latest version:

>>> class C {}
>>> const c = C();
Error: File 'repl', line 1
       'module' is not callable
>>> const C = 90;
>>> print(C);
<Module C>
>>> var C = 90;
>>> print(C);
<Module C>

Anything else?

No response

briandowns commented 1 year ago

I adjusted the code to not auto load the C module but to require it be explicitly imported, tested, and seemed to work fine. I can push a PR but wanted to get your (@Jason2605) thoughts and feedback on the matter before I did.

Jason2605 commented 1 year ago

Please yeah, I'm unsure the reason I didn't un-autoload that module