Last active
          October 15, 2019 13:19 
        
      - 
      
 - 
        
Save freakboy3742/1f801db3d441859e91f6304bad8abe09 to your computer and use it in GitHub Desktop.  
    Inherited properties in TOML
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [thing] | |
| name = "demo" | |
| [thing.version_a] | |
| items = ['base1', 'base2', 'first1', 'first2'] | |
| [thing.version_b] | |
| items = ['base1', 'base2', 'second1', 'second2'] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [thing] | |
| name = "demo" | |
| items = ['base1', 'base2'] | |
| [thing.version_a] | |
| items = ['first1', 'first2'] | |
| [thing.version_b] | |
| items = ['second1', 'second2'] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [thing] | |
| name = "demo" | |
| items = ['base1', 'base2'] | |
| [thing.version_a] | |
| items = ['+', 'first1', 'first2'] | |
| [thing.version_b] | |
| items = ['+', 'second1', 'second2'] | |
| [thing.version_c] | |
| items = ['third1', 'third2'] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | [thing] | |
| name = "demo" | |
| items = ['base1', 'base2'] | |
| [thing.version_a] | |
| sub_items = ['first1', 'first2'] | |
| [thing.version_b] | |
| sub_items = ['second1', 'second2'] | 
I wouldn't expect the inherit clause to lead to merged lists, because "inherit" sounds so all-or-nothing. "+" is more intuitive that way. Maybe this is just a naming thing though – if you don't intend to use it for primitives, "merge_with_parent" or something like that could work.
What about separate extend vs inherit directives?
What about separate
extendvsinheritdirectives?
“Extend” would do the job!
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
+1 to inline tables being extremely hard to use, even for experienced devs.