Re: Truly algebraic Variant and Nullable

2020-12-22 Thread 9il via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 19:45:43 UTC, Paul Backus wrote: On Tuesday, 22 December 2020 at 16:54:56 UTC, 9il wrote: On Tuesday, 22 December 2020 at 16:43:30 UTC, ag0aep6g wrote: On Tuesday, 22 December 2020 at 16:32:20 UTC, 9il wrote: "Struct non-static methods marked with the return attr

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 17:20:03 UTC, ag0aep6g wrote: On Tuesday, 22 December 2020 at 16:53:11 UTC, jmh530 wrote: For v = cast(size_t) x; I thought @safe prevented explicitly casting an immutable to a mutable, but the code below seems to suggest it is ok in this case... void main() @

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 16:54:56 UTC, 9il wrote: On Tuesday, 22 December 2020 at 16:43:30 UTC, ag0aep6g wrote: On Tuesday, 22 December 2020 at 16:32:20 UTC, 9il wrote: "Struct non-static methods marked with the return attribute ensure the returned reference will not outlive the struct

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread Atila Neves via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 04:09:59 UTC, 9il wrote: On Sunday, 20 December 2020 at 12:32:35 UTC, Petar Kirov [ZombineDev] wrote: How does your work compare to sumtype? Would mir.algebraic offer any benefits, which would make it worth switching over? replied at https://forum.dlang.org/post

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread ag0aep6g via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 16:53:11 UTC, jmh530 wrote: For v = cast(size_t) x; I thought @safe prevented explicitly casting an immutable to a mutable, but the code below seems to suggest it is ok in this case... void main() @safe { immutable x = 32; auto v = cast(size_t) x; } I

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread 9il via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 17:07:16 UTC, ag0aep6g wrote: On Tuesday, 22 December 2020 at 16:54:56 UTC, 9il wrote: On Tuesday, 22 December 2020 at 16:43:30 UTC, ag0aep6g wrote: [...] [...] If I am correct Dlang doesn't provide an instrument to validate it, isn't it? What alternative i

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread ag0aep6g via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 16:54:56 UTC, 9il wrote: On Tuesday, 22 December 2020 at 16:43:30 UTC, ag0aep6g wrote: [...] The issue isn't that the reference outlives the struct. It's that the reference outlives a tag change of the tagged union. If I am correct Dlang doesn't provide an inst

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread 9il via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 16:43:30 UTC, ag0aep6g wrote: On Tuesday, 22 December 2020 at 16:32:20 UTC, 9il wrote: "Struct non-static methods marked with the return attribute ensure the returned reference will not outlive the struct instance." The issue isn't that the reference outlives t

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread jmh530 via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 14:27:02 UTC, ag0aep6g wrote: On 22.12.20 04:56, 9il wrote: 6. Algebraic type subsets are supported by `get`, `trustedGet`, `_is`, and `this` primitives. You can operate with algebraic subset as with the type of the original typeset. [1] "trustedGet" - That na

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread ag0aep6g via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 16:32:20 UTC, 9il wrote: "Struct non-static methods marked with the return attribute ensure the returned reference will not outlive the struct instance." The issue isn't that the reference outlives the struct. It's that the reference outlives a tag change of th

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread 9il via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 14:27:02 UTC, ag0aep6g wrote: On 22.12.20 04:56, 9il wrote: 6. Algebraic type subsets are supported by `get`, `trustedGet`, `_is`, and `this` primitives. You can operate with algebraic subset as with the type of the original typeset. [1] "trustedGet" - That na

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 22 December 2020 at 03:56:13 UTC, 9il wrote: On Sunday, 20 December 2020 at 11:00:05 UTC, Tobias Pankrath wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Thanks for sharing it! Could you

Re: Truly algebraic Variant and Nullable

2020-12-22 Thread ag0aep6g via Digitalmars-d-announce
On 22.12.20 04:56, 9il wrote: 6. Algebraic type subsets are supported by `get`, `trustedGet`, `_is`, and `this` primitives. You can operate with algebraic subset as with the type of the original typeset. [1] "trustedGet" - That name smells of a safety violation. And indeed (compile with `-rel

Re: Truly algebraic Variant and Nullable

2020-12-21 Thread 9il via Digitalmars-d-announce
On Sunday, 20 December 2020 at 12:32:35 UTC, Petar Kirov [ZombineDev] wrote: How does your work compare to sumtype? Would mir.algebraic offer any benefits, which would make it worth switching over? replied at https://forum.dlang.org/post/zlphfxktclgdookqt...@forum.dlang.org If we can work toge

Re: Truly algebraic Variant and Nullable

2020-12-21 Thread 9il via Digitalmars-d-announce
On Sunday, 20 December 2020 at 11:00:05 UTC, Tobias Pankrath wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Thanks for sharing it! Could you give a (very short) explanation on why sumtype could not

Re: Truly algebraic Variant and Nullable

2020-12-21 Thread sighoya via Digitalmars-d-announce
On Sunday, 20 December 2020 at 12:38:47 UTC, Max Haughton wrote: On Sunday, 20 December 2020 at 12:32:35 UTC, Petar Kirov [ZombineDev] wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: [...] I have been using SumType [1] for a while in some of my projects and I'm quite happy wit

Re: Truly algebraic Variant and Nullable

2020-12-21 Thread Oleg B via Digitalmars-d-announce
On Sunday, 20 December 2020 at 11:00:05 UTC, Tobias Pankrath wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Thanks for sharing it! Could you give a (very short) explanation on why sumtype could not

Re: Truly algebraic Variant and Nullable

2020-12-20 Thread Max Haughton via Digitalmars-d-announce
On Sunday, 20 December 2020 at 12:32:35 UTC, Petar Kirov [ZombineDev] wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: [...] I have been using SumType [1] for a while in some of my projects and I'm quite happy with it. The author has been very responsive to feedback and the qua

Re: Truly algebraic Variant and Nullable

2020-12-20 Thread Petar via Digitalmars-d-announce
On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Nullable is defined as ``` alias Nullable(T...) = Variant!(typeof(null), T); ``` Variant and Nullable with zero types are allowed. `void` type is supported. V

Re: Truly algebraic Variant and Nullable

2020-12-20 Thread Tobias Pankrath via Digitalmars-d-announce
On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Thanks for sharing it! Could you give a (very short) explanation on why sumtype could not meet your requirements? I am just starting a new D project and have

Re: Truly algebraic Variant and Nullable

2020-12-18 Thread 9il via Digitalmars-d-announce
On Thursday, 17 December 2020 at 15:38:52 UTC, jmh530 wrote: On Thursday, 17 December 2020 at 15:12:12 UTC, 9il wrote: On Wednesday, 16 December 2020 at 16:14:08 UTC, jmh530 wrote: On Wednesday, 16 December 2020 at 15:58:21 UTC, 9il wrote: [...] What about making it into a sub-package, as in

Re: Truly algebraic Variant and Nullable

2020-12-17 Thread jmh530 via Digitalmars-d-announce
On Thursday, 17 December 2020 at 15:12:12 UTC, 9il wrote: On Wednesday, 16 December 2020 at 16:14:08 UTC, jmh530 wrote: On Wednesday, 16 December 2020 at 15:58:21 UTC, 9il wrote: [snip] Thanks! Maybe, but mir-core is quite small itself and mir.algebraic is the only part that would be extended

Re: Truly algebraic Variant and Nullable

2020-12-17 Thread 9il via Digitalmars-d-announce
On Wednesday, 16 December 2020 at 18:14:54 UTC, Oleg B wrote: On Wednesday, 16 December 2020 at 15:58:21 UTC, 9il wrote: On Wednesday, 16 December 2020 at 14:54:26 UTC, Oleg B wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: [...] Great library! Have you any plan to separate it

Re: Truly algebraic Variant and Nullable

2020-12-17 Thread 9il via Digitalmars-d-announce
On Wednesday, 16 December 2020 at 16:14:08 UTC, jmh530 wrote: On Wednesday, 16 December 2020 at 15:58:21 UTC, 9il wrote: [snip] Thanks! Maybe, but mir-core is quite small itself and mir.algebraic is the only part that would be extended or updated in the near future. Other parts are quite stab

Re: Truly algebraic Variant and Nullable

2020-12-16 Thread Oleg B via Digitalmars-d-announce
On Wednesday, 16 December 2020 at 15:58:21 UTC, 9il wrote: On Wednesday, 16 December 2020 at 14:54:26 UTC, Oleg B wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Nullable is defined as ``` alias Nulla

Re: Truly algebraic Variant and Nullable

2020-12-16 Thread jmh530 via Digitalmars-d-announce
On Wednesday, 16 December 2020 at 15:58:21 UTC, 9il wrote: [snip] Thanks! Maybe, but mir-core is quite small itself and mir.algebraic is the only part that would be extended or updated in the near future. Other parts are quite stable. If there would be a strong reason to split it, we can do i

Re: Truly algebraic Variant and Nullable

2020-12-16 Thread 9il via Digitalmars-d-announce
On Wednesday, 16 December 2020 at 14:54:26 UTC, Oleg B wrote: On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Nullable is defined as ``` alias Nullable(T...) = Variant!(typeof(null), T); ``` Variant and Null

Re: Truly algebraic Variant and Nullable

2020-12-16 Thread Oleg B via Digitalmars-d-announce
On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Nullable is defined as ``` alias Nullable(T...) = Variant!(typeof(null), T); ``` Variant and Nullable with zero types are allowed. `void` type is supported. V

Re: Truly algebraic Variant and Nullable

2020-11-15 Thread Jack Applegame via Digitalmars-d-announce
On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote: Truly algebraic Variant and Nullable with an order-independent list of types. Nullable is defined as ``` alias Nullable(T...) = Variant!(typeof(null), T); ``` Variant and Nullable with zero types are allowed. `void` type is supported. V