Talk:First class environments: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 19:
::::Is the following more clear? While you can simply execute 'print(x,y)' after setting an environment, you have to call (in pseudo-code) 'print(get(dict,x), get(dict,y))' for a dictionary, and 'print(object->x, object->y)' for an object. In both cases, you still carry an explicit binding around with you, either the dictionary 'dict' or the object. --[[User:Abu|Abu]] 16:18, 9 June 2012 (UTC)
::::: Except "binding a variable" may be exactly what a dictionary does *depending on the language you are working in*. The distinction between "binding a variable" and "associating a name with a value" is not one that is meaningful across languages. It's only a distinction when you have specific implementations of "binding" and "associating" which you are trying to distinguish between. For that matter, the distinction between a "variable" and a "name" is also a language-specific issue (and sometimes a context-dependent issue within a language). For that matter, '''x''' is not a valid variable name in some languages (perl is a good example for that). Also, even in picolisp you can take an expression and modify it so that what originally looked like a variable reference is turned into an appropriate dictionary reference. Also, the distinction between "first class" and "not first class" is itself language specific and context specific -- "first class" is typically shorthand for "simple to use" but that's a subjective and comparative and context dependent issue. It can be quite meaningful in a narrow context but it loses a lot when you try to treat it like it's something generic. --[[User:Rdm|Rdm]] 16:52, 9 June 2012 (UTC)
:::::: That said, if you will allow that in some languages "dictionary" and "first class environment" are identical things, it is true that there's a meaningful distinction between them in some other languages. --[[User:Rdm|Rdm]] 16:55, 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)
: 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)
6,962

edits