Can we change ILink implementation to be non generic? #987
Replies: 4 comments 7 replies
-
Can we move this to the discussions tab please and discuss there 😄 |
Beta Was this translation helpful? Give feedback.
-
The reason for having them defined with generics is so that each discipline can have their objects pointing to the appropriate type of node. For example the Bar class in structures needs to have a start and end node of type Had different ideas on how to handle this without the generics when the interfaces were first added, but all of them would include extension methods etc, and would not give that much benefit as an addition and to help ensure that the oMs stay aligned. Basically, it comes down to the usage on the actual classes themselves, that need to have the restriction, and not from what we would absolutely like on the interface. If c# would allow you to define the interface as you have above, whilst still restricting the bar class to Structure nodes, that would be ideal, but unfortunately not possible. |
Beta Was this translation helpful? Give feedback.
-
@IsakNaslundBh thanks for the explanation - very clear. Basically the generic definition is protecting users? Helping them know what implementing type to pass in and therefore avoiding downstream problems if for example an environmental Node is used to define a bar. Makes me think / realise the analytical graph should in fact be designed to be more abstract. Constraining it to work with INode + ILink in the first case assumes it is spatial - which may not always be the case. |
Beta Was this translation helpful? Give feedback.
-
Had another think about this @rolyhudson and think we could fix this by:
Then all the geometrical nodes (all current |
Beta Was this translation helpful? Give feedback.
-
Planning longer term use of
Graph
as an analytical element. (This question relates to #988)It may very useful to use the
ILink
interface to construct relationships between Nodes of different types.Currently the
StartNode
andEndNode
properties are constrained to a single Type that implementsINode
What are the benefits of constraining as currently implemented?
What about switching to a non-generic version like
Thoughts on this @IsakNaslundBh, @FraserGreenroyd, @al-fisher, @adecler ?
Beta Was this translation helpful? Give feedback.
All reactions