News for hackers. Stuff that matters.
Re:Test for lists in Cython by leephillips on Monday April 19, 2021 @12:10PM (#26864379)
In Julia they are not classes in the sense that the term is normally used in, for example, Python. Classes bind together data and methods, which is what leads to all the problems. In Julia functions are generic, and specialized to methods acting on arbitrary combinations of types; they are freed from the data.

https://arstechnica.com/science/2020/10/the-unreasonable-eff...

Re:Test for lists in Cython by jhgb on Monday April 19, 2021 @12:24PM (#26864553)
> Classes bind together data and methods

Not in CLOS, from which Julia's mechanisms are derived (which leads to the question why not CLOS but Python of all things should be used as a source of "normal sense" of anything Julia-related). In CLOS, classes bind together data, generic functions name abstract operations, and methods represent specific code that deals with implementing a generic function for a particular combination of type arguments.

> which is what leads to all the problems

I don't think anyone is disputing that here. There's a reason why CLOS didn't do any of that.

> In Julia functions are generic, and specialized to methods acting on arbitrary combinations of types; they are freed from the data.

...yes, just like in CLOS (unsurprisingly, given Julia's heritage), and those types are effectively CLOS classes.

Re:Test for lists in Cython by leephillips on Monday April 19, 2021 @12:54PM (#26864985)
Well, it seems as if we were just at cross purposes due to terminology.

Although multiple dispatch in CL (and Perl) predates Julia, I was not aware that Julia’s design derived from it. Do you have a reference that traces this?

Re:Test for lists in Cython by jhgb on Monday April 19, 2021 @01:36PM (#26865631)
I find it virtually certain that it does derive from it. Considering that one of the authors of Julia wrote Julia's front-end in Lisp (https://github.com/JuliaLang/julia/blob/master/src/julia-par... and some other files in the same directory), it would have been astonishing for CLOS to not have major impact on the design. There's also some relevant statements in a paper on Julia's design (https://dl.acm.org/doi/10.1145/3276490) in the part on multiple dispatch in section 7. Related Work, where CLOS and its "algebraic cousin" Dylan are mentioned. I got the impression that Julia's object system is basically CLOS without quite a few of CLOS' complexities such as inheritance (which in CLOS necessitates some advanced extension facilities to cover some corner cases if method lookup doesn't do what you want it to do if you're attempting a highly complex application model). The nice effect of those feature removals was that in many cases monomorphization of call sites in emitted native code is possible, which is presumably the other reason for those feature removals: suddenly even primitive operations such as +, * etc. can be generics without incurring (most of the time) dispatch cost at runtime. That (primitive operations being generic functions) is not the case in CLOS, although that can also very well be attributed to backwards compatibility efforts in Common Lisp.

Interestingly enough, in Julia's documentation, the section "Noteworthy Differences from other Languages" (https://docs.julialang.org/en/v1/manual/noteworthy-differenc...) compares Julia to only several relevant languages, which are: Matlab, R, Python, C/C++, and...Common Lisp, of all things. I very strongly doubt that this is a coincidence.

Re:Test for lists in Cython by leephillips on Monday April 19, 2021 @02:00PM (#26865985)
Thank you for that interesting reply.