lua-users home
lua-l archive

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

On Thu, Nov 11, 2004 at 09:58:31PM +0000, Dr. Rich Artym wrote:
> On Thu, Nov 11, 2004 at 04:33:28PM -0500, Brian Casiello wrote:
> > So it's the fact that assigments (i.e. set!) are allowed, not the
> > closure issue (since closures are handled the same way as scheme),
> > that make lua not a purely functional language?
> Oh I don't think so, since Lua has never been described as a purely
> functional language, or at least I've never heard anyone suggest that.


> It's only the implementation of closures that gives me any worry here,
> since closures are meant to create pure functions out of impure ones.

And this I think is the problem with your argument, which sounded
quite reasonable at first: you're taking a definition from the purely
functional world and relating it to impure functions. How exactly, in
a pure functional language could one possibly have an un-closed
function? The notion simply makes no sense, because there is no
possibility of modifying any environment.

Your argument seems to be equivalent to saying that Lua variables
aren't proper variables because you can modify them. Naturally, the
addition of impure language features requires the modification of
these definitions, and claiming that Lua doesn't have lexical scoping
just because it doesn't match a purely functional definition of such
seems pointless.

> After all, that's what's being closed, the impact of the rest of the
> universe on the function.

Possibly the word 'closure' could be considered out-of-context in an
impure setting, but again that just depends on how you interpret it.

> If the semantics of a function can be made to change by modifying the
> values of its non-local and non-argument variables then those variables
> haven't been closed, and you don't have a closure, you just have an
> ordinary function with unclosed state.

Could you please define 'ordinary function'? And explain where that
definition came from?

-- Jamie Webb