Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Generic type parameters can be overwritten #415

Closed
nddrylliog opened this Issue May 23, 2012 · 7 comments

Comments

Projects
None yet
4 participants
Member

nddrylliog commented May 23, 2012

This is, hands down, the funniest bug I have ever encountered in ooc:

import structs/ArrayList

main: func {

    s := ArrayList<Int> new()
    s add(0xdeadbeef). add(0). add(0). add(0)

    "Correct" println()
    for (i in 0..s size) {
        "%x" printfln(s get(i))
    }

    s T = Octet // that is so, so wrong.

    "Incorrect" println()
    for (i in 0..s size) {
        "%x" printfln(s get(i))
    }

}

/cc @shamanas @showstopper

Member

nddrylliog commented Dec 1, 2012

I don't know if it should be strictly forbidden, but at least it could yield a warning :)

Collaborator

shamanas commented Oct 2, 2015

I've implemented this one of my branches, seems the sdk uses that (text/json/Parser.ooc)

pushSimpleValue: func (token: Token@) {
        T: Class
        valuePtr := _parseSimpleValue(token&, T&)
        cell := Cell<Pointer> new((valuePtr as Pointer*)@) // TODO: EVIL, evil hack.
        cell T = T
        stack data add(cell)
    }
Contributor

davidhesselbom commented Oct 3, 2015

Parser makes valgrind go nuts about invalid memory usage...

Collaborator

shamanas commented Oct 3, 2015

@davidhesselbom I'll take a look at it later today, I may rewrite it if it needs to be (of course, exposing the same API)

Collaborator

fasterthanlime commented Oct 3, 2015

Parser makes valgrind go nuts about invalid memory usage...

@davidhesselbom even when setting the following environment variable GC_DONT_GC=1 ? It's a well-known fact that the Boehm GC and Valgrind don't play well together at all.

Contributor

davidhesselbom commented Oct 3, 2015

Hmm, I could try on Monday. But I get it with the GC off entirely, so, should that flag make any difference?

Collaborator

fasterthanlime commented Oct 3, 2015

@davidhesselbom probably not

@shamanas shamanas closed this in #932 Oct 6, 2015

@davidhesselbom davidhesselbom referenced this issue in magic-lang/ooc-kean Oct 16, 2015

Merged

Reworked HashDictionary #494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment