3 ms·
4 chained function calls from config -> read a key from it is quite an ask. Though I realize there's reason for it. There are many cases I'd be happy to have pa
by bpicolo 10y ago
4 chained function calls from config -> read a key from it is quite an ask. Though I realize there's reason for it. There are many cases I'd be happy to have panics occur for invariants.
config.strictString('foo') or something of that nature seems like it could be a more ergonomic choice in cases like thise.
- bluejekyll 10y agoWhat he is showing is how someone who knows Rust well, would potentially approach this problem. What you're point out is that it's a large bar to ask a new comer to the language to do this because it requires a deeper understanding of the language to use. Is it not appropriate to show that you can reduce the complexity of a program by using other features of the language? It's not significantly different from reducing x + x + x + x To 4x
- jackcviers3 10y agoEach function call is a transformation on the previous argument. Whether or not you assign the results to a variable first before calling the second doesn't change the behavior of the code. But yes, it does appear that the config library needs an extra wrapper that loads from files and returns configs (in a context) that does the common work for you.