Hacker News new | ask | show | jobs
by dfox 2904 days ago
Smalltalk (and for that matter Ruby) has weird feature that blocks and methods are different different concepts.

In my opinion the Python's explicit self argument is somehow cleaner approach than having distinct block and function/method types. You still need some kind of ugliness in order to implement super(), but for Python 3 that happens at compile time and the resulting syntax is reasonably sane.

As for the aforementioned method context issue CLOS/MOP takes interesting approach of macroexpanding the method definition into something like

  (lambda (args next-method)
    (labels
      ((call-next-method &args)
        ...
        (funcall next-method ...)))
      (impl (...)
        ... method body ...))
     (funcall impl args)))
Also of note is that in ST, there are no control structures, even if is implemented as method on Boolean instances which takes block argument, with true and false being instances of True resp. False with different implementations of #ifTrue: method.