While this might seem like a "convenient" feature, I'm worried about
the consequences for Guile as a language.
For some procedures and some types it is natural to have polymorphism.
I wouldn't argue that we should introduce `integer-+' and `inexact-+'.
But for the mojority of cases I see a number of bad properties of
polymorphic scheme procedures:
* They diminish the readability of code. (Seeing `string-append' in
the code should give you the cue that the arguments are strings.)
* They make it harder to detect certain kinds of bugs. (If
`string-append' protests when given a symbol, evaluation may stop
before using the symbol in another context where it is more
difficult to see the cause of the bug.)
* They make the Guile language harder to port to other platforms.
* They make it harder to automatically translate Guile code to
portable Scheme code suitable for other platforms.
* They make it harder to compile to efficient code.
* They make the interpreter slower (this may not be a real point in
other slower interpreters, but in interpreters such as Guile and
SCM, several extra conditionals may matter).
I'm especially against using polymorphism when it jeopardizes
portability:
For example, in Guile there is a concept of "read-only strings". Both
symbols and ordinary strings can be regarded as read-only strings. In
Guile, most procedures that take a string as an argument and doesn't
alter it can take any read-only string. This means that the following
expression is perfectly correct in Guile:
(string-append 'hotch 'potch) --> "hotchpotch"
What I dislike about this is that `string-append' has been
standardized in R4RS only to take strings as arguments. It has been
said previously that Guile should be R4RS compatible. For me, this
not only means that we should supply all functionality of R4RS. It
also means that R4RS procedures shouldn't have more functionality than
specified in R4RS. This enforces portability.
What will certainly happen otherwise is that people start to code
using this extra functionality while still believeing that they're
writing portable code, or, that other people discover Guile code which
doesn't use special features and assume that they can move it to
another interpreter because Guile is "R4RS compatible".
I suggest that we
1. remove all extra functionality from all R4RS procedures, and,
2. look over all other polymorphic procedures and see if the
polymorphism can't be avoided except for a few special cases.
/mdj