To add clarity, strings are a little in the gray area.
If you're using a language like Go, if we disregard the built-in string type, they may be an array, or they may be a struct type, or they may be a wrapper type for an array, which would be an array of numbers, say int16 or int32.
Of course, to be fair, we should consider the built in type - though, how it's built is dependent on the language.
In Java, it's definitely an object, both in the Object sense, and the sense that they are the result of a data structure.
@baenencalin
Hey man! I get you now. I am not sure about all the other languages but what I can say is that its indeed a choice made by the langauge itself. I mean how a langauge defines primitives and objects is completely upto the language. We do have an article of faith on the universal notion though.
I thought primitives did have a definite definition ("The least abstract(ed) type in a given language. - Usually that who's implementation is the most bare-bones (compared to other types) when looking at the source code for a given language.")?
This is an outdated view. I realized not every language is quite like how I described.
Anyway, I never claimed chars were an object (even if they weren't listed as one ov the things that isn't an object); on the note ov arrays and strings, however, I don't consider arrays an object because they're usually just a consecutive arrangement ov data (in C it's literally just a pointer to said arrangement).
I hope this answered your questions thoroughly; feel free to write back if you have any more questions.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Jokes on you, since everything except numbers and arrays are objects in every language! >:)(I don't meanObject
object, I mean "object" as in a container, like the result of a constructed struct, union, or class.)(This was only partially relevant.)@baenencalin Didn't get you man! In JavaScript, arrays infact are objects :)
To add clarity, strings are a little in the gray area.
If you're using a language like Go, if we disregard the built-in string type, they may be an array, or they may be a struct type, or they may be a wrapper type for an array, which would be an array of numbers, say
int16
orint32
.Of course, to be fair, we should consider the built in type - though, how it's built is dependent on the language.
In Java, it's definitely an object, both in the
Object
sense, and the sense that they are the result of a data structure.What I'm saying in most languages, like C, Go, C++, etc..
Everything except arrays and numbers are objects.
(I guess this isn't necessarily true for JS.)
@baenencalin Hey man! I get you now. I am not sure about all the other languages but what I can say is that its indeed a choice made by the langauge itself. I mean how a langauge defines primitives and objects is completely upto the language. We do have an article of faith on the universal notion though.
I thought primitives did have a definite definition ("The least abstract(ed) type in a given language. - Usually that who's implementation is the most bare-bones (compared to other types) when looking at the source code for a given language.")?
To explain how I think about an object, this is what I think of an object as:
How is a "char" in C an object? And how is a string an object but an array isn't an object?
This is an outdated view. I realized not every language is quite like how I described.
Anyway, I never claimed
char
s were an object (even if they weren't listed as one ov the things that isn't an object); on the note ov arrays and strings, however, I don't consider arrays an object because they're usually just a consecutive arrangement ov data (in C it's literally just a pointer to said arrangement).I hope this answered your questions thoroughly; feel free to write back if you have any more questions.