Skip to content

A Go implementation of JavaScript style symbols (atoms).

License

Notifications You must be signed in to change notification settings

ckaznocha/symbol

Repository files navigation

symbol

Build Status Coverage Status License GoDoc Go Report Card

-- import "github.com/ckaznocha/symbol"

A Go implementation of JavaScript style symbols (atoms).

For more info see the example files and the GoDoc page.

Usage

func KeyFor

func KeyFor(sym Symbol) (string, bool)

KeyFor retrieves a shared symbol key from the global symbol registry for the given symbol. Returns the key and true if found, otherwise an empty string and false.

type Symbol

type Symbol struct {}

A Symbol is a unique and immutable data type.

func For

func For(key string) Symbol

For searches for existing symbols in a runtime-wide symbol registry with the given key and returns it if found. Otherwise a new symbol gets created in the global symbol registry with this key.

func New

func New(description string) Symbol

New creates a new unique symbol. Description is a string which is useful for debugging but not to access the symbol itself.

func (Symbol) String

func (s Symbol) String() string

String method returns a string representing the specified Symbol.

Contributing

See the CONTRIBUTING file.

License

See LICENSE file

About

A Go implementation of JavaScript style symbols (atoms).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages