lua-users home
lua-l archive

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


So now you're just insulting, and makes your reply useless. I've not invented things.
lifetime of storage is independant of lifetime of values. That's the full point and the final answer. And yes it applies to C, C++, Java, and Lua and it has always been the case in all imperative languages

This is not true of *pure* functional languages (including Mathematics formulas, in which there are no assignment, only definitions of symbolic constants in a well defined scope: even the "variables" introduced in quantified formulas, with "for all" or "there exists", or in aggregators like "sum of", have a constant value in their delimited scope, and no "lifetime" at all; functions in mathematics are a way to specify a constant relation as a constant set of ordered tuples, possibly and frequently with infinite cardinality), some of them being given the role of "input variables", the other ones being the "ouput variables", but in fact those variables are also constants associated symbolically to constant subsets of the constant relation, and these functions or variables also don't have any defined "lifetime").

But Lua is clearly not a functional language simply because of its imperative nature (as an ordered set of statements that cannot be reversed), and the presence of assignments.

What you may want is using Lua as if it was a functional language, but it is another goal, and most probably you'd better use a functional language (which are still runnable because what they do is to implement in the engine an evaluator or resolver that transforms the functional definition of your program into an ordered set of statements to resolve the problem according to the constraint of a given goal, and in a finite time, and then compile internally the resolution to run it fast; given different input, it internally generates and compiles different imperative programs and you do not specify in the functional program source the resolution order).

For that you have various other languages (though most of them are not purely functional and allow exceptions, including Prolog or Scheme with a way to control the "backtracking" to give an "apriori" limit for exploration of candidate sets to resolve a problem only within a subset of constraints on selected variables, and then making the program fail without any useful result if these constraints are not respected or insufficient for the given input).



Le lun. 3 juin 2019 à 11:48, Francisco Olarte <folarte@peoplecall.com> a écrit :
Philippe:

On Mon, Jun 3, 2019 at 11:40 AM Philippe Verdy <verdy_p@wanadoo.fr> wrote:
>> As soon as PUC puts that "normal execution" stuff in the manual, ok. I
>> now the finalizer can run at anytime AFTER it becomes inaccesible, I
>> DO NOT assume it runs promptly. But, knowing the finalizers are NOT
>> run while the object is accesible is needed to me.

> That's probably because  your varaible acts only as a proxy for a remote object which has an external lifetime or state (and you use the finalizer with an explict call to the garbage collector to close the remote session): your design is bogous if your program does not handle it with a session;

No remote object, and I think you are grossly overunqualified for
asserting my desing is bogus. In fact just this assertion proves it,
IMO.

Why would I make an explicit call to the garbage collector to use the
finalizer? I'm old enough to be able to call it directly.

What's a session? ( trying to put fancy concepts here ? nice try, no cigar )

Just to make it easier to you, no out-of-process objects involved in
those designs.

> your variable should then be an object that has a reference from a session object. Using finalizers for this is bad, especially in Lua. Please use a session object and control that session explicitly with a separate variable.

That's a whole new level. Shouldn't I also use three magic unicorns,
half a cup of pixie dust and a flux capacitor or two?
World is bigger than the set of programs you have made, you are old
enough know that.


Francisco Olarte.