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
Closed

Casting to generic should be forbidden except from Pointer #891

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

Comments

@fasterthanlime
Copy link
Collaborator

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

@fasterthanlime fasterthanlime commented Jul 9, 2015

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

Loading

@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 added this to the 0.9.10 milestone Jul 10, 2015
@fasterthanlime fasterthanlime added this to the 0.9.10 milestone Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant