Git Product home page Git Product logo

Comments (6)

AtiyahElsheikh avatar AtiyahElsheikh commented on June 26, 2024

Hope I am understanding that correctly. Say we are dealing with module health, why the function add_child! would be needed?

from loneparentsmodel.jl.

mhinsch avatar mhinsch commented on June 26, 2024

add_child! is obviously part of module Kinship. The problem is that a separate module Kinship would have to define add_child! without knowing in advance how that module will be incorporated into an agent. And forwarding every function a module defines from the agent type to the module type is annoying and error-prone.

from loneparentsmodel.jl.

AtiyahElsheikh avatar AtiyahElsheikh commented on June 26, 2024

I guess with some representative (psuode-)code, I could follow it better. So my understanding

module Kinship 
  ...
  add_child!(::Kinship) = ..
  ..  
end # Ki
module Person 
   .. 
   # you don't want add_child(::Person) here? 
   .. 
end # Person 

from loneparentsmodel.jl.

mhinsch avatar mhinsch commented on June 26, 2024

Having

add_child!(p::Person) = add_child!(p.kinship)

would be the obvious way to handle these modules. However, I think that's not very satisfying since it means every function defined in any module has to be replicated in every definition of an agent type that uses that module.

from loneparentsmodel.jl.

AtiyahElsheikh avatar AtiyahElsheikh commented on June 26, 2024

Ok. You may want to propose if this is milestone V0.X or V{1,2}.X

from loneparentsmodel.jl.

mhinsch avatar mhinsch commented on June 26, 2024

Haven't tried it, but this looks like it might do exactly what we need: https://github.com/JeffreySarnoff/TypedDelegation.jl

from loneparentsmodel.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.