-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Is your feature request related to a problem?
It is currently possible to create an invalid CSVWriter.Configuration by supplying nil as a field- or row-delimiter. nil means "infer the delimiter from the CSV data", which only makes sense for the CSVReader. This error is reported at runtime.
Describe the solution you'd like
I'd suggest having separate Delimiter.Pair types for CSVReader.Configuration and CSVWriter.Configuration so that we can prevent invalid configuration at compile-time. The Delimiter.Pair for the writer's configuration would simply not have an API for specifying inference.
Describe alternatives you've considered
Alternatively we can keep it as it is currently, and raise a run-time error when inference is requested from the CSVWriter. This does spare us from having two very similar Delimiter.Pair types.
Additional context
If we add a more explicit API for delimiter inference, as suggested in #44, I think this might become even more important, as the auto-completion will otherwise include .infer and multiple overloads of .infer(options:) in its suggestions, which would be quite confusing in the context of the CSVWriter.