On Mon, May 10, 2010 at 2:22 PM, Masahiro Nakagawa <[email protected]> wrote:
> Hi,
>
> Currently, Phobos has Tuple but doesn't have tie.
> So I implemented tie for std.typecons.Tuple.
>
> http://www.bitbucket.org/repeatedly/scrap/src/tip/tie_.d
>
> Original author is 9rnsr but his version is a bit messy and overkill.
> I substantially rewrote his tie.
> - clear syntax (tie(&n, &d) => tie(n, d))
> - Implicit conversion
>
> I would like to suggest this tie is integrated into phobos.
>
> What do you think of this?
> _______________________________________________
> phobos mailing list
> [email protected]
> http://lists.puremagic.com/mailman/listinfo/phobos
>

Looks great. Just 2 questions:
1) Does chaining works? I.e.
tie(a, b) = tie(c, d) = tuple(1,2); // a = b = 1, b = c = 2

2) You could probably use __dollar for ignored elements, to prevent
namespace pollution and symbol conflicts:
tie(a, $) = tuple(1, 2); // a = 1

This leads to another idea: Phobos should have struct Dolllar and
global __dollar variable so that everyone don't have to redefine it,
just import some Phobos module and use it.
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to