News for hackers. Stuff that matters.
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by make3 on Wednesday January 23, 2019 @09:16AM (#18978246)
I personally don't like the fact that you have structs but no classes and no instance methods, but I know this is personal and don't want to start a religious war this morning
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by SiempreViernes on Wednesday January 23, 2019 @09:39AM (#18978439)
Don't worry, someone started a war over the 1-indexing so you likely won't get enough attention that it counts as a war :)
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by pjmlp on Wednesday January 23, 2019 @09:21AM (#18978282)
Multi-methods are much more powerfull than instance methods, but yeah lets agree to disagree. :)
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by yellowapple on Wednesday January 23, 2019 @04:31PM (#18983216)
I feel like they're a significant departure from the OO concept of sending a message to an object (for example, "Foo ! bar()" in Erlang or "Foo.bar()" in a more typical OO language would be interpreted as "send message bar() to object/actor/whatever Foo"). Julia's approach is more "call this function on this object", which is indeed perfectly useful, but is semantically different.
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by pjmlp on Thursday January 24, 2019 @02:54AM (#18986782)
That OO concept is pretty much Simula specific, Lisp languages got influenced by the work done in LOOP and Flavours which lead to the design of CLOS, the origin of multi-methods idea.

Building on top of your remark, Julia's approach is more "call the visible implementation of this function that better matches the types of all given parameters".

And these are only two possible ways of doing OOP, there are a few other ways of approaching the ideas of writing extensible modular code with polyphormism.

Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by yellowapple on Thursday January 24, 2019 @01:33PM (#18991467)
That OO concept is also what Alan Kay et. al. were envisioning when they coined the term "object-oriented". It's all about message passing between blackboxed instances with isolated/private states. Multi-methods and such are cool and useful, but they're kinda secondary to that core concept (which Julia doesn't really have, to my knowledge at least).

In other words: object orientation != strong typing (even if they do tend to go hand-in-hand).

Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by pjmlp on Friday January 25, 2019 @03:23AM (#18996393)
I never said that object orientation == strong typing, rather that Smalltalk/Simula OOP isn't the only way of doing OOP.

CLOS, Beta, SELF, Oberon (the first version), Component Pascal all have explored different ways of doing OOP.

Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by veddox on Wednesday January 23, 2019 @10:20AM (#18978837)
Sorry to continue, but could you elaborate on that? I understand both concepts, but not their relative merits...
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by pjmlp on Wednesday January 23, 2019 @02:09PM (#18981531)
Instance methods are bound to a specific object definition, thus they can only be applied to instances of that specific object or its descendants.

Also in static languages, the set of available instance is closed and extending it requires approaches like extension methods now available in a couple of OOP languages.

Whereas multi-methods are dynamically dispatched taking into consideration the whole set of parameters, and can be defined after the fact. Meaning that they aren't necessarily written in the same module that defines the respective data structures, which opens the door to more extensible designs.

Taking the Alan Perlis' quote "It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures." to the next level.

Because not only can you define all those functions that operate on one data structure, they actually apply to the tuple made by the dynamic type of all parameters at call site.

Naturally it also might make it harder to follow what actually happens with a given method dispatch.

This is my insight from having gone through "The Art of the Metaobject Protocol" and dabbling with multi-methods in Clojure, so I might not be 100% correct here.

Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by mac01021 on Wednesday January 23, 2019 @10:06AM (#18978703)
You mean you don't like that the methods are declared outside of the struct?

Or that you have to say foo(x) instead of x.foo()?

The latter makes writing code using autocomplete less doable, but reads more naturally in many cases.

I can't think of compelling pragmatic reason to mind the former, but if you have one I'd like to hear it.

Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by Tarq0n on Wednesday January 23, 2019 @12:56PM (#18980639)
Pipes are a nice compromise perhaps. x |> foo(). You get the clear left-to-right flow and easy autocomplete.
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by Iwan-Zotow on Wednesday January 23, 2019 @01:20PM (#18980914)
class methods provides namespace and scope
Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by lewis500 on Wednesday January 23, 2019 @02:33PM (#18981831)
I think this mainly makes a difference with regard to reading the code. I'm looking at a struct in someone's code and ask myself "How does this thing get used?" With classes I'll be able to see its methods right away, and if it had inherited then I could see right away which parent to go check.

But the problem is not that big. Maybe the methods are right next to the struct, or if I search the codebase for the struct I can find which methods use it. Still, would be cool if Juno had some feature like "show which methods use this."

Re:Julia Language Co-Creators Win James H. Wilkinson Prize f... by outlace on Wednesday January 23, 2019 @11:37AM (#18979761)
With multiple dispatch, if a library has a function that just works on abstract array types, then you as the user could write your own sub-type of the abstract array and it will still work with the library function.