Skip to content
BENIBIX Learn

Symbol (Programming)

Development🕸️ Code IntelligenceCode Intelligence Basics

Also known as Code Symbol, Symbol Table, Identifier

A named thing in code, like a function or a class, that tools can find and track.

Think of it like

It is like a name tag. Each thing in the code wears one, so tools can find it.

Example

In a shop app, the function getPrice is a symbol. Its kind is function, and it is defined in prices.py on line 22.

Why it matters

Every jump, rename and search in a smart editor works on symbols. They are the nouns of a codebase.

Definition

A symbol is a named thing in code, such as a function, a class, a variable or a type. Each symbol has a name, a kind and a place where it is defined. Tools collect them into a list called a symbol table. Two symbols can share a name if they live in different files or scopes. Code intelligence tells them apart by where they are defined, not just by their name.
Symbols are pulled out of the syntax trees, each with its file and line.

Common mistake

Thinking two symbols with the same name are the same thing. A save function in two classes is two symbols.

Key takeaways

  1. 1
    Has a name. Like getPrice or User.
  2. 2
    Has a kind. Function, class, variable, type.
  3. 3
    Has a home. The file and line it lives on.