On Fri, 10 Dec 2021 15:28:59 +1100
Chris Angelico <ros...@gmail.com> wrote:

> On Fri, Dec 10, 2021 at 3:06 PM Duke Normandin
> <dukeofp...@gmx.com> wrote:
> >
> > On Fri, 10 Dec 2021 14:09:21 +1100
> > Chris Angelico <ros...@gmail.com> wrote:
> >
> > > On Fri, Dec 10, 2021 at 1:10 PM Duke Normandin
> > > <dukeofp...@gmx.com> wrote:
> > > >
> > > > Greetings ..
> > > >
> > > > function hello =lambda() {}
> > > >
> > > > or
> > > >
> > > > void hello() {}
> > > >
> > > > In Pike, which form is prefered or optimal? Why?
> > > > TIA ...
> > >
> > >
> > > Definitely the second, unless you need it to be a variable.
> >
> > Thx Chris! So - if I understand you correctly, the lambda form
> > is available to provide first-class functionality, i.e. the
> > capability of assigning a function to a variable, etc?
>
> The function itself is always a first-class object, but the lambda
> form allows you to reassign it:
>
> function hello = lambda() {};
>
> // ... later ...
>
> hello = lambda() {/* something else */};
>
> Not something you'll often need, but when you do need it, the
> option is there.

Got it! Thx

--
Duke
** Text only please. Bottom post is best. **

Reply via email to