Comments (8)
From @eliotmcintire on October 14, 2016 19:9
Interesting. Could be good. A couple potential problems:
- If they are scattered all over, it is hard to organize them. We would likely need a few methods for helping to organize the events. That would be doable. We can also structure the moduleTemplate in a compact way.
- Others?
from spades.core.
Thinking about this more, implementing defineEvent
may solve the namespacing issue (#292, #294).
If defineEvent()
returns an object (environment
?) that contains the module's event functions and doEvent.moduleName()
, then we avoid function name collisions. This environment would be stored in the [email protected]
. We just need to tweak the way functions are called within a module -- using sim$function()
could automatically redirect much like P(sim)
does (i.e., automatically getting the module name).
Does this make sense?
from spades.core.
In other words it provides a mechanism to "nest" the contents of [email protected]
, so instead of this:
sim$doEvent.module1Name()
sim$module1NameEvent1Name()
sim$module1NameEvent2Name()
sim$module1NameEvent3Name()
sim$doEvent.module2Name()
sim$module2NameEvent1Name()
sim$module2NameEvent2Name()
sim$module2NameEvent3Name()
sim$doEvent.module3Name()
sim$module3NameEvent1Name()
sim$module3NameEvent2Name()
sim$module3NameEvent3Name()
we get this:
sim$module1$doEvent()
sim$module1$Event1Name()
sim$module1$Event2Name()
sim$module1$Event3Name()
sim$module2$doEvent()
sim$module2$Event1Name()
sim$module2$Event2Name()
sim$module2$Event3Name()
sim$module3$doEvent()
sim$module3$Event1Name()
sim$module3$Event2Name()
sim$module3$Event3Name()
from spades.core.
From @eliotmcintire on November 24, 2016 23:1
Yes. This works.
We can genericize the approach used in P(sim)
to extract the current module.
from spades.core.
I've started a new feature branch for this (316-defineEvent
)
from spades.core.
made progress implementisng namespacing for module functions by redefining $
and [[
on simLists to store objects in a separate environment for each module ([email protected]$moduleName
). this is implemented such that objects defined as module inputs/outputs are put in the [email protected]
, whereas all other module objects are in [email protected]$moduleName
.
no changes are needed to module code, but see note re: use of ls()
etc. (PredictiveEcology/SpaDES#324 (comment))
still to do: implement the defineEvent
function.
from spades.core.
take a look at the modules
package: https://cran.r-project.org/web/packages/modules/vignettes/modulesInR.html
from spades.core.
Closing, low priority. Labelled "NotDone"
from spades.core.
Related Issues (20)
- simulation caching issues in tests HOT 3
- sporadic download failures triggering test failure HOT 4
- don't install packages during tests HOT 3
- Enable passing new `sourceURL`s to metadata
- New feature idea/request: cross-module, project-contained, functions HOT 8
- error when saving several objects with ``saveFiles()`` and ``.saveObjects`` HOT 3
- Use `ggplotify` in Plots to plot non-ggplot graphics HOT 1
- newModule() should create NEWS.md file
- fix additional issues with noSuggests CRAN checks HOT 2
- use consistent per-module paths for output figures HOT 2
- `newModule` is failing when SpaDES.core isn't loaded HOT 2
- `spades` not caching properly. HOT 1
- `paramCheckOtherMods` can't deal with vector parameters with length > 1 HOT 3
- Misleading/wrong module code checks HOT 2
- saveSimList() hangs using qs; writing massive files HOT 1
- saveSimList() forces use of qs HOT 1
- saveSimList() documentation out-of-date
- GDAL colour table warnings in test-save.R
- saveSimList() archives aren't using correct relative file paths HOT 2
- save/load simList without archiviing/extracting all files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spades.core.