4 ms·
One place where I ran into this was when I was building an ETL framework in Scala. The scenario was that I wanted to be able to move data from one database sys
by JunkDNA 11y ago
One place where I ran into this was when I was building an ETL framework in Scala. The scenario was that I wanted to be able to move data from one database system to another and not have the end user of the DSL have to care about the types. The use case was essentially that you should be able to show up to an arbitrary database, run a query, and then pump that output somewhere else (e.g. another DB, flat file, transformation function, etc...)
I went around in circles and ultimately concluded no amount of type inference or other things in Scala's bag of tricks would let a user of the API avoid the dreaded type cast.
I have often seen this situation whenever I have tried to write generic code in a static language that needs to interact with a database.
- nrinaudo 11y agoThat sounds like a perfect use case for type classes, have you tried that? If so, I'd be interested to know why it failed, if you can find the time.