Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
effn
15y ago
0 comments
Save
Share
Overloading on return type is fundamentally impossible in dynamic languages, since they dispatch on values, and the return value can not be known before the function is called.
0 comments
4 comments · 2 top-level
top
newest
oldest
shasta
15y ago
· 2 in thread
Well it's not
impossible
. You could run them all and then decide which result to use. :)
effn
OP
15y ago
That doesn't work either, since then you will have more than one result. Which one will you dispatch on?
shasta
15y ago
Presumably, you'll have some rules that determine which is the best match and then error if it's ambiguous - just like the static case
bad_user
15y ago
Oh come on, all you need to do is to (OPTIONALLY) tag the function with the return type.
And it's still a dynamic type system ;)
j
/
k
navigate · click thread line to collapse