On 08/21/2018 03:27 PM, Steven Schveighoffer wrote:
If you examine how the code for variant works, it's quite clever. It
establishes a "handler" that is generated with full compile-time type
info available when the value is *assigned*, but then cast to a function
taking a void pointer and an
On 8/21/18 3:11 PM, Nick Sabalausky (Abscissa) wrote:
On 08/21/2018 03:03 AM, Nicholas Wilson wrote:
On Monday, 20 August 2018 at 00:27:04 UTC, Nick Sabalausky (Abscissa)
wrote:
Suppose I've wrapped a Variant in a struct/class which ensures the
Variant *only* ever contains types which satisfy
On 08/21/2018 03:03 AM, Nicholas Wilson wrote:
On Monday, 20 August 2018 at 00:27:04 UTC, Nick Sabalausky (Abscissa)
wrote:
Suppose I've wrapped a Variant in a struct/class which ensures the
Variant *only* ever contains types which satisfy a particular
constraint (for example: isInputRange, or
On Monday, 20 August 2018 at 00:27:04 UTC, Nick Sabalausky
(Abscissa) wrote:
Suppose I've wrapped a Variant in a struct/class which ensures
the Variant *only* ever contains types which satisfy a
particular constraint (for example: isInputRange, or hasLength,
etc...).
Is there a way to call a
On 08/20/2018 10:57 PM, Jonathan M Davis wrote:
Runtime reflection is theoretically possible in D, but it requires
generating the appropriate stuff for every type involved so that the runtime
stuff has something to work with. Java built all of that into the language
and has the JVM to boot,
On Monday, August 20, 2018 8:29:30 PM MDT Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
> On 08/20/2018 04:34 PM, Jonathan M Davis wrote:
> > foreach(T; TypesThatVariantHolds)
>
> Yea, that's what I would've just done, but I wanted to support
> user-created types not already
On 08/20/2018 04:34 PM, Jonathan M Davis wrote:
foreach(T; TypesThatVariantHolds)
Yea, that's what I would've just done, but I wanted to support
user-created types not already known to my library.
You
can't just call functions on completely unknown types, because the compiler
On Monday, August 20, 2018 1:38:13 PM MDT Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
> There are a bunch of discriminated union types available for D, but the
> only one I'm aware of that *doesn't* require a finite-sized list of
> types known ahead-of-time is Phobos's Variant. The
On 08/19/2018 11:31 PM, Paul Backus wrote:
You are basically reinventing OOP here.
Yes, I am. Deliberately, in fact. Class inheritance is my backup plan,
though.
My use-case is actually very, very similar to std.digest:
There are various benefits to using a template-and-constraint based
On Sunday, August 19, 2018 9:08:39 PM MDT Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
> On 08/19/2018 10:23 PM, Jonathan M Davis wrote:
> > On Sunday, August 19, 2018 6:33:06 PM MDT Nick Sabalausky (Abscissa) via
> >
> > Digitalmars-d-learn wrote:
> >> Maybe something involving
On Monday, 20 August 2018 at 00:27:04 UTC, Nick Sabalausky
(Abscissa) wrote:
Suppose I've wrapped a Variant in a struct/class which ensures
the Variant *only* ever contains types which satisfy a
particular constraint (for example: isInputRange, or hasLength,
etc...).
Is there a way to call a
On 08/19/2018 10:23 PM, Jonathan M Davis wrote:
On Sunday, August 19, 2018 6:33:06 PM MDT Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
Maybe something involving using Variant.coerce to convert the payload to
a single common type? Not sure how I would do that though.
You could
On Sunday, August 19, 2018 6:33:06 PM MDT Nick Sabalausky (Abscissa) via
Digitalmars-d-learn wrote:
> On 08/19/2018 08:27 PM, Nick Sabalausky (Abscissa) wrote:
> > Suppose I've wrapped a Variant in a struct/class which ensures the
> > Variant *only* ever contains types which satisfy a particular
On 08/19/2018 08:27 PM, Nick Sabalausky (Abscissa) wrote:
Suppose I've wrapped a Variant in a struct/class which ensures the
Variant *only* ever contains types which satisfy a particular constraint
(for example: isInputRange, or hasLength, etc...).
Is there a way to call a function (ex:
14 matches
Mail list logo