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

Projects
None yet
1 participant
@fasterthanlime
Collaborator

fasterthanlime 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 from Wtf2 to Casting to generic makes rock forget AddressOf for some reason Jul 9, 2015

@fasterthanlime

This comment has been minimized.

Collaborator

fasterthanlime 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 from Casting to generic makes rock forget AddressOf for some reason to 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