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

this implementation is poor. choice more elegant algorithm. #269

Open
github-actions bot opened this issue Oct 15, 2023 · 2 comments
Open

this implementation is poor. choice more elegant algorithm. #269

github-actions bot opened this issue Oct 15, 2023 · 2 comments
Assignees
Labels

Comments

@github-actions
Copy link

https://api.github.com/KisaragiEffective/origlang/blob/114c0a77603f4c713b4dd76a58969cad56027da9/package/origlang-compiler/src/type_check.rs#L537

            }
        }
    }

    pub(crate) fn make_fresh_identifier(&self) -> Identifier {
        // TODO: this implementation is poor. choice more elegant algorithm.
        let hello = RandomState::new().hash_one(());
        let m = hello.to_ne_bytes();
        let m = [
            b'_', b'_',
            m[0].clamp(b'a', b'z'), m[1].clamp(b'a', b'z'), m[2].clamp(b'a', b'z'), m[3].clamp(b'a', b'z'),
            m[4].clamp(b'a', b'z'), m[5].clamp(b'a', b'z'), m[6].clamp(b'a', b'z'), m[7].clamp(b'a', b'z'),
        ];

        Identifier::new(core::str::from_utf8(&m).expect("not panic").to_owned())
    }
}

impl TypeChecker {
@KisaragiEffective
Copy link
Owner

なーにがmake_fresh_identifierじゃ

@KisaragiEffective
Copy link
Owner

generate_unspeakable_identifierぐらいにしたい

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

No branches or pull requests

1 participant