At 09:56 PM 8/16/02 +0100, you wrote:
Christopher Subich wrote:
I’m going to be sorry for continuing this, but “strings, lists, and
so on” aren’t fundamental data types! They cannot be natively
manipulated by the hardware, so any operation done on them ends up
generating calls to whatever library provides them.
Fundamental means “basic” and/or “essential”. I think you are focusing
on the “basic” part whereas I am focusing on the “essential” part. I’ve
never come across a project that didn’t need a string or a list.
Hardware support is not the issue.
Ah, but what happens if you need a string that behaves slightly differently
than the one that the language gives you?
The range and operation of the primitive data types are very well-defined
– I know of no language that doesn’t support addition on integers. On the
other hand, what operations should we support on strings? Concatenation,
case-change, encoding change, substring, subsequence,
replacement? Building too much into a non-primitive data type bloats the
code (because it has to contain methods that aren’t executed), building in
too little makes use of the datatype more difficult (because of homebuilt
wrappers) than building one of your own with exactly the operations you need.
Things like ‘strings’ and ‘lists’ are relatively abstract concepts, anyway
– they define certain things, but many properties (such as min/max length)
and required operations are undefined. You’re right in that the vast
majority of typical projects require either or both, but they’ll each have
slightly different requirements on the types, which may change the most
optimal implementation. A language that implements a string as a datatype
and says “This is the String you will be using” takes it upon itself to
meet everyone’s requirements of the string, possibly turning it into ‘Jack
of all trades, master of none’ – not optimal for any particular use but
usable in all.
On a side note, at what point do you draw the line of a type being
’essential’, and thus fundamental? Stacks/queues are common enough to be
essential for many projects – but then again so are hash tables, B-trees,
etc. For the people on this list, SDLSurfaces are essential data types –
at what point do we stop building things into the language?
Just my thoughts, anyway.