Skip to content

Commit 605d99d

Browse files
committed
🚧 Generic class component?
1 parent 5b003bd commit 605d99d

File tree

7 files changed

+42
-12
lines changed

7 files changed

+42
-12
lines changed

src/EcologicalNetworksDynamics.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ include("./Views/Views.jl")
5050
using .Views
5151

5252
# Convenience macro to wire this all together.
53-
include("./expose_data.jl")
53+
# include("./expose_data.jl") # XXX: on hold.
5454

5555
#-------------------------------------------------------------------------------------------
5656
# The actual user-facing components of the package are defined there,
5757
# connecting them to the internals via the framework.
58-
include("./components/main.jl")
58+
# include("./components/main.jl")
5959

6060
#=
6161
#-------------------------------------------------------------------------------------------

src/Framework/blueprint_macro.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ function blueprint_macro(__module__, __source__, input...)
235235
implied_blueprint_for(b, singleton_instance(C))
236236
end
237237
# In case the brought component type is abstract,
238-
# define a falllback method in case the components lib
238+
# define a fallback method in case the components lib
239239
# provided no way of implying a particular subtype of it.
240240
# TODO: find a way to raise this error earlier
241241
# during field assignment or construction.

src/Framework/macro_helpers.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
# @create_value B depends_on_value(A)
2424
# end
2525
#
26+
# HERE: is `@testset` really the only use case for the above?
27+
# Because if so, maybe just drop `@testset`.
28+
# => Yes, it is. Drop it:
29+
# - 1. Fake an alternate `@testset` for framework tests.
30+
# - 2. Guard macros invocations with a sync lock to ensure the above does not happen.
31+
# - 3. Assume it does not and simplify macro codes a LOT then.
32+
#
2633
# As a consequence, it cannot be checked that `A` is a valid reference to an existing type
2734
# during macro expansion.
2835
# This check must therefore be performed during generated code execution,

src/GraphDataInputs/convert.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Convenience explicit conversion to the given union tgc(Map, [:a => 5, Bool[0, 1, 1] => 8])ype from constructor arguments.
1+
# Convenience explicit conversion to the given union type from constructor arguments.
22

33
# The conversions allowed.
44
graphdataconvert(::Type{T}, source::T) where {T} = source # Trivial identity.

src/components/class.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# HERE: attempt to capture anything needed
2+
# to define a component bringing a new class to the network.
3+
# Extensibility required, but avoid it being noisy if unused.
4+
# This **may** bypass @components_macro, @blueprint_macro and @expose_data.
5+
6+
function define_class_component()
7+
# Generated code prototype for an imaginary component called `Class`,
8+
# used as a placeholder.
9+
quote
10+
# ==================================================================================
11+
# Blueprints for the component.
12+
module ClassBlueprints
13+
#-------------------------------------------------------------------------------
14+
# Construct from a given set of names.
15+
mutable struct Names
16+
names::Vector{Symbol}
17+
end
18+
end
19+
end
20+
end

src/components/main.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,31 @@ include("./allometry.jl")
4141
# to each of its fields.
4242
include("./args_to_fields.jl")
4343

44+
# HERE: try crafting generic components?
45+
include("./class.jl")
46+
4447
# Central in the model nodes.
4548
include("./species.jl")
4649

4750
# Trophic links, structuring the whole network.
4851
# (typical example 'edge' data)
49-
include("./foodweb.jl")
52+
# include("./foodweb.jl")
5053

5154
# Biorates and other values parametrizing the ODE.
5255
# (typical example 'nodes' data)
53-
include("./body_mass.jl")
54-
include("./metabolic_class.jl")
56+
# include("./body_mass.jl")
57+
# include("./metabolic_class.jl")
5558

5659
# Useful global values to calculate other biorates.
5760
# (typical example 'graph' data)
58-
include("./temperature.jl")
61+
# include("./temperature.jl")
5962

6063
# # Replicated/adapted from the above.
6164
# # TODO: factorize subsequent repetitions there.
6265
# # Easier once the Internals become more consistent?
6366
# include("./hill_exponent.jl") # <- First, good example of 'graph' component. Read first.
64-
include("./growth_rate.jl") # <- First, good example of 'node' component. Read first.
65-
include("./efficiency.jl") # <- First, good example of 'edges' component. Read first.
67+
# include("./growth_rate.jl") # <- First, good example of 'node' component. Read first.
68+
# include("./efficiency.jl") # <- First, good example of 'edges' component. Read first.
6669
# include("./carrying_capacity.jl")
6770
# include("./mortality.jl")
6871
# include("./metabolism.jl")

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ using .TestUtils
1919
using .TestFailures
2020

2121
sep("Test internal model representation.")
22-
include("./networks/runtests.jl")
22+
# include("./networks/runtests.jl")
2323

2424
sep("Test System/Blueprints/Components framework.")
25-
# include("./framework/runtests.jl")
25+
include("./framework/runtests.jl")
2626

2727
sep("Test API utils.")
2828
# include("./graph_data_inputs/runtests.jl")

0 commit comments

Comments
 (0)