Giter Club home page Giter Club logo

Comments (5)

ihnorton avatar ihnorton commented on June 11, 2024

Hmm. On second look I think it may be necessary to use concrete types that encapsulate the pointer.
https://gist.github.com/ihnorton/e694b87a86ee19e4f75a#file-ptrdispatch2-jl

Might be a performance hit, but don't worry about that for now.

from clang.jl.

ihnorton avatar ihnorton commented on June 11, 2024

Reading the friendly manual more closely gives a solution (Methods, bottom). Make the pointer type a method parameter and this plan should work perfectly:
https://gist.github.com/ihnorton/e694b87a86ee19e4f75a#file-ptrdispatch3-jl

from clang.jl.

ihnorton avatar ihnorton commented on June 11, 2024

Here is a hacky but potentially tractable idea to simulate multiple inheritance: use Union of pointer types.
https://gist.github.com/ihnorton/e694b87a86ee19e4f75a#file-ptrdispatch4-jl

(The problem here is that it requires listing each possible subclass in the Union. However, this might be best anyway because it could allow correct thunking)

from clang.jl.

ihnorton avatar ihnorton commented on June 11, 2024

Closed in 692e9ed0

from clang.jl.

ihnorton avatar ihnorton commented on June 11, 2024

Here is an idea how to support basic C++ multiple inheritance with multiple-dispatch

class A
class B

class M < { A,B }

in julia

define M <: A
all A meth(A, ...) apply as usual

define M_b <: M
implement aliases for all B functions, which do the thunk and call meth(B, ...)

from clang.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.