On Sun, 26 Aug 2012 16:22:05 +1000, Chris Angelico wrote: > On Sun, Aug 26, 2012 at 3:45 PM, Evan Driscoll <drisc...@cs.wisc.edu> > wrote: >> Third, and more wackily, you could technically create a C >> implementation that works like Python, where it stores variables (whose >> addresses aren't taken) in a dict keyed by name, and generates code >> that on a variable access looks up the value by accessing that dict >> using the name of the variable. > > That would be a reasonable way to build a C interactive interpreter.
No it wouldn't. Without fixed addresses, the language wouldn't be able to implement pointers. C without pointers isn't C, it is something else. Possibly called Python :) I suppose you could get pointers in Namespace-C if you somehow mapped names to addresses, and vice versa, but why would you do that? You end up with a hybrid system that doesn't give you any advantage over C but has a much more complicated implementation (and therefore many more new and exciting bugs). But if you want me to agree that you could implement C using name binding, plus some weird scheme to track memory addresses, then yes, I suppose you could. Then the parts of C that don't rely on fixed memory addresses could use the name bindings (with the corresponding loss of performance), and the parts of C which do require them could continue to do so, and we'll have one more language with a confusing, unclear and unclean execution model. Everybody wins! For some definition of win. -- Steven -- http://mail.python.org/mailman/listinfo/python-list