function overload on full signature?
Rob T
rob at ucora.com
Thu Nov 15 19:01:23 PST 2012
On Friday, 16 November 2012 at 01:02:59 UTC, Jonathan M Davis
wrote:
> On Thursday, November 15, 2012 17:18:43 foobar wrote:
>> I thought that Haskell doesn't have function overloading (which
>> simplifies this greatly)... Anyway, I mostly meant "standard"
>> imperative/OO languages. Sorry for the confusion.
>
> It has pattern matching (which typically results in several of
> the same
> function with slightly different arguments, but the overall
> types are still the
> same). I'm unaware of it having full-on function overloading.
> But I don't
> think that I've ever tried it.
>
> - Jonathan M Davis
This article describes return type overloading in Haskell by way
of a clear example. It concludes demonstrating a real-world
implementation of the concept.
http://matthewmanela.com/blog/return-type-overloading-in-haskell/
I'm not well versed in Haskell (first look ever), so I'm not
sure, but it does seem to look like true return type overloading.
I also read an article that described Perl's overloading on
return type, but this is less like the overloading we've been
talking about, and more like a function being able to inspect the
call context to decide what type should be returned.
--rt
More information about the Digitalmars-d
mailing list