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

Casting to generic should be forbidden except from Pointer #891

Closed
fasterthanlime opened this issue Jul 9, 2015 · 1 comment

Comments

@fasterthanlime
Copy link
Collaborator

commented Jul 9, 2015

Casting to T doesn't work too well apparently..

Peeker: class {
    inner: Object
    init: func (=inner)
    peek: func <T> (T: Class) -> T {
        inner as T // crashes because forgetting the & around (this->inner)
        // inner // works
    }
}

main: func {
    p := Peeker new("hi!")
    p peek(String) println()
}

@fasterthanlime fasterthanlime changed the title Wtf2 Casting to generic makes rock forget AddressOf for some reason Jul 9, 2015

@fasterthanlime

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 9, 2015

Actually, casting to generics should be forbidden, except from Pointer (so structs/HashMap keeps working, for instance).

@fasterthanlime fasterthanlime changed the title Casting to generic makes rock forget AddressOf for some reason Casting to generic should be forbidden except from Pointer Jul 9, 2015

@fasterthanlime fasterthanlime modified the milestone: 0.9.10 Jul 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.