[HN Gopher] Building a runtime reflection system for Rust (Part 3) ___________________________________________________________________ Building a runtime reflection system for Rust (Part 3) Author : lukastyrychtr Score : 18 points Date : 2021-01-09 21:03 UTC (1 hours ago) (HTM) web link (www.osohq.com) (TXT) w3m dump (www.osohq.com) | RcouF1uZ4gsC wrote: | tuple_impls! {} tuple_impls! { A } tuple_impls! { | A B } tuple_impls! { A B C } // .. more macro | invocations follow // we support method arities up to 16 | tuple_impls! { A B C D E F G H I J K L M N O P } | | Rust really needs the equivalent of C++ variadic templates. Is | there any work ongoing on it? | Rangi42 wrote: | From the article: | | > There's an open issue for something like this: Variadic | generics[1]. But so far every attempt at an RFC has been closed | or postponed. | | [1]: https://github.com/rust-lang/rfcs/issues/376 | RcouF1uZ4gsC wrote: | Thanks, I somehow missed that part when reading. | | I would guess that two big issues for that are lack of | function overloading and that macros are pretty good. | | A lot of the patterns of working with variadics in c++ take | advantage of function overloading. Without function | overloading, those patterns can become harder. | | Secondly, Rust macro system is crazily powerful especially | procedural macros. That power disincentivizes developing | other approaches to meta programming. In C++ macros are | clunky and dangerous, and that has incentivized developing | more type based meta programming techniques to get away from | C macros. ___________________________________________________________________ (page generated 2021-01-09 23:00 UTC)