[Python-ideas] Jump to function as an an alternative to call function

David Mertz mertz at gnosis.cx
Wed Aug 15 21:58:28 EDT 2018


When did you last read the Dijkstra paper. It's short and he explains very
well why exactly all the constructs you mention are unlike Goto.

This isn't a proposal to subroutines, it's a proposal for subroutines in
which all lexically scoped variables are implicitly nonlocal. That's
basically Goto, certainly course enough to suffer all of Dijkstra's
complaints.

Yes, technically this could be called dynamic scope instead. But
notwithstanding the use in elisp, that's pretty widely regarded as a bad
ideas (even by the emacs developers who regret that early decision).

On Wed, Aug 15, 2018, 9:41 PM Steven D'Aprano <steve at pearwood.info> wrote:

> On Wed, Aug 15, 2018 at 08:35:35PM -0400, David Mertz wrote:
>
> > Goto considered harmful.
>
> Fortunately this proposal has nothing to do with goto.
>
> Elazar is correct that its a kind of subroutine call, just like an
> ordinary function call, except the scoping rules are different.
>
> And for the record, not everyone agrees that Dijkstra is correct about
> goto. Certainly unstructured code is harmful, but we use restricted
> forms of goto all the time, we just don't call it by that name:
>
> - loops
> - continue
> - break
> - if...else
> - function calls
> - exception handling
>
> Just like goto, these are all jumps which change the execution order of
> your code. And some people defend limited, careful use of explicit goto,
> including Donald Knuth.
>
>
> --
> Steve
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180815/b03fa0cd/attachment.html>


More information about the Python-ideas mailing list