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

Figure out runtime first class typing and monomorphization #625

Open
CohenArthur opened this issue Oct 18, 2023 · 1 comment
Open

Figure out runtime first class typing and monomorphization #625

CohenArthur opened this issue Oct 18, 2023 · 1 comment
Labels
generics Issue with generic types priority [low] Low priority issue typechecker Issue related to typechecking in jinko

Comments

@CohenArthur
Copy link
Member

CohenArthur commented Oct 18, 2023

fn generic[T](value: T) -> string { value.name }

fn create_type(based: bool) -> type {
    if based {
        TypeBuilder.new().field("name", string).type()
    else {
        TypeBuilder.empty().type()
    }
}

type Foo = create_type(read_user_input_as_bool());
where foo = Foo; // sob

generic(foo); // sob

if we do go through with the first class types, then we need to figure out how to handle this type of code. thanks to @SanderJSA for ruining my day when I was blissfully anaware that this was an issue

@CohenArthur CohenArthur added typechecker Issue related to typechecking in jinko generics Issue with generic types priority [low] Low priority issue labels Oct 18, 2023
@CohenArthur
Copy link
Member Author

Keeping first class typing to compile-time fixes the issue. Is that acceptable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generics Issue with generic types priority [low] Low priority issue typechecker Issue related to typechecking in jinko
Projects
None yet
Development

No branches or pull requests

1 participant