<p dir="auto">One limitation of the functional approach is discoverability: which functions can be applied to a given type? This is not necessary however: We (should) know all the functions which take an object of given type as first argument. This leads to the possibility of code completion:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="abstract type Animal end
struct Cat &lt;: Animal end
struct Fish &lt;: Animal end
swims(Cat)=false 
swims(Fish)=true
pussy=Cat()
pussy.swims() # &lt;--- NEW syntax, same as swims(pussy), but discoverable via &lt;tab&gt;"><pre class="notranslate"><code class="notranslate">abstract type Animal end
struct Cat &lt;: Animal end
struct Fish &lt;: Animal end
swims(Cat)=false 
swims(Fish)=true
pussy=Cat()
pussy.swims() # &lt;--- NEW syntax, same as swims(pussy), but discoverable via &lt;tab&gt;
</code></pre></div>
<p dir="auto">The important point is that it doesn't change the fundamentals of the language at all**, it's just syntactic sugar with the huge benefit of discoverability in the REPL. It might also hugely increase adoption.</p>
<p dir="auto">Corollary: An inverse 'methods' function which lists all the methods for a given type (can be huge).</p>
<p dir="auto">(** I've read <a href="https://discourse.julialang.org/t/psa-julia-is-not-at-that-stage-of-development-anymore/44872" rel="nofollow">https://discourse.julialang.org/t/psa-julia-is-not-at-that-stage-of-development-anymore/44872</a> )</p>
<p dir="auto">Since Julia is struct oriented, this could be a nice way make the language more ergonomic for methods<br>
<a href="https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax" rel="nofollow">https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax</a></p>
<p dir="auto">Assume</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct Blah
    ...
end

foo(b::Blah,i::Int32)
      ...
end

b = Blah(..)"><pre class="notranslate"><span class="pl-k">struct</span> Blah
    <span class="pl-k">...</span>
<span class="pl-k">end</span>

<span class="pl-c1">foo</span>(b<span class="pl-k">::</span><span class="pl-c1">Blah</span>,i<span class="pl-k">::</span><span class="pl-c1">Int32</span>)
      <span class="pl-k">...</span>
<span class="pl-k">end</span>

b <span class="pl-k">=</span> <span class="pl-c1">Blah</span>(<span class="pl-k">..</span>)</pre></div>
<p dir="auto">In addition to this syntax</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="foo(b,123)"><pre class="notranslate"><code class="notranslate">foo(b,123)
</code></pre></div>
<p dir="auto">this would also be acceptable if a function signature existed with Blah as first parameter type</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="b.foo(123)"><pre class="notranslate">b<span class="pl-k">.</span><span class="pl-c1">foo</span>(<span class="pl-c1">123</span>)</pre></div>
<p dir="auto">Edited: fixed function name to be idiomatic</p>