On Sat, May 24, 2008 at 6:15 PM, Greg Ewing <[EMAIL PROTECTED]> wrote:
> But what if the result is being passed to another function
> whose argument type is "generic"? If there is more than
> one way of instantiating that function, it can easily
> become ambiguous.
>
> C++ disallows overloading a function based solely on the
> return type, probably because of the ambiguities it can
> lead to.
>
> Also, in Haskell I think it's always possible to deduce
> the return type of a function if you know the types of
> its arguments.

Actually, that's not quite true; for instance, the function "read" has type
  (Read a) => String -> a
which means that it can return any type such that Haskell knows how to
"read" it (parse it from a string):
Prelude> (read "3") :: Int
3
Prelude> (read "3") :: Double
3.0

Then a construction like
  show (read "x")
is ambiguous,  By default, ambiguous types like this default to type
Integer, but a particular module can specify a different default.

I could describe Haskell typing in a lot more detail, but I don't
really think it's likely to be relevant for Cython; more relevant
would be HaXe or the various soft typing systems for Scheme (where
"soft typing" means that you don't necessarily try to assign a precise
type to every expression, you just go "as precise as you can").

Carl
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to