News for hackers. Stuff that matters.
Re:Go Statement Considered Harmful (2018) by dan-robertson on Friday March 19, 2021 @08:48AM (#26512647)
Callcc is pretty unstructured. Delimited continuations are a bit more structured and, to me, seem a useful primitive even if application code shouldn’t ever use them. Common Lisp has lexically scoped goto/return which can be useful. Example:

  (defun foo-find (foo x &key (test #'eql))
    (foo-iter foo (lambda (bar)
      (bar-iter bar (lambda (y)
        (when (funcall test x y)
          (return-from foo-find y)))))))
Some people try to implement something similar using exceptions but this only works if nothing swallows your special exception on its way up to the block you’re trying to return from.
Re:Go Statement Considered Harmful (2018) by dragonwriter on Friday March 19, 2021 @10:31AM (#26513758)
Sure, all of those (even callcc) are useful, and having them in an otherwise reasonably high-level language means you can use it to build plumbing in the language that would otherwise have to be primitives implemented in a lower-level language (e.g., the Common Lisp condition system, which is basically exceptions with superpowers, can be built fairly simply on top of call/cc; I once built a toy implementation for Ruby based on the one in Practical Common Lisp.)

I don't think having unstructured told in a language is a bad thing, though I think the core language / stdlib having the right structured tools (whether primitives or built in the language itself on top of the unstructured ones) that most code never needs to reach for the unstructured tools is desirable.