22 pointsby ww5203 days ago2 comments
  • kingstnapan hour ago
    You've put the

    pub fn implBy(impl_obj: anytype) Logger

    Function in a weird place. Normal practice is for the specific implementations to have a getLogger function to create the logger. For example, the allocators in Zig have you instantiate the top level and then call .allocator() on them to get the vtable + pointer to self.

    It manages sanity a lot better, and the function implementations in the vtable can be private.

  • ozgrakkurt3 days ago
    Also can add compilation time as an upside to vtables.

    And using vtable in code feels cleaner compared to using generics