On Thu, Jun 9, 2022 at 4:07 PM Elijah Stone <elro...@elronnd.net> wrote:
> On Thu, 9 Jun 2022, Raul Miller wrote:
> > when [local variables] can be accessed, they can be updated.
>
> Updating locals is a local transformation, not global, in which respect they 
> can be seen as syntax sugar.

That seems like a moot point, when we can expose our code to global
transformations.

> > Perhaps this distinction is best illustrated by considering memory mapped 
> > files -- here, J bends its rules, mapping J values onto OS managed storage.
>
> ... But what you are observing here is a change in the data pointed to by the 
> variable, not in the variable itself.

I do not understand the distinction you are drawing here: what would
"a change in the variable" which is not "a change in the data pointed
to by the variable" look like?

> (In languages with closures, local variables really are mutable.)

I suspect, here, you are trying to say something about scope.

> > When things are not working right, how does the developer inspect values 
> > stored in thread-local names in the suspended thread (or task-local names 
> > in the suspended task)?
>
> T.n to thread number n while debugging.  Presumably that also gets you access 
> to n's task-locals.

Fair enough.

> > That said, I am getting the feeling that we ought to adopt the "use case" 
> > discipline here. Presumably you have in mind some useful model of how this 
> > would be used -- coroutines or whatever. And, I think, those sorts of 
> > examples should be made explicit, so that we can better understand them.
>
> Sure.  I don't have a particular use-case in mind, for myself, at the moment. 
>  But consider jd: it uses global variables to pass around state.  And I know 
> Eric said he wants to parallelise it (at least for queries).  Changing those 
> variables to be thread-local would be a minimally invasive way of enabling 
> such a change.

Stuffing them in locales would also serve that end.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to