4 ms·
> What routers call "dynamic routing" is having the lookup table mutable at runtime. > There can be no equivalent to that in type-safe languages because when y
by kortex 5y ago
> What routers call "dynamic routing" is having the lookup table mutable at runtime.
> There can be no equivalent to that in type-safe languages because when you mutate the dispatch table you lose type-safety.
That's exactly what I mean by escape hatches. Rust has unsafe. You can write a WTF FastInverseSqrt in Rust. You shouldn't 99% of the time. But you can.
Rust also has Box, Rc, Arc, and other tools. I'm not fluent enough in rust to know how to, but I'm quite confident and will eat my hat if you can't accomplish what is effectively a mutable vtable dispatch in Rust.
But also...why? Yeeting a function call into the void without any type knowledge seems way more bug-prone than interface/trait-based dispatch, to what benefit? Save developer time? I've spent countless dev-days of my life I won't get back debugging exactly this kind of dynamic-dispatched, json-dsl, frankly loosey-goosey untyped bullshit. There's so many better ways.
- ukj 5y agoWell isn't that's precisely my point! "unsafe" turns off your compiler's guard rails. You CAN accomplish mutable vtable dispatch and in doing so you will undermine Rust's type-safety! Yeeting a function call into the void is what async network clients usually do. You will soon get a result. Maybe.
- dang 5y agoWould you please stop? Regardless of how right you are or feel you are, we don't want long, tedious flamewars like this and you did more than anyone else to prolong it. Dozens of comments is beyond excessive. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html