Oh, I should also mention that the system allows modules to be lazy loaded 
when the function is called, something I achieve in python via using 
`__getattr__`, since my Julia approach calls a function to retrieve the 
plugin function it also works.

On Wednesday, August 24, 2016 at 3:29:47 PM UTC-6, Thomas Hatch wrote:
>
> Sorry, I have read a great deal of the documentation but I can't find 
> anything on nested modules. Could I persuade you to direct me to a doc or 
> an example? I think that a nested module would be optimal, I have just been 
> unable to figure out how to do it.
>
> Ok, here goes trying to explain my idea.....
> I am sorry that I don't have a better example of how my plugin system 
> works, I am building it out mostly as an experiment and it is hard to 
> explain the in and outs yet. But the idea is that you have a hub that all 
> of the plugin systems attach to, then the plugin systems can call each 
> other via the hub, so you could have a plugin system called `executors` 
> which is on the hub at `hub.executors` and another plugin system called 
> `databases` which is at `hub.databases`, then from within the `databases` 
> plugin system you could call functions off the hub in the `executors` 
> plugin system and vis versa (as described above). This creates a shared, 
> completely pluggable design so that code can be dynamically loaded and 
> unloaded. This also enables a software design where the code can be 
> completely pluggable, making code replacement something that is always 
> native to the programming paradigm.
>
> Again, this is just a research project of mine, and I think that Julia is 
> the best language to cover many of the other aspects of the research 
> project I am working on, I have also implemented the plugin system (it is 
> dirty, but it works...) in Julia and it runs flawlessly, thanks to Julia 
> being very well written. I am just trying to make it more Julian, despite 
> the fact that I fully recognize that it is not a very Julian way of doing 
> things.
>
> Thanks again for your help and comments!
>
> On Tuesday, August 23, 2016 at 8:41:48 PM UTC-6, Cedric St-Jean wrote:
>>
>> I think we need a more complete description of your problem, because a 
>> plugin can be a lot of things, and I don't know about Salt. In any case, re.
>>
>> plugin(hub, "subsystem.module.function")(args/kwargs)
>>
>> You're right, that doesn't look very Julian. Would something like this 
>> work?
>>
>> module Subsystems
>> type ModuleFunction
>> ...
>> end
>> end
>>
>> function plugin(hub::Hub, mf::Subsystems.ModuleFunction, args..., kwargs
>> ...)
>> ...
>> end
>>
>> That way you can define one plugin function per type, and let multiple 
>> dispatch do the job. 
>>
>> On Tuesday, August 23, 2016 at 7:21:54 PM UTC-4, Thomas Hatch wrote:
>>>
>>> I am asking this just to look for some opinions or ideas on the most 
>>> Julia-like way to do something, as usual, I have no complaints with Julia :)
>>>
>>> I am working on writing a plugin system in Julia and had a syntax 
>>> question. The plugin system was originally written in python and was based 
>>> loosely on the Salt plugin system. The plugin system allows for plugin 
>>> subsystems to be defined and then they all share a data "hub" so the plugin 
>>> systems can easily cross communicate.
>>>
>>> In python the plugin system uses nested python objects to directly 
>>> reference the plugin function:
>>> hub.subsystem.module.function(args/kwargs)
>>>
>>> In Julia I have implemented it like this:
>>> plugin(hub, "subsystem.module.function")(args/kwargs)
>>>
>>> Would there be a better, more Julia-like way to represent this concept?
>>>
>>>
>>> Thomas S. Hatch  |  Founder, CTO
>>>
>>> 3400 N. Ashton Blvd, Suite 110 | Lehi, UT 84043
>>> [email protected] | www.saltstack.com <http://saltstack.com/>
>>>
>>

Reply via email to