2nd Level of Instantiation?

Hi folks,

I would like to create custom data types in the following way. My aim is to be able to create custom datatypes and being able to use custom persistence. Thus, these custom types, such as Switches (in the image below) need to be a model in the solution part of the project and not in the language (if I understood it correctly).
So first I have a base concept CustomType , which is utilized as base for the concrete definition of e.g. the Switches -type. Then I need to - let's say - make a particular instantiation ( A_Switches ) of the Switches -type to fill it with values.
I hope it is somehow clear, what I want to say with that :)

Does anyone have an idea how to achieve this?


Bigger picture for better readability:


Accessory models of the language might be what you need (if it's not ok to just have your nodes in a solution).

They are the means to give not only concepts but also nodes to the language definition. For instance, in our implementation of java the package/model java.lang is an accessory model. It means that java.lang.String is considered to be part of the language.

It's arguable where to draw the line between the language and its core lib. String need not be part of the language. But if we think about things like java.lang.Iterable, then typing rules (which are part of the language) must know that there is Iterable and how to handle it (foreach statement)
Thanks for your answer Daniil! Unfortunately I think Accessory Models are not really what I need (assuming I understood them correctly)...
My problem is rather that I somehow need another level of node instantiation (or something similar).

1. I'd like to have a Concept with a Child of the interface/abstract type of different data-types, such as integer, string, bool, etc.

(Concept) Base

 - PrimitveType/IType [1]
2. Then I'd like to instantiate this Concept to get a Node with a specialized Child , configured as e.g. integer.
   (These Nodes shouldn't be in the language, so that they can use custom persistence.)
(Node) IntegerInstance of Base-Concept

 - Integer [1]
3. Now I need to instantiate this Node somehow to be able to fill it with actual integer values.

(Node) MagicNumber of IntegerInstance

 - 42

I really don't know how to express properly what I'd like to achieve, but I hope it becomes a bit clearer this way.


Please sign in to leave a comment.