Sometimes I need to express the abstraction of anything that can be declared. For example, in C, they'd be:

  • functions
  • classes
  • variables
  • constants

in Ruby, they'd be:

  • modules
  • classes
  • variables
  • constants

Is there a term for this? Is it "symbol"?

Or, is it "data structure" correct (in particular, considering functions)?

  • 2
    If you can't event list all the things, how do you expect anyone to know the group of exactly which things you're trying to label? – Flater Nov 18 at 12:22
  • Functions are not data structures in all languages, but are in some. Concepts aren't data structures in any language I can think of, and aren't declared in most. Declaration is itself a matter of language grammar, so that also depends on language. Literals may be constants that don't have an associated symbol. You're really going to have to be more specific. – Useless Nov 18 at 13:05
  • Updated to be more specific, but doesn't change much. – Marcus Nov 18 at 13:44
  • 1
    There is no industry accepted term for this. The closest I can think of is identifier. – Greg Burghardt Nov 18 at 14:28
  • Since there's no universally accepted term, you'll have to invent one ("language element", "language construct", "declarable") and then attach to it a short explanation when you introduce it, much like you've done here (you provided a few examples). So first you define what you mean, and then you use that term, with the meaning you specified, consistently throughout your article, talk, or whatever. It's better to find some term that doesn't already carry a specific connotation (e.g. with "data structure", you'd have to fight against people's initial assumption that this excludes functions). – Filip Milovanović Nov 18 at 17:53

The term first-class or first-class citizen refers to things that can be declared and/or treated generally in the language, i.e. with most of the possible constructs of the language.

A language that supports first-class functions allows for function variables, which include function parameters, aka functions that are parameterized (to take) functions as parameters.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.