octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash with inline


From: Teemu Ikonen
Subject: Re: Crash with inline
Date: Thu, 16 Sep 2004 18:26:05 +0300
User-agent: Mutt/1.4.1i

On 16/09/04 11:01, John W. Eaton wrote:
> | functions as first-class objects,
> They are not really first-class objects, are they?  If you write

Oops, indeed I mistook the function handles returned by inline as functions.

> | would it be hard to implement real closures?
> I'm not sure.  How would this work within the current language?

Well, functions defined in the command line either by inline or function
keyword would find undefined variables from the top-level environment (if
they exist) and store their value. Something like:

> a = 1;
> f = inline("x + a", "x");
> f(1)
ans = 2
> a = pi;
> f(1)
ans = 2

Looks straightforward, but there might be all kinds of subtleties I'm not
aware of...

Teemu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]