Package symbols provides Lisp-style primitive symbol objects.



Package symbols provides Lisp-style primitive symbol objects.



This section is empty.


This section is empty.


This section is empty.


type Symbol

type Symbol struct {
	// contains filtered or unexported fields

A Symbol is an object uniquely identified by its name, which can be any string. If two symbols have equal names, the symbols themselves are also equal.

A Symbol takes longer to create than the equivalent string. But once they're created, comparing two Symbols for equality is faster than comparing strings.

A Symbol uses memory proportional to the size of its name. Note: once allocated, a Symbol is never freed, even if it becomes unreachable. Avoid allocating many large symbols.

Programs using symbols should typically store and pass them as values, not pointers. That is, symbol variables and struct fields should be of type symbols.Symbol, not *symbols.Symbol.

The zero value of Symbol is the symbol named "nil".

func Make

func Make(name string) Symbol

Make returns the symbol named name.

func (Symbol) String

func (s Symbol) String() string

String returns the name of s.

Source Files