News for hackers. Stuff that matters.
Re:Rust Dependencies Scare Me by ak_111 on Saturday May 10, 2025 @07:57AM (#43944969)
As poster dead deep in the thread below, something like this can happen

doc_format = get_user_input() parsed_doc = foolib.parse(doc_format)

You as the implementer might know the user will never input xml, so doc_format can't be 'xml' (you might even add some error handling if the user inputs this), but how can you communicate this to the compiler?

Re:Rust Dependencies Scare Me by arccy on Saturday May 10, 2025 @09:10AM (#43945348)
That's called bad library design. Rather than a global, make an instantiated parser that takes in specific codecs.
Re:Rust Dependencies Scare Me by tester756 on Saturday May 10, 2025 @12:49PM (#43947035)
It aint matter, if format is comes from runtime then compiler will not know.