logoalt Hacker News

wasmpersontoday at 9:38 PM0 repliesview on HN

> Without methods or overloading, you end up in the situation that C and Scheme are in

Well in C at least we now have this:

  #define clear(s) _Generic((s) \
          ,struct list: list_clear \
          ,struct queue: queue_clear \
          ,struct map: map_clear \
  )(s)

  clear(my_map);
  clear(my_list);
  clear(my_queue);
...although it turns out the other nice thing about methods is automatic namespacing.