Comments (3)
one question is what happens in a merge (withFallback). what if one file has order a,b,c and we merge with one containing c,b,a ...
one solution for your case might be tasks=[ process.args=,cleanup.args=]
since lists are ordered ?
from config.
Yes, using a list could also possibly work, although then there's some additional boilerplate needed to get to the actual values.
In merging I think the withFallback should be properly structured and entirely separated from the main configuration key-value pairs Map. In other words, the keys should form a strongly typed hierarchy instead of everything being in just one flat map. Usage wise this is comparable to include
being an inlining operation, where contents of another file are inserted to the position where the include
directive is.
from config.
Coming back to this much later with more time to think about it...
I guess we'd want withFallback to work the same way with respect to order as this (imagine cutting this in half at any line, and the second half is combined with the first using withFallback
):
a=1
b=2
a=3
c=4
a=5
So the question is, where does a
end up in the final order. If the first half is a b a c
then do we collapse that to LinkedHashMap with a b c
or b a c
after combining the two a
? And then when we do second.withFallback(first)
, if second
is just a
and we merge it back with b a c
, is the result b a c
or a b c
? What if we split into three pieces and then merge those?
We would have to define this such that withFallback
continues to be an associative operation, which is an important assumption in the library, but I think that isn't actually possible unless order is NOT considered in config object equality. But if order is meaningful, it really should be part of equality.
Another angle to think about this is, what if reference.conf has keys in order a b c
and application.conf has c a
but doesn't specify b
. So what do we do here; do c
and a
swap and leave b
between them, or do c a
both move after b
, or what. I don't see any principled answer, or anything that would be intuitive.
Perhaps to solve the problem here we could introduce a separate "ordered object" type and basically that object type would not allow merges, only replacement. But this would be quite a lot of conceptual overhead and code. I think it's probably better to just use a list.
I'm closing the issue for now since I don't see a path forward but don't let that deter others from trying to think of one. Just think about the withFallback problem, where we generally assume that we can concat two files and that is equal to file1.withFallback(file2)
, and we also have to cope with multiple instances of a key within a single file...
from config.
Related Issues (20)
- Inefficient getDuration() parsing - Re-creation of Pattern
- Get the line/pos information from a ConfigObject HOT 1
- `ConfigFactory.parseResources()` overrides `ConfigParseOptions.setSyntax()`
- Is this project active? HOT 4
- Find a StackOverflowError in config
- Find a StackOverflowError in config
- Find a StackOverflowError in config HOT 1
- underscore characters HOT 2
- Problems with com.typesafe/config and maven-dependency-plugin
- introduce method accepting a list of Objects to add a value
- Should this project be explicitly considered as deprecated/not supported? HOT 29
- Community fork? HOT 7
- Resolving Variable Substitutions Between Multiple Config HOT 1
- Something error when use com.typesafe.config API convert conf file to scala bean class
- withFallBack is not adding value if not present
- how to load the config with substitution details HOT 3
- Add info about which signing keys will be used for published artifacts.
- Cannot provide environment variables programmatically
- Rendering partially resolved appended array results in invalid configuration HOT 1
- Inconsistent behavior with Overflow/Underflow and Exceptions
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 config.