Commit graph

71 commits

Author SHA1 Message Date
Sönke Ludwig 50e80dc0d9
Add apply() to generically extract the contained value.
See also #3.
2017-05-28 22:05:19 +02:00
Sönke Ludwig e4c5ec700a Add non-ref overload of get(). 2016-11-22 18:02:34 +01:00
Sönke Ludwig 4a506f458b Make TaggedAlgebraic.Union public. 2016-11-21 20:21:23 +01:00
Sönke Ludwig 537f17f71a Add assertion error message. 2016-11-21 20:20:14 +01:00
Sönke Ludwig 58a1cc274f Add a proper workaround for the void intializer error in DMD 2.072.0-b2. 2016-10-10 12:32:42 +02:00
Sönke Ludwig baad665621 Work around stricter memory-safety checks in DMD 2.072.0-b2. 2016-10-10 11:16:55 +02:00
Nick Sabalausky 8197549929 Document basic usage. 2016-09-20 00:52:02 -04:00
Sönke Ludwig a0415ed13c Improve dynamic type conversion.
- Uses std.conv.to to implement opCast instead of just supporting implicit type conversions
- Adds .toString to make to!string(ta) return the expected result
2016-04-04 13:40:58 +02:00
Sönke Ludwig 89e90b962f Fix unit test. See #2. 2016-01-27 23:11:32 +01:00
Sönke Ludwig df23609f3d Fix "statement not reachable" errors. 2015-12-06 14:57:30 +01:00
Sönke Ludwig 96f18356f7 Output a proper error message when using hasType with an invalid type. Fixes #1. 2015-08-27 11:27:57 +02:00
Sönke Ludwig 84d6c8da80 Rename "type" to "kind".
Although there will be situations where the enum names equal the name of the types stored in a TaggedAlgebraic, "type" is often not the right term. It's also possible to define multiple fields of the same type, but with different names. "Kind" is used now as a more generic alternative.
2015-08-27 11:00:16 +02:00
Sönke Ludwig d02baa57ac Add opBinaryRight forwarding. 2015-08-17 15:53:47 +02:00
Sönke Ludwig f8835076f8 Improve operator forwarding.
- Added @disableIndex to disable opIndex forwarding for certain fields
- Added field/properly forwarding
- Fixed binary operator overloading
- Allow implicit conversions when trying to match return types to TaggedAlgebraic during operator return type deduction
2015-08-17 15:49:32 +02:00
Sönke Ludwig 8fba150b03 Add limited support for operations where the RHS is a TaggedAlgebraic. 2015-08-14 11:24:54 +02:00
Sönke Ludwig d38c8d472d Add some more tests. 2015-08-13 23:43:09 +02:00
Sönke Ludwig f06a793dae Add support for opCall forwarding and add default assignment operator. 2015-08-13 16:11:30 +02:00
Sönke Ludwig d901bfa810 Add UFCS functions get and hasType. 2015-08-13 15:59:50 +02:00
Sönke Ludwig e53ae02ec6 Fix postblit/destructor handling and partially fix compilation on DMD 2.067.1.
Also allow to use a struct instead of a union to pass the fields to TaggedAlgebraic (because union doesn't allow fields with postblit/destructor).
2015-08-13 15:30:32 +02:00
Sönke Ludwig ed96f7652f Comment-in descruct() call. 2015-08-13 12:53:31 +02:00
Sönke Ludwig 2e8d0b29dd Initial commit of a first working version. 2015-08-13 11:54:39 +02:00