I thought I was building a C replacement. I was wrong

(c3-lang.org)

17 points | by birdculture 6 hours ago ago

1 comments

  • Panzerschrek 6 minutes ago

    > methods first

    I agree, that sometimes doing things OOP-style with methods isn't the right choice and using plain structs and free functions is a better way of doing things. But there are cases where using methods is inevitable - when internals must be hidden in order to prevent incorrect usage. Also it's needed if one needs runtime polymorphism, in such cases (in C++) inheritance and virtual methods come to rescue. Doing so in C way (with void pointers and structs containing function pointers) is less ergonomic and bug-prone.