eddelbuettel / rcpptoml

Rcpp Bindings to C++ parser for TOML files
GNU General Public License v2.0
36 stars 9 forks source link

write TOML files? #17

Closed shabbybanks closed 1 year ago

shabbybanks commented 7 years ago

Maybe this is out of scope, but it would be nice to write a list to a TOML file. I think the upstream cpptoml library has an example program of serializing an object to a stream (examples/build_toml.cpp). Perhaps that can be ported without too much headache.

eddelbuettel commented 7 years ago

Yes. Opening a filestream is easy.

The problem is that the 'mental model' I have of toml files has copious comments. And those we don't have. Hence, the read/write cycle can not be idempotent.

shabbybanks commented 7 years ago

Perhaps the read & write operations can be pseudo inverses of each other in the sense that read-write-read gives the same results as read, and write-read-write gives the same results as write.

Another option would be to allow a comment attribute of a field to be written out as a comment in the YAML file, though that would break the pseudo-inverse property.

(btw, this is my professional account, and is not at all associated with that other shabbyguy.)

eddelbuettel commented 7 years ago

(btw, this is my professional account, and is not at all associated with that other shabbyguy.)

Ah. Had not made that connection.

shabbybanks commented 7 years ago

there is no connection.

eddelbuettel commented 7 years ago

Of course not. Silly me.

eddelbuettel commented 1 year ago

We are about to release an updated version based on toml++ which could write TOML files. I however have no current use case but external contributions may be considered. Until then I close this as stale.