-
I have tried to define the above type alias in order to be able to generate a configuration structure where specific configuration class objects can be organised in nested groups. So that the nested key Strings form an 'address' that the config file parser can instantiate as a single associated Object that might be referred to multiple times by other parts of the configuration file. The intention is to 'flatten' or organise part of the configuration structure for usability in creating and maintaining a configuration file, while using (otherwise confusing) hierarchal structure of said objects for configuration elsewhere.
The error generated here is quite clear and self explanatory. My question I suppose is, is this a firm restriction of the language and/or is there another way for this to be achieved with pkl? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Currently, this is a hard restriction. We've been thinking about adding elements and entries to |
Beta Was this translation helpful? Give feedback.
Currently, this is a hard restriction. We've been thinking about adding elements and entries to
Typed
objects also. That might resolve this ask. One of the problems here is that Pkl is lazy, so you can very easily "tie the knot," i.e. embed an object in itself, creating an infinite nesting. For Pkl to resolve something is aclass
, it only needs to have the outer structure (that is to say, it doesn't have to evaluate all the properties). Deciding whether something is aAddressedTypeMapping<T>
would require forcing the entire structure. If said structure contains such self-reference, that's a StackOverflow.