[phobos] tie for std.typecons.Tuple

Denis 2korden at gmail.com
Mon May 10 10:44:02 PDT 2010


On Mon, May 10, 2010 at 7:44 PM, Masahiro Nakagawa <repeatedly at gmail.com> wrote:
> On Mon, 10 May 2010 21:32:00 +0900, Denis <2korden at gmail.com> wrote:
>
>> 2) You could probably use __dollar for ignored elements, to prevent
>> namespace pollution and symbol conflicts:
>> tie(a, $) = tuple(1, 2); // a = 1
>
> I don't understand this. Please show me example.
> I tried following code with dmd 2.046 beta:
> -----
> import std.stdio;
>
> struct Dollar {}
> __gshared Dollar __dollar;
>
> void main()
> {
>    writeln($);
> }
>
> // foo.d(8): '$' is valid only inside [] of index or slice
> -----
> Umm...
>

My bad, it is indeed disallowed outside of opSlice. Didn't know that.


More information about the phobos mailing list