Closed athityakumar closed 7 years ago
I think it would be too confusing to read. What if you create the path file from some object and pass the object to from_file
, in which the reader will have no idea what source the data is being read from. from_file
is also very ambiguos. What if you're supplying a DBI
object or URL?
Moreover, each of the from_*
functions have vastly different interfaces, the only commonality being the first argument, which specifies the source. Unifying does not make sense from a design point of view. If the user wants this kind of functionality they can build a custom function for doing so themselves without much non-trivial effort.
Discussion
After modules like
from_html
,from_csv
,from_json
,from_sql
have been done and tested, we can have a universalfrom_file
module which maps to these children functions depending on theend_with?
clause.Pros
The user will now have to use only the
from_file
parent module and not the children functions.Cons
The user will now have to keep the file name with a proper specified extension name. That is, for example - getting the json API responses like
https://api.github.com/users/athityakumar/repos
might fail as there is no.json
at the end of the url. Or, we may have to make the functions to choose more smartly rather than justend_with?
.Everyone is welcome to share their point of view. :smile: