this post was submitted on 11 Jun 2024
136 points (83.0% liked)
Programming
17352 readers
313 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Real moral of the story: STATIC TYPING!
Seriously so many people think it's a waste of time, and then stuff like this happens.
How would static typing help here?
Thinking about C# and Dapper here 'cause they're what I'm used to, but, for example...
result = await connection.QueryAsync<ResultType>(QUERY);
(whereResultType
is a statically typed record, class, or struct shaped like the data you want returned.)Given a query that doesn't return something that matches any of
ResultType
's constructors, the code'll throw an exception at runtime complaining it needs a constructor that matches whatever it's returning, whereupon you'll notice it isn't asking for it to have adate
parameter, so the query must not be returning it.If only there were a good statically typed database, as opposed to thin wrappers over SQL.
And better error messages than "bro, you got a syntax error on this line"