On Sun, Dec 31, 2017 at 7:36 AM, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: > bartc <b...@freeuk.com> writes: > >> On 30/12/2017 16:53, mm0fmf wrote: >>> On 30/12/2017 14:41, bartc wrote: >>>> it looks a bit naff >>> >>> Understatement of 2017. >> >> I'm honest about my own ideas, but my remarks were about the use of >> special symbols such as "::" and "@". >> >> Before completely dismissing it however, you should look at how >> another language such as Python can achieve the same thing. >> >> Namely, take any block of code within a function, and allow it to be >> executed or shared from anywhere else in the function, with the >> minimum of disruption. > > That's what a local function does and it does it with the clean > semantics of a function call. >
The only downside that I can think of is performance - function calls can be a bit heavy-weight. I'd be curious to see what a "lightweight local function" would look like - it could have restrictive semantics like "can only be called from the function that constructed it" and then could behave like Bart's proposed "block of code". But I suspect it wouldn't have all that many uses, compared to a *real* closure, which can be passed around as its own entity. ChrisA -- https://mail.python.org/mailman/listinfo/python-list