all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: [OT] What langauges have symbols?
Date: Fri, 30 Jun 2017 12:15:09 +0700	[thread overview]
Message-ID: <CAP_d_8X1frYNcgpdK7A2TzBfmzvBW0NMuSSbDdTgXNoks2dW4Q@mail.gmail.com> (raw)
In-Reply-To: <87efu2w1ak.fsf@jane>

On Fri, Jun 30, 2017 at 11:24 AM, Marcin Borkowski <mbork@mbork.pl> wrote:

> What langauges besides Lisps have "symbols"?  And I not only mean the
> name, of course, but also the properties.  For instance, ES6 seems to
> have something similar, but it seems to me that you can't have
> a variable containing a symbol and say something like
> (set var val)
> where val is assigned to a variable whose name is the value of var
> (i.e., that symbol).

You can, kind of.

In Javascript (also known as ECMAScript), there are no global
variables. They are emulated as properties of the global object. The
global object in web browsers is ‘window’.

All objects support setting properties by statically known name:

    window.bar = "baz";
    console.log(bar);  // prints “baz”

or dynamically:

    function foo() { return "bar"; }
    window[foo()] = "baz";
    console.log(bar);  // prints “baz”

So, in Javascript, for purposes of setting a variable by computed
name, the closest idea to Lisp’s symbols is a string.

I cannot recall any language other than Lisp that has symbols in the
sense of literal values which are distinct from every other value.



  reply	other threads:[~2017-06-30  5:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30  4:24 [OT] What langauges have symbols? Marcin Borkowski
2017-06-30  5:15 ` Yuri Khan [this message]
2017-06-30  6:10 ` Eli Zaretskii
2017-07-01  0:59 ` Danny YUE
2017-07-01  3:11   ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8X1frYNcgpdK7A2TzBfmzvBW0NMuSSbDdTgXNoks2dW4Q@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=mbork@mbork.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.