2012-07-03

value or symbol literals

6.21:  adda/lexicon/$symbol can indicate
literal symbol just like quotes mean literal string:
[7.2:
. there are 3 categories of symbols:
# names composed of digits are literal values of type number;
# names preceded by double-quote are literal values of type character string;
# names preceded by single-quote are unevaled symbols
(references to a symbol that was previously declared);
# names preceded by ($)  are declaring literal values of type symbol;
(it's not a variable or constant representing some other value).
. in english we would tend to put a word in quotes to mean this,
but in a programming language, we want to reserve quotes for
values of type character string .
. this use for $ was first mentioned as
a namespace for value literals .]

1 comment:

  1. 2.22: sci.adda/syntax/minimizing explicit literals:
    . in lists or point sets of symbols,
    the quotes should be avoided .
    . if you mean a var, use paren's ?
    but doesn't that give special meaning to paren's?
    . you want a simple lang;
    the main problem is how to know when
    a symbol is defined as a local ?
    one way is to type unspecified :
    { red.: stop., }.
    . is there some way to know when a list won't need var's ?
    that would be part of the rule where
    types define their own literals .
    2.29:
    . but how do they define their own literals?
    in the interface, there is an implicit values property,
    that is defined by the existence of a set;
    anything you put in that set is assumed to be value literals .
    . likewise an enum type looks like this:
    x.type: { ... }
    -- when the types' value is a set,
    that implies the set member's are the type's value literals .
    . values don't have to be quoted because
    you're expected to not clash the names of your locals
    with the names of any value literals you plan to use .
    . however, if everything is strongly typed,
    then a lot of overloading will be tolerated .

    ReplyDelete