Comments (2)
Thanks for the feedback, but actually I believe such changes may be better
implemented in a fork. The gcfg package is for parsing files with the gcfg
syntax (which is based on that for git-config); I haven't looked into the
syntax of python config files in detail, but it seems likely that there will be
numerous differences / incompatibilities in addition to the two you've created
issues for (I'd be surprised if case sensitivity, the set of valid characters,
escaping/quoting, etc, were all entirely equivalent). On the other hand, the
source code of gcfg may be a good base for creating a parser for such files.
Even though forking creates a bit of code duplication, this makes it explicit
that the two packages are for parsing different formats. (Please use a name
other than gcfg for the fork, to prevent confusion regarding what is valid gcfg
format.)
Perhaps some of the format differences could be handled by relaxing the rules
for the gcfg syntax as your patches suggest, but trying to support a
combination of a variety of syntaxes in a single package is likely impossible
in the long run. (Just picking which of the many INI-style formats to include /
exclude would need to be somewhat arbitrary.) Even assuming it worked, it makes
describing (understanding) and testing the accepted format(s) more complicated.
(Note that your patches didn't include the changes for the documentation and
the tests -- I usually look at those before checking the implementation. Even
though "go test" validates the output of the examples so it works as a kind of
test, I believe those should be there in addition to, not instead of the
primary tests.) I generally prefer less variations to more (like the Go
language itself; instead of having "for", "do", "while", "until", there's only
"for" -- less is more), and prefer to only change things from the git-config
syntax when there is clear benefit. Adding your patches would create additional
variations (':' vs '=', '_' vs '-') that could only bring confusion without any
specific additional value when using the package to parse gcfg files. (Ideally
I'd even prefer if there was only one way of commenting, but making that change
didn't seem to provide sufficient benefit.)
On the gcfg side, there is room to improve the code structure to make it easier
to reuse it for similar formats with less code duplication, so I'll leave this
issue open for tracking that. If you accept my advice and create a fork, and
decide to make it public, please share your repo URL, it will help me in
validating the revised structure.
Original comment by [email protected]
on 23 Jan 2015 at 12:26
- Changed title: restructure for adaptability to different formats
- Changed state: Accepted
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
from gcfg.
Issue 13 has been merged into this issue.
Original comment by [email protected]
on 23 Jan 2015 at 12:28
from gcfg.
Related Issues (15)
- Error messages should be human readable HOT 2
- support for "array of section" HOT 7
- doc: make tag explanation more specific and example discoverable HOT 3
- [patch] allow "_" in the key HOT 1
- Subsections should be made available in an sorted order HOT 1
- migrate to gopkg.in/gcfg.v1 HOT 7
- Empty comment line causes the next line to be interpreted as comment HOT 2
- do we need to import anything? HOT 2
- config files with 'extra' content HOT 4
- Support for `-` in variable/section names HOT 7
- Writing/setting gcfg files HOT 3
- gcfg failed to get HOT 2
- sections with user-supplied variable names HOT 4
- dashes in field names are always converted to underscores HOT 3
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 gcfg.