Trait for "can be instantiated"?

H. S. Teoh hsteoh at quickfur.ath.cx
Tue May 10 16:21:03 UTC 2022


On Tue, May 10, 2022 at 04:10:26PM +0000, Ben Jones via Digitalmars-d-learn wrote:
> On Tuesday, 10 May 2022 at 16:05:15 UTC, H. S. Teoh wrote:
> > Using wrapper structs, etc., for this is IMO total overkill. Just
> > use an enum for your token types.  Something like this would
> > suffice:
> 
> That's basically what sumtype is going to do for me, but (hopefully)
> more safely. Also, the token types are "user defined,"  my lexer just
> grabs everything annotated with @Token and passes those types/wrapped
> enums to sumtype.

Ah, I see what you're trying to do.


T

-- 
Why are you blatanly misspelling "blatant"? -- Branden Robinson


More information about the Digitalmars-d-learn mailing list