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

Don't enforce that a type can only be passed as a comptime parameter #2940

Closed
daurnimator opened this issue Jul 24, 2019 · 1 comment
Closed
Milestone

Comments

@daurnimator
Copy link
Collaborator

daurnimator commented Jul 24, 2019

fn show(anything: var) void {
    switch (@typeInfo(@typeOf(anything))) {
        .Bool, .Int => std.debug.warn("{}={}", @typeName(@typeOf(anything)), anything),
        .Type => std.debug.warn("{}={}", @typeName(@typeOf(anything)), @typeName(anything)),
        .else => unreachable,
    }
}

fails when passing a type in:

error: parameter of type 'type' requires comptime

I don't want to make the parameter comptime, as other branches use the runtime value.

@andrewrk andrewrk added the proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. label Jul 24, 2019
@andrewrk andrewrk added this to the 0.6.0 milestone Jul 24, 2019
@andrewrk
Copy link
Member

This is accepted, and it is a duplicate of #1383.

@andrewrk andrewrk removed the proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. label Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants