Re: Self-referential tuples?

2015-06-10 Thread Timon Gehr via Digitalmars-d
On 06/10/2015 05:52 PM, Brian Rogoff wrote: On Tuesday, 9 June 2015 at 23:48:05 UTC, Timon Gehr wrote: 'This' is a cute hack, but it doesn't replace a proper template fixpoint operator. Could you explain this a bit more, maybe using some pseudo-D for your proposed template fixpoint operator? T

Re: Self-referential tuples?

2015-06-10 Thread Brian Rogoff via Digitalmars-d
On Tuesday, 9 June 2015 at 23:48:05 UTC, Timon Gehr wrote: 'This' is a cute hack, but it doesn't replace a proper template fixpoint operator. Could you explain this a bit more, maybe using some pseudo-D for your proposed template fixpoint operator? Thanks. I don't think I'd need such a thing

Re: Self-referential tuples?

2015-06-09 Thread Timon Gehr via Digitalmars-d
On 06/10/2015 01:52 AM, Andrei Alexandrescu wrote: On 6/9/15 4:43 PM, Idan Arye wrote: The `This*` here is not mapped to `Algebraic!(Tuple!(),Tuple!(T,This*))` - it's mapped to the closest containing tuple, `Tuple!(T,This*)`. This means that the tail is not a list - it's a head and a tail. The

Re: Self-referential tuples?

2015-06-09 Thread Timon Gehr via Digitalmars-d
On 06/10/2015 01:48 AM, Timon Gehr wrote: On 06/10/2015 01:04 AM, Andrei Alexandrescu wrote: On 6/9/15 3:58 PM, Timon Gehr wrote: On 06/09/2015 05:28 PM, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply

Re: Self-referential tuples?

2015-06-09 Thread deadalnix via Digitalmars-d
On Tuesday, 9 June 2015 at 15:28:16 UTC, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple, thus allowing one to create self-referential types with ease. Consider: // A singly-li

Re: Self-referential tuples?

2015-06-09 Thread Andrei Alexandrescu via Digitalmars-d
On 6/9/15 4:43 PM, Idan Arye wrote: The `This*` here is not mapped to `Algebraic!(Tuple!(),Tuple!(T,This*))` - it's mapped to the closest containing tuple, `Tuple!(T,This*)`. This means that the tail is not a list - it's a head and a tail. The list is either empty or infinite. At any rate, I th

Re: Self-referential tuples?

2015-06-09 Thread Timon Gehr via Digitalmars-d
On 06/10/2015 01:43 AM, Idan Arye wrote: On Tuesday, 9 June 2015 at 23:04:41 UTC, Andrei Alexandrescu wrote: On 6/9/15 3:58 PM, Timon Gehr wrote: On 06/09/2015 05:28 PM, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/339

Re: Self-referential tuples?

2015-06-09 Thread Timon Gehr via Digitalmars-d
On 06/10/2015 01:04 AM, Andrei Alexandrescu wrote: On 6/9/15 3:58 PM, Timon Gehr wrote: On 06/09/2015 05:28 PM, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple, thus allowing one

Re: Self-referential tuples?

2015-06-09 Thread Idan Arye via Digitalmars-d
On Tuesday, 9 June 2015 at 23:04:41 UTC, Andrei Alexandrescu wrote: On 6/9/15 3:58 PM, Timon Gehr wrote: On 06/09/2015 05:28 PM, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple,

Re: Self-referential tuples?

2015-06-09 Thread Andrei Alexandrescu via Digitalmars-d
On 6/9/15 3:58 PM, Timon Gehr wrote: On 06/09/2015 05:28 PM, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple, thus allowing one to create self-referential types with ease. Conside

Re: Self-referential tuples?

2015-06-09 Thread Timon Gehr via Digitalmars-d
On 06/09/2015 05:28 PM, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple, thus allowing one to create self-referential types with ease. Consider: // A singly-linked list is payload

Re: Self-referential tuples?

2015-06-09 Thread Andrei Alexandrescu via Digitalmars-d
On 6/9/15 8:59 AM, Brian Rogoff wrote: On Tuesday, 9 June 2015 at 15:28:16 UTC, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple, thus allowing one to create self-referential types

Re: Self-referential tuples?

2015-06-09 Thread Brian Rogoff via Digitalmars-d
On Tuesday, 9 June 2015 at 15:28:16 UTC, Andrei Alexandrescu wrote: Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple, thus allowing one to create self-referential types with ease. Consider: // A singly-li

Self-referential tuples?

2015-06-09 Thread Andrei Alexandrescu via Digitalmars-d
Following the use of This in Algebraic (https://github.com/D-Programming-Language/phobos/pull/3394), we can apply the same idea to Tuple, thus allowing one to create self-referential types with ease. Consider: // A singly-linked list is payload + pointer to list alias List(T) = Tuple!(T, This