News for hackers. Stuff that matters.
Re:What is a primitive? by gigjbfjv on Thursday August 05, 2021 @08:24PM (#28081815)
Are you saying that you consider strings in Haskell to be a primitive?
Re:What is a primitive? by armchairhacker on Thursday August 05, 2021 @08:36PM (#28081896)
No, Haskell is weird since a string is [Char]. If it was it’s own value, yes.

The languages i’ve written are pretty basic. e.g. the data types might be

- Number - String - True, false, null - Array of values - Record of fields (key + value) - Variant of options (key + value)

So the distinction is clearer.

Re:What is a primitive? by masklinn on Friday August 06, 2021 @12:46AM (#28083410)
> No, Haskell is weird since a string is [Char].

I can think of various langages where string is not a built-in, but i can’t think of a langage where string is not some sort of sequence, not just in its implementation but in its interface.

The definition also breaks down quickly e.g. is a complex a primitive? If not because they have real and imaginary parts, why are floats which have a mantissa and an exponent? And what about functions? What even is a child? Are value-less sum types primitives but valued ones not?

More importantly, how does it matter? What does the distinction you draw provide that is useful?