On Saturday, May 10, 2014 8:03:28 AM UTC+5:30, Chris Angelico wrote: > > 2) Returning them. This is a lot more dodgy, owing to the > dangling-pointer issue, but as long as you accept that the reference > to a variable doesn't ensure its continued life, I suppose this might > be acceptable. Maybe. But it's pushing it. > > 3) Constructing at run-time. Really REALLY pushing it. You can malloc > and call that a "variable", but it's not a variable any more, it's > just a patch of memory. In fact, all this proves is that variables > represent patches of memory, and patches of memory are first-class. >
Not sure what the 'just' is emphasizing/delimiting. Consider: int i; int *pi; char *pc; pi = &i; pc = pi; If your 'just' were just (excuse pun!) then *pi would be identical to *pc -- just the same patch of memory > > Not liking the results here. You might just as well define that all > Python variables must be backed by a dictionary (it's just as true as > "all C variables must be backed by memory") and then define the > first-class-variable as a combination of a dict and a key. Yes this is the rub. C pointers are first-class but half-assed due to dangling pointers -- (Function returning address of an automatic variale etc) Likewise python's name-spaces go almost all the way to first-classing variables but not quite as Marko discovered when locals() looks like a dict, waddles like a dict but does not quack like a dict. -- https://mail.python.org/mailman/listinfo/python-list