News for hackers. Stuff that matters.
Re:Writing Complex Macros in Rust: Reverse Polish Notation by TheCoelacanth on Friday February 02, 2018 @05:50PM (#16294890)
> With type checking, that same user who would have run into a problem with the "typeless template" will simply find your template useless

Unless you have a bug in your template that causes it to have a type error for a type that you didn't intend for it to have a type error for.

Re:Writing Complex Macros in Rust: Reverse Polish Notation by kazinator on Saturday February 03, 2018 @01:17AM (#16296466)
If the template works (is tested with) with a foo (base class), there is no reason it wouldn't work with something derived from foo. (If not, then there is some LSP issue in the foo type hieararchy; the generic as such is working.)

You might intend (without actually testing) that the template works with some bar also, not related to foo; the user tries it and finds otherwise, due to a bug.

With the typed generic, you just declare that it's for foo, and it refuses to work with bar (whether or not it has a bug which would actually prevent that in the absence of the declaration).

All the declaring, checking, instantiation, and the rest of it are all happening in the same time: static time. There is no difference like with static versus dynamic. Static versus dynamic is due to different times: what is done before running the program, versus during.

There is no verification difference between declaring that a template parameter may be of types foo | bar, and writing a typeless template which a test module then instantiates for foo and bar. Both are declarative mechanisms at work, played out statically. Just one way is more open-ended; it's not "sealed" against new instantiations.