Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Values and objects Date: Sun, 11 May 2014 18:10:16 +0300 Organization: A noiseless patient Spider Lines: 36 Message-ID: <87eh00s65j.fsf@elektro.pacujo.net> References: <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com> <87zjiqbmy5.fsf@elektro.pacujo.net> <536d7a7d$0$29980$c3e8da3$5496439d@news.astraweb.com> <9cc0ebf9-dbed-4d3d-91fc-2abb9b0103d0@googlegroups.com> <536dc3f7$0$29980$c3e8da3$5496439d@news.astraweb.com> <536decca$0$29980$c3e8da3$5496439d@news.astraweb.com> <536E799D.6080602@stoneleaf.us> <536eebc1$0$29980$c3e8da3$5496439d@news.astraweb.com> <536f069b$0$29980$c3e8da3$5496439d@news.astraweb.com> <3fb2d95e-2fb6-43a5-a725-c6d38444b80c@googlegroups.com> <87ppjksum0.fsf@elektro.pacujo.net> <9d950f96-3457-4c13-b9e2-8e4e1b20cd54@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx05.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="6678"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hjo0rtqnbsm+s0MmWRUtj" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:IXSQ5zNXbfPCVw4qRi8UbQVkZJ8= sha1:GnKFHadPEQ6NtXwjU+zUx3V3Ckc= Xref: csiph.com comp.lang.python:71320 Rustom Mody : > On Sunday, May 11, 2014 11:51:59 AM UTC+5:30, Marko Rauhamaa wrote: >> Lisp variables (symbols) are on an equal footing with other objects. >> IOW, lisp variables are objects in the heap. > > But is a symbol a variable?? Yes. A classic lisp symbol is even more "variable" than most other variables! It can hold *two* values. One is called a value binding and the other one the function binding. Scheme has unified the two; scheme symbols have only one value binding, which can be a function. > Sure, by providing a data-structure symbol, lisp provides one of the > key building blocks for developing language processing systems. > > However I would argue that a variable is not a merely a symbol > (identifier in more usual programming language-speak) but a relation > between identifiers/symbols and some 'rhs' The lisp symbol really is a data object with several fields: I can think of name, value, function and properties. They can be accessed with accessor functions. (Interestingly, scheme doesn't have the 'symbol-value accessor function of lisp's.) If lisp didn't have a way to rebind symbols (i.e., if it were purely functional and had no side effects), they wouldn't be so much variables as substitution spots in the code. > For an (interpreted?) language like python, rhs is naturally > value/object For a C like language it is memory. Symbols in lisp are memory slots, conceptually and physically. Marko