Re:Where are the low level system engineers?
by alexfromapex on Wednesday May 04, 2022 @08:00PM
(#31267553)
This must be common, I just bombed a leetcode (tm) interview where I was asked to write code to share a method between two structs using traits in Rust without duplicating code. I couldn't remember a time I'd ever seen it done with generics so I tried to find it in the documentation but nothing. I looked up the solution after and it is not possible without writing a macro which is metaprogramming and seems like a poor way to assess how I'd perform writing Rust on a daily basis when I only had ~20 minutes to do it and was transparent that I am still learning the more advanced concepts. There were other red flags I ignored in the interview process, I look at it as a bullet dodged.
[ Parent
| on HN ]
Re:Where are the low level system engineers?
by Brentward on Wednesday May 04, 2022 @08:30PM
(#31267808)
Can't you just provide a default implementation of the method on the trait itself? Unless there are more requirements I'm not parsing from what you wrote, that seems to do exactly what they wanted.
Re:Where are the low level system engineers?
by saghm on Wednesday May 04, 2022 @09:13PM
(#31268161)
Yeah, I'm not sure I fully understand as well. The only thing I can think of is that the trait was supposed to be from outside the crate (i.e. not modifyable), but then then, I'm not sure why writing a function that was generic over T: ThatTrait that took an instance as a parameter (or even `impl ThatTrait`) wouldn't work
Re:Where are the low level system engineers?
by ummonk on Wednesday May 04, 2022 @09:13PM
(#31268163)
What they’re describing is leetcode style problems that require the coder to use an abstract high level language that makes coding easy.
What you’re describing is the opposite - some kind of esoteric question related to a specific language.
Re:Where are the low level system engineers?
by throwaway1777 on Wednesday May 04, 2022 @09:10PM
(#31268131)
That is not really a leetcode-style interview question. Leetcode focuses on DSA questions not language knowledge.