Reimplementing the bulk of std.meta iteratively
Bruce Carneal
bcarneal at gmail.com
Thu Oct 1 18:04:09 UTC 2020
On Thursday, 1 October 2020 at 15:21:40 UTC, Andrei Alexandrescu
wrote:
...
>
> One litmus test is to redo Variant "the right way" (btw it
> should be called Any and moved to druntime). Currently Variant
> reifies the type into a pointer to function, and uses that
> pointer to function to dispatch type-dependent work. It is
> quite messy and incorrect in places. "The right way" would be
> for the reified type to have enough information to allow things
> like testing for subtyping/convertibility. Currently Variant is
> essentially incomplete and incorrect ...
Litmus test for what? Utility at run-time or as a simple base
language addition for use at compile time?
My concern here is not with our ability to make something like
what you're proposing "work". After all, C++ "works". My
concern is that the proposal, by my lights anyway, is already a
good deal past "simple" and it's not converging.
On a related note, if the reify/dereify code expands as much as I
believe it will in order to cover all cases, expands in to a
"shadow" front end, you'll want to look at forcing the actual
front end to use it so that you can eliminate divergence issues.
That could also set us up for an embedded-compiler/jit future
which would be another justification for the work.
If that's where you're headed, if you want to destroy the
compile-time/run-time separation, I'd be interested in hearing
more. I'm not a fan of embedding the compiler or exposing the
type system for that matter, but it would be worth a listen, no
doubt.
More information about the Digitalmars-d
mailing list