In a programming language, are primitive types always first-class citizens?

Asked

Viewed 52 times

2

Is it correct to state that every primitive type is a first-class citizen in a programming language? If not, for what reason? This may vary from language to language?

  • 1

    What does "citizens" mean? I’ve never heard that term before in programming.

  • 1

    @Articuno, here a reference.

  • 1

    @Articuno another

  • 1

    It is not easy to answer this, it is a little ambiguous. I think the type is not, the value yes, but there are controversies.

  • @bigown In Ruby, for example, "everything is an object". You can call a method directly from number 10, for example (10.to_s). It is difficult to know what is not a first-class citizen in this language according to the definitions you have around.

  • 1

    That’s not true, that’s language marketing, there’s a lot of stuff in it that’s not object :) That you’ve essentially shown any language can. Even if you say that all values are objects, this can be said of all languages. It lacks better definition. Then language can give a definition that only meets your interest, so it gets complicated.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.