:: Re: [DNG] Wirth's law
Forside
Slet denne besked
Besvar denne besked
Skribent: Jaromil
Dato:  
Til: dng
Emne: Re: [DNG] Wirth's law
On Mon, 25 Jul 2016, Didier Kryn wrote:

> Le 25/07/2016 00:55, Steve Litt a écrit :
> >On Sun, 24 Jul 2016 23:30:47 +0200
> >Didier Kryn <kryn@???> wrote:
> >
> >>Le 24/07/2016 22:37, Jaromil a écrit :
> >>>nowadays the closures paradigm (basically fifo pipes of pointers to
> >>>stateless functions) is used much more than all that mutex and
> >>>semaphore old stuff. i.e. golang adopted closures since the
> >>>beginning with great success.
> >>>
> >>>ciao
> >>      Don't know what a closure is, although I heard of it long ago on
> >>this list. According to Wikipedia, it is "a record containing a
> >>function and its environment".
> >Hi Didier,

> >
> >I've never encountered closures as described by Jaromil, but they're a
> >pretty handy thing easily done in many languages, with Lua leading the
> >list. Here's something that might help explain a little bit:
> >
> >http://troubleshooters.com/codecorn/lua/luaclosures.htm
>
>     Thanks, Steve. It confirms my further reading of Wikipedia's article.

>
>     In languages like C, C++ or Ada, it is impossible to use a function to
> create a closure, because they store variables local to the subprogram (then
> creator function) in the stack.


In C++ is possible, made easier using the "Factory" approach

we have this implemented in FreeJ

https://github.com/dyne/FreeJ/blob/aa73398f752ced835d57e3012866512d55de252d/src/include/closure.h

This can be done also in C, but I never need it there. The new C++11
standard makes it even easier with the introduction of lambda
functions.

I've been always very intrigued by concurrency stuff BTW.

nowadays, I'm get all warm and cuddly whenever I get to spend time
with Prismatic Plumbing https://github.com/plumatic/plumbing and
Clojure in general has some really amazing things. I can well
understand the passion for Ada here and think you may well like it.



ciao