On 08/21/2013 07:45 PM, Andrei Alexandrescu wrote:
On 8/21/13 4:52 AM, John Colvin wrote:
On Wednesday, 21 August 2013 at 02:46:06 UTC, Dylan Knutson wrote:
Hello,
I'd like to open up discussion regarding allowing foreach loops which
iterate over a tuple of types to exist outside of function
On 08/21/2013 09:17 PM, Dicebot wrote:
They are orthogonal and not exclusive.
declaration foreach can appear whenever declaration can appear and
insert new declarations, contrary to statements of normal foreach.
static foreach is simply an improvement over existing tuple foreach
concept which
On 08/21/2013 10:53 PM, Dylan Knutson wrote:
I do like the idea of it being called 'static foreach' instead of
'foreach', to keep in step with how the rest of the language handles
other compile time constructs (static assert). Plus, as you said in your
bugreport, visual disambiguation between
On 08/22/2013 02:56 PM, Timon Gehr wrote:
AFAIK one reason why it hasn't made it in yet were implementation
issues related to DMD internals? The design was discussed in 2007's
dconf IIRC.
fixed.
On Wednesday, 21 August 2013 at 02:46:06 UTC, Dylan Knutson wrote:
[..]
--
T foo(T)(ref T thing)
{
thing++; return thing * 2;
}
foreach(Type; TupleType!(int, long, uint))
{
unittest
{
On Wednesday, 21 August 2013 at 02:46:06 UTC, Dylan Knutson wrote:
Hello,
I'd like to open up discussion regarding allowing foreach loops
which iterate over a tuple of types to exist outside of
function bodies. I think this would allow for templating
constants and unittests easier. Take, for
On Wednesday, 21 August 2013 at 10:40:10 UTC, monarch_dodra wrote:
On Wednesday, 21 August 2013 at 02:46:06 UTC, Dylan Knutson
wrote:
Hello,
I'd like to open up discussion regarding allowing foreach
loops which iterate over a tuple of types to exist outside of
function bodies. I think this
On Wednesday, 21 August 2013 at 02:46:06 UTC, Dylan Knutson wrote:
Hello,
I'd like to open up discussion regarding allowing foreach loops
which iterate over a tuple of types to exist outside of
function bodies.
I would *LOVE* to have this.
however, once we go down that route, it would be
On Wednesday, 21 August 2013 at 11:34:29 UTC, Kiith-Sa wrote:
On Wednesday, 21 August 2013 at 10:40:10 UTC, monarch_dodra
wrote:
On Wednesday, 21 August 2013 at 02:46:06 UTC, Dylan Knutson
wrote:
Hello,
I'd like to open up discussion regarding allowing foreach
loops which iterate over a
While you example can be re-written in a similar fashion with no
major issues, it would have been a very useful tool to solve the
problem with recursive template instantiation to embed
declarations.
Compare those two and count template instances:
---
Dylan Knutson:
I'd like to open up discussion regarding allowing foreach loops
which iterate over a tuple of types to exist outside of
function bodies. I think this would allow for templating
constants and unittests easier.
See:
http://d.puremagic.com/issues/show_bug.cgi?id=4085
Bye,
On Wednesday, 21 August 2013 at 13:18:22 UTC, bearophile wrote:
Dylan Knutson:
I'd like to open up discussion regarding allowing foreach
loops which iterate over a tuple of types to exist outside of
function bodies. I think this would allow for templating
constants and unittests easier.
Dicebot:
They are orthogonal and not exclusive.
declaration foreach can appear whenever declaration can
appear and insert new declarations, contrary to statements of
normal foreach. static foreach is simply an improvement over
existing tuple foreach concept which allows it to work with a
On Wednesday, 21 August 2013 at 18:52:56 UTC, bearophile wrote:
Dicebot:
This bugzilla entry is on slightly related but different topic.
declaration foreach != static foreach
I think a well implemented static foreach is able to do
anything a declaration foreach could do, and more. (If you
On Wednesday, 21 August 2013 at 10:02:33 UTC, Tommi wrote:
Why not just do this:
import std.typetuple;
T foo(T)(ref T thing)
{
thing++; return thing * 2;
}
unittest
{
foreach(Type; TypeTuple!(int, long, uint))
{
{
Type tmp = 5;
assert(foo(tmp) ==
Hello,
I'd like to open up discussion regarding allowing foreach loops
which iterate over a tuple of types to exist outside of function
bodies. I think this would allow for templating constants and
unittests easier. Take, for instance, this hypothetical example:
On Wednesday, 21 August 2013 at 02:46:06 UTC, Dylan Knutson wrote:
Hello,
I'd like to open up discussion regarding allowing foreach loops
which iterate over a tuple of types to exist outside of
function bodies. I think this would allow for templating
constants and unittests easier. Take, for
17 matches
Mail list logo