
16 Aug 2007 10:11:24 +0100, Jon Fairbairn
snip my quote
I certainly wouldn't count such a thing as a valid solution. It's always amazed me that C uses as standard a mechanism of ending strings that is so obviously an error-prone hack.
I'm completely with you on that ! Which is why I don't like the suggestion of doing it only for Char...
Well, it isn't "impossible" but quite hard (and not even standard H98 if I'm not mistaken)
If it is possible, I'm very sad that we've allowed things to get into the language that make that kind of reasoning faulty.
I spoke too fast on this one, it _is_ impossible (I think ?), but you can use the same trick as for Char to get a polymorphic function, arguably a little bit more useful than the Char one, since if you have a undefined as the last element of your list, there's a good chance anyway that your program is already in a bad state. Still it's an ugly hack altogether... Your suggestion is of course the right answer if there is an obligation to use a foldr and not just any fold. -- Jedaï