Olin Lathrop wrote: > Gerhard Fiedler wrote: >>> I'd rather write >>> >>> strb <-- stra + stru + " more stuff" >>> >>> than >>> >>> strb <-- StringConcatenate(stra, stru, " more stuff"); >> >> So do I, but I fail to understand why this requires that the string >> handling is built into the compiler. >> >> Your preferred syntax looks (in principle) quite similar to the C++ >> std::string syntax, where normal string handling is implemented in a >> standard library. > > First, that only works when a language allows user defined operators > like C++ does, but most other compiled languages don't. We're not talking here about specific features of specific languages, but about what's exactly the difference of e.g. a string implementation being built into the compiler or implemented in a standard library -- focus on /standard/ library (which means that the string behavior is in both cases defined by the same language standard). (In any case, allowing user-defined operators has a tremendous advantage -- no matter whether the original operator is implemented by the compiler or by a standard library. But this is somewhat besides the point here.) > Even then, the compiler only knows that some library routine has to be > called to perform whatever the operation is. It doesn't know it's > string concatenation and therefore doesn't know as much about the > intent of the statement as it would if it was built in. Yes, it does. In C++, for example, the commonly used string implementation is std::string. I can define my own std::string class (using Pascal-style strings, for example), and the compiler can (and should) assume that whatever is defined in the standard is true. If the standard defines the operator '+' to be concatenation, this is what it is -- built-in, compiler-vendor-supplied library, or custom implementation. The key here is "/standard/ library", as in "library with an interface that's defined in the language standard, just like all the other language elements". Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist