DIP54 : revamp of Phobos tuple types
Dicebot
public at dicebot.lv
Thu Jan 16 04:28:57 PST 2014
On Monday, 23 December 2013 at 01:39:26 UTC, Dicebot wrote:
> http://wiki.dlang.org/DIP54
>
> This is follow-up of several hot discussion threads that have
> happened several months ago. It has become pretty clear that
> there is no good way out of existing situation and least bad
> needs to be picked just to move forward (because it still be
> better than current horrible one)
>
> Linked proposal was discussed in short e-mail conversation with
> Andrei (with silent observation with Walter) and is mostly
> pre-approved. I am interested in general opinion of community
> and suggestions for any smaller tweaks before starting to work
> on pull requests.
>
> Thanks for your attention.
Small update on this.
I have chosen to go route of investigating compiler enhancement
possibilities first to allow cleaner argument pack
implementation. After some tweaks it was relatively easy to make
work these two samples:
-----
struct X
{
static int opSlice(size_t l, size_t u) { return l + u; }
}
pragma(msg, X[1..2]);
-----
and
-----
struct X
{
// note the template args
static auto opSlice(size_t l, size_t u)() { return l + u; }
}
pragma(msg, X[1..2]);
-----
However I am still struggling with more practical example:
-----
struct X(T...)
{
static auto opSlice(size_t l, size_t u)() { return
X!(T[l..u]); }
}
alias Y = (X!(1, 2, 3))[1..2];
-----
It seems to take completely different processing path, one that
does not allow obvious syntax rewriting before semantic pass. I
think I'll throw few more weeks into trying this and proceed with
crappy alternative upon failure.
More information about the Digitalmars-d
mailing list