#Does rust use the term primitive?

24 messages · Page 1 of 1 (latest)

latent tartan
#

I'm reading the "rust book" and it's making sense so far but one thing I noticed is that the book doesn't use the words primitive or non-primitive. Instead it uses "variable of known size" or "variable of unknown size". Is primitive not a term used by rustaceans?

tropic grove
#

primitive is used but it has nothing to do with the size

latent tartan
#

can you explain?

tropic grove
#

primitives are used for "native" types (sorry can't think of a better term to explain it ) like i32, u32, bool, etc which are defined directly in the compiler

latent tartan
#

So these types of variables are called primitives

#

Do you know why the rust book doesn't use the word?

latent tartan
tropic grove
#

i'm not sure why the book doesn't use the term

torn river
latent tartan
#

yeah I understand I was just wondering why the book doesn't use the term

golden kestrel
#

It's possibly just because the distinction doesn't have as much practical impact in rust as it does in some languages. Like, in Java, every non-primitive is heap allocated, whereas in rust the only thing that's special about primitives is that they're not defined as compositions of other things

pulsar siren
#

It doesn't use the terms often in the rest of the book but "primitive" is used in the book, in the Data Types section for example

pulsar siren
#

The historical perspective: in late 2015, just before print publication of the first ed book, the term primitive was briefly discussed to potentially be pejorative, and edited out in several places as a small part of a wider edit pass. Nowadays in the book, primitive is only used as the adjectival form, not as a noun.

north crag
pulsar siren
#

also to note that this thread defines primitive types as "types that can't be broken down into smaller pieces" but the Rust Book actually defines tuples and arrays as "primitive compound types", which is... not quite that.

north crag
#

Right, slices and arrays aren't atomic either

rough heath
north crag
#

Oh that reminds me, I think I can rip out all the doc(primitive) handling in rustdoc if I change libstd to document the re-exports instead

#

Oh wait I remember why this is all so complicated, libstd wants to override the core docs rather than appending 🤦

#

Never mind I am not doing any more product design for rustdoc I refuse

rough heath
#

show us on the doll where rustdoc has touched you

rough heath
#

we do thank you for all the sacrifice ferrisOwO