erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.69k stars 55 forks source link

Hard-coded &str to constants #266

Open GreasySlug opened 1 year ago

GreasySlug commented 1 year ago

A string that is currently commonly used in several files is hard-coded. e.g. Eq, Output, Self etc.

It should be convert these to constants as they may cause typos. like

const EQ: &str = "Eq";
yuk1ty commented 1 year ago

Hi, I'm interested in this. Can I take this issue?

GreasySlug commented 1 year ago

Of course. If you have any questions, please ask here or in discord.

mtshiba commented 1 year ago

For example, mono("Num") appears 8 times in erg_compiler/context/initialize/mod.rs. This can be changed to, for example

let Num = mono("Num");

Please put them in one place within a function.

yuk1ty commented 1 year ago

Sure, I'll try that! Thank you for the swift response and elaborate explanation!

yuk1ty commented 1 year ago

Ah, I'm sorry I referred this issue as "Fixed" from the pull request, so this issue seems to be closed at the same time 😅 Can you reopen this? @mtshiba Thanks!