> What i mean by it would not have happened from
the begin is the
> following.
>
> define sealed method split
> (string :: <byte-string>, character :: <byte-character>,
> #key start :: <integer> = 0,
> end: _end :: <integer> = string.size,
> trim? :: <boolean> = #t)
>
> and:
>
> define function split
> (pattern :: <string>, input :: <string>,
> #key count = #f, remove-empty-items = #t, start
= 0, end: input-end =
> #f)
> => (#rest whole-bunch-of-strings :: <string>);
>
> have completely different typed arguments.
If the above functions don't implement the same "contract"
-- if they
do very different things even though they have similar
signatures --
then they really should be given separate names. It's
confusing to give
them the same name if they're *not* doing the same
thing.
If they *are* doing the same thing, but with different
argument types,
then they should just be methods in the same generic
function.
Generic functions represent "contracts" or
"interfaces", and methods
provide implementations of that contract for different
types of
arguments. Both of those should be "define method",
and then there
wouldn't be a naming conflict.
[Note that "define function" isn't even in
the language definition.
It's an extension that came along later, and it should
be used very
infrequently.]
> But in the context of Dylan this means every imported
function get a
> name binding during
> import. Since the names are same they would share
the same name in
the
> module where
> they are imported. There for i need to rename
one of the functions.
You can define methods for the same generic function
in separate
modules:
define method split( <byte-string>,
<byte-character> , ... );
can be in a completely different module -- and even
library -- from:
define method split( <string>, <string>,
... );
What you do is use module definitions to make sure
the generic function
"split" is visible in both locations where
the methods are defined, and
then they'll be defining methods on the same generic,
and there won't
be a naming conflict.
It's important to note that methods don't actually
have names; they
don't have bindings. It's generic functions that are
associated with
bindings. When you write "define method split
..." what you're really
doing is defining a method that is added to the generic
function named
"split". You are not defining a method named
"split".