4 ms·
I mean, the systems described in the TAotMOP, and CLOS, are early implementations of multiple dispatch, which is the core paradigm of the Julia language. Julia
by JHonaker 4y ago
I mean, the systems described in the TAotMOP, and CLOS, are early implementations of multiple dispatch, which is the core paradigm of the Julia language.
Julia doesn't go quite as far as implementing a MOP. It doesn't allow for the arbitrary modification of the semantics of evaluation in the language itself, but I'll bet it'd be pretty easy to write a MOP on top of the base language.
I think the ideas in the MOP are exactly those that you've identified in the first sentence. You can draw lines that allow you compare the object implementations of particular programming languages. This isn't so useful when you're just working in a single language, but in something like CL or Scheme (or Racket more specifically) where a major design strategy is to design a DSL that suits your problem, having a MOP really lets you tailor that DSL to the problem in ways you might have a hard time doing otherwise.
For example, I once wrote a library for a computing in particular area of mathematics, but I also wanted to see some symbolic equations. I just changed the basic evaluation semantics of my numeric operators to operate on symbols as well as numbers and to run some simplification logic and boom. I had a rough view of the equations that were actually being used to compute that I could use to debug or tidy up and write down.
- ssivark 4y ago> For example, I once wrote a library for a computing in particular area of mathematics, but I also wanted to see some symbolic equations. I just changed the basic evaluation semantics of my numeric operators to operate on symbols as well as numbers and to run some simplification logic and boom. This is very much something I find fascinating (and a reason I’m quite excited by Julia). Can you point me to any examples where you feel this has been tastefully done? (yours or otherwise)
- JHonaker 4y agoWell I did it in Scheme, but there's no reason it wouldn't have worked in Julia. If you're interested in this, the relatively recent Software Design for Flexibility by Chris Hanson and GJS [1] has a pretty good couple of chapters on creating a generic procedure system (and a lot of other really cool things). Edit: In fact, it has an example doing just this example: symbolic alternative evaluation. Where they get the closed form solution from a simple differential equation solver without changing any code in the solver. Now that I think about it, this idea is pretty much how automatic differentiation works in Julia. (Really everything in Julia.) You can look at the libraries Flux.jl and Zygote.jl. There are probably more now, I've been out of the Julia ecosystem for about a year or so. [1] https://mitpress.mit.edu/9780262045490/ https://mitpress.mit.edu/9780262045490/