3/29/2023 0 Comments Primitive notion definitionIf it was part of language core, it is primitive. That makes it an object so a String would not be a primitive.Īnswer you comment: It probably has to do with implementation of the variable. I think of primitive as variables that came originally with the language and not variables like String in C++ which you have to declare using the New keyword. These are not primitive because you had to define them first in order to used them.Ī_very_large_number_that_you_defined_yourselfĮdit with more explanation and addressing the comment For example you can define an object which store data or you can use struct in C to define you own variables. Non primitives are user defined variables or objects. It is provided as fundamental part of the language. Example in C language are int, float, char data types. Primitives are fundamental data types provided by the language itself. Because the string type is not in their specification, it's not a primitive datatype in Java, inspite of being a built-in type. Java specification clearly mentions the list of datatypes it considers to be primitive type. It's both basic as well as built-in in SNOBOL4. String type, in SNOBOL4 is considered primitive. ![]() In addition, many languages also provide a set of composite data types("string" type in Java).Ī basic datatype is a datatype which cannot be further broken down ("string" type can be made from "char", but char cannot be 'broken down' into any datatype (In most of Programming languages). In most programming languages, all basic data types are built-in. Most languages allow more complicated composite types to be recursively constructed starting from basic types.Ī built-in type is a data type for which the programming language provides built-in support. In computer science, primitive data type is either of the following:Ī basic type is a data type provided by a programming language as a basic building block. I came across some information and felt it would aid the other answers. For example, the notion of a "built-in" type is meaningless for a typeless language like BLISS. It's still a primitive or basic type in that it cannot be broken down into any simpler components, but since it's user-defined, it's not considered a "built-in" type.Īgain, these concepts are a little fuzzy, and it really depends on context. ![]() ![]() For example, you can derive a Latitude type from the built-in floating type, with the constraint that it can't take on values outside the range. Ada allows you to create new scalar types that have constraints on them. C's typedef facility allows you to create new type names for existing types. If you want to get really pedantic, though, you can distinguish between types that are "built-in" (those explicitly provided by the language definition) and types derived from the built-in types that are still "primitive" or "basic" in that they cannot be decomposed into simpler elements. Again, by the above definition, an atom is "primitive" in the sense that it cannot be decomposed into something simpler.Īs far as I'm concerned, the terms "primitive", "basic", and "built-in" are pretty much interchangeable. Then you have a language like old-school Lisp, where everything is either an atom or a list. From these basic types you can define new types - pointer types, array types, struct types, union types, etc. These are "primitive" in the sense that they cannot be decomposed into simpler components. For example, in languages like C and C++, you have a number of built-in scalar types - int, float, double, char, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |