Open cboettig opened 6 years ago
Or maybe I should just be using serializeToCharacter
here?
@cboettig the Serialize
class is maybe following the redland
C library to closely here, and it would have been better to make a serialize
method that was more R friendly. As we currently have
serializeToCharacter
and serializeToFile
, where does it make the most sense to put in support for writing to a connection? Maybe
serialize(serializer, world, model, con=stdout())
which is similar to
writeLines(text, con = stdout(), sep = "\n", useBytes = FALSE)
where con
is handled in this way:
If the con is a character string, the function calls file to obtain a file connection which is opened for the duration of the function call.
If the connection is open it is written from its current position. If it is not open, it is opened for the duration of the call in "wt" mode and then closed again.
As suggested by @amoeba : would be nice to serialize to
stdout()
instead of a literal file path, but this throws an error