
+ pointer cstring {

    fn get(index: uint) u8 $offset {
        return @ptrv(this, u8, index)
    }
    fn index_of(find: u8) uint !notfound {
        let i : uint = 0
        while true {
            let ch = this[i++]
            if ch == find : return i - 1
            if ch == 0 : break
        }
        throw notfound
    }

    fn length() uint {
        let i : uint = 0
        while @ptrv(this, u8, i) != 0 {
            i++
        }
        return i
    }

    fn to_string() String $to {
        return String.make_from_ptr(this, this.length())
    }
}
