Talk:First class environments: Difference between revisions

Content added Content deleted
(Link to article)
No edit summary
Line 15: Line 15:
:::: This is interesting. In some languages variable names are really just dictionaries, such as Perl package variables or "named variables" in PostScript. This fact may be used both for and against having this task, but personally I think the task is worthwhile, even if only to show how each language handles name lookups. --[[User:Ledrug|Ledrug]] 22:34, 1 July 2011 (UTC)
:::: This is interesting. In some languages variable names are really just dictionaries, such as Perl package variables or "named variables" in PostScript. This fact may be used both for and against having this task, but personally I think the task is worthwhile, even if only to show how each language handles name lookups. --[[User:Ledrug|Ledrug]] 22:34, 1 July 2011 (UTC)
:Perhaps this article helps to explain the issue? http://picolisp.com/5000/!wiki?firstClassEnvironments --[[User:Abu|Abu]] 07:22, 9 June 2012 (UTC)
:Perhaps this article helps to explain the issue? http://picolisp.com/5000/!wiki?firstClassEnvironments --[[User:Abu|Abu]] 07:22, 9 June 2012 (UTC)
:: Unless we are saying that we want to implement picolisp for this task, basically that page just seems to be saying that we want distinct sets of symbols, where the same names can resolve to different values depending on which set we are using. That's a "first class environment" in the context of the page you refer to, but a dictionary accomplishes the same thing, as does an object (though, depending on the language, a dictionary or an object might use different syntax). There can be *subtle* syntactic issues between otherwise similar constructs. But those are not relevant here, because subtle syntactic issues are language specific. --[[User:Rdm|Rdm]] 13:17, 9 June 2012 (UTC)
Concerning the question whether the C solution "fits the spirit": I would say yes, though instead of switching the pointers to 'sec' and 'cnt' I would save and restore the actual values. This would better simulate the "binding" of the "environments".--[[User:Abu|Abu]] 15:17, 30 June 2011 (UTC)
Concerning the question whether the C solution "fits the spirit": I would say yes, though instead of switching the pointers to 'sec' and 'cnt' I would save and restore the actual values. This would better simulate the "binding" of the "environments".--[[User:Abu|Abu]] 15:17, 30 June 2011 (UTC)
: Well, that's quite a bit more work. Right now I can just swap the links (addresses) and forget about it (which is in a sense more "real"), if I copy values, I'd have to copy them back after each job switch, can't exit job control loop whenever I want, etc. The way I look at it, just pretend the "*" is a special marker for environment variables. In the worst case, the job function itself can copy and restore them to stack if really needed. --[[User:Ledrug|Ledrug]] 16:40, 30 June 2011 (UTC)
: Well, that's quite a bit more work. Right now I can just swap the links (addresses) and forget about it (which is in a sense more "real"), if I copy values, I'd have to copy them back after each job switch, can't exit job control loop whenever I want, etc. The way I look at it, just pretend the "*" is a special marker for environment variables. In the worst case, the job function itself can copy and restore them to stack if really needed. --[[User:Ledrug|Ledrug]] 16:40, 30 June 2011 (UTC)