lua-users home
lua-l archive

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


Roberto:

On Tue, Jun 4, 2019 at 3:01 PM Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:

> My point is not that the behaviour could be changed without docummenting
> it clearly as a breaking change, but because I still don't see what we
> would be breaking.  Where does the documentation state that a value
> stored in a local variable cannot be collected after that local is dead
> (that is, not needed anymore)? Can you point me where (or how) does the
> documentation give this garantee?

I do not say you are going to change it. I just think it is usual to
interpret "accessible" ( 2.5 ) as "from the point a value is assigned
to a variable through the point at which either the variable value is
changed OR the end of the scope, whatever come first". I'm obviously
interpreting it wrong, but I'm used to interpret "SCOPE-START,
varieble=value ....anything not touching variable....SCOPE-END" as the
variable being accesible to the scope end. In lua that would be "do
(or function); local x=whatever; --anything not changing x; end" as x
being accesible. The optimization discussions have told me that is not
the correct way of thinking in lua.

It might be not "the language is changing under my feet" as much as
"the language use some definitions which I cannot correctly
understand". It's ok, it's my problem and I wil solve it.

> I, as one of the main authors of mentioned documentation, certainly
> never wanted to give the assurance you are reading there. So,
> if that assurance is really there, we would like to remove it,
> not because anything changed in 5.4, but because it should never
> be there in the first place. (In particular, we never think about
> that when implementing Lua. Things work that way just because it
> is simpler to implement.)

I assume it is simpler to implement, but, to me, it is also simple to
use and easy to get right definition. Specially on a language with
finalizers, that is to say, a language on which a variable becoming
collectable may have side effects. You do want to delimit the minimum
lifetime of a thing, store it in a local inside a scope. You want to
shorten it to allow better optimizations, narrow the scope to the
minimum. It is not going to be a practical issue for me in any normal
case, but I'll just have to avoid some things that surface in my code.
And all the languages ( where you have collectable / destructable
things ) I have used do it this way.

> (I know about "objects that are no longer accessible from Lua". But
> where is any assertion about the meaning of "accessible from"?)

You are right, it is not defined. But in 40 years I've read a lot of
language definitions, and it totally it caught me, and it is the first
time I've been caught by this usage of accessible on a language
description. Had it been phrased "no longer accessed from Lua" I would
just have thought it a little weird, but assume there was a good
reason for it and follow on. I'm used to the truth of a value being
accesible through a variable not depending on code which is strictly
after the test point. I mean:

do
   local a=something()
   ... whatever.
   -- something() result is either accesible or not here ( assuming
linear code, no goto or loop trickiness)
   ... more linear thingies.
end

With the new accessed definition, the accesibility is conditioned, if
I do not touch a again, it is not, if I have an a:doit() or similar
below, it's accesible. Even worst, if I have if whatever() then
a:doit() end it's conditionally accessible ( although this is
trivially solved by trivial definitions ). I do not remember ever
encountering this kind of usage for accessible. I would not have had a
problem with "no longer accessed", this form as a clear connotation of
"you have to look at all the code".

Also, I'm a native spanish speaker, in spanish "accesible" y
"accedido", may be "deja de ser accesible" "no vuelve a ser accedido"
whould be the translations have more or less these meanings. As Lua
comes from Brasil I also assumed, may be incorrectly,  the forms would
be similar in portuguese, so I did not have reason to infer it could
be some very different usage there ( like if the documentation came
from, say, a native japanese speaker ). I may be the only one, seem to
nearly be in the list at least, which interprets accessible this way,
but I fear I'm not.

Also, I do not thing you put it there to catch anyone, and I assume
you thought it was clear, and from what some people say it may be
clear to them.

Also, the discussion is over for me, it is ok as it is, I have already
totally solved any problem I may have had with it. Should you feel
neccessary for me to write any more things, or to clarify anything, I
will still reply to any message from you[r group].

Francisco Olarte.