Hacker News new | past | comments | ask | show | jobs | submit login

That's seems fixable with a standard library, if you define,

    typedef struct { byte *data; u64 len; } array;
    typedef struct { byte *data; u64 len; u64 cap; } vec;

    typedef struct { byte *data; u64 len; } string;
etc.

Then developers will adhere to those apis, so long as, one's own array-struct decays to the above, so there can be standard library fns against the above, eg.,

    sort(array *a); 
etc.



Sure, but you lose the simplicity of accessing items with a[index], literals {1, 2, 3}, and initialization.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: