TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Some special cases of method dispatch in Julia

30 pointsby 2pEXgD0fZ5cFabout 3 years ago

3 comments

arksingradabout 3 years ago
Dispatch ambiguity can really bite you, particularly if you start extending methods from other packages. An issue I often run into at the same time as method ambiguity is a stack overflow from self-calling constructors. If you try to define an outer constructor with default arguments, it&#x27;s really easy to end up just calling that constructor from itself.<p>The metaprogramming trick for defining a set of methods at once is useful, but I wish there were a more compiler-level solution to sorting out ambiguities or determining what&#x27;s more &quot;specialized&quot;.<p>These don&#x27;t really color my view on multiple dispatch, however. I find it to be a really useful tool and I don&#x27;t run into dispatch issues very frequently. If you&#x27;re meticulous about your typing it&#x27;s usually easy to avoid these pitfalls, but sometimes they still crop up.
skybrianabout 3 years ago
I wonder if there is some principled way of making Julia-style method dispatch statically checkable?
评论 #31261963 未加载
recursivedoubtsabout 3 years ago
method overloading is a horrible language feature that papers over the absence of other, more useful language features like optional arguments, etc.<p>i worked on a JVM programming language back in the day, and that damned feature screwed up <i>everything</i>: method resolution was obviously a pain, but it got involved in generics, class compatibility, it even ends up worming its way into bytecode, since methods <i>names</i> are really the <i>name</i> plus the fully qualified type name of every argument (even if there <i>isn&#x27;t</i> any method overloading for a given method, just awful)<p>i wrote an old blog post on this:<p><a href="https:&#x2F;&#x2F;guidewiredevelopment.wordpress.com&#x2F;2009&#x2F;05&#x2F;22&#x2F;i-am-hate-method-overloading-and-so-can-you&#x2F;" rel="nofollow">https:&#x2F;&#x2F;guidewiredevelopment.wordpress.com&#x2F;2009&#x2F;05&#x2F;22&#x2F;i-am-h...</a><p>in conclusion: things should have unique names
评论 #31261081 未加载
评论 #31262225 未加载
评论 #31276759 未加载
评论 #31279979 未加载
评论 #31260935 未加载