On Sunday, 14 June 2015 at 10:16:24 UTC, JDemler wrote:
On Sunday, 14 June 2015 at 10:04:35 UTC, John Colvin wrote:
[...]
If that is the case then i really do not get why my first
example compiles and my second does not.
The compiler sees the pragma(msg, test(e)) and runs test(e).
If test u
On Sun, 14 Jun 2015 10:29:08 +, anonymous wrote:
> One important thing I didn't see stated clearly by anyone in here:
>
> CTFE may run at compile time but it follows the same rules as run time
> evaluation (plus some restrictions).
>
> This means, you can't use dynamic values (e.g. function
On Sunday, 14 June 2015 at 10:41:24 UTC, JDemler wrote:
So if i want to use parameters in a static context at compile
time i have to pass them as template parameters?
Yes, template parameters are fine.
On Sunday, 14 June 2015 at 10:29:09 UTC, anonymous wrote:
On Sunday, 14 June 2015 at 10:10:51 UTC, ketmar wrote:
i.e. when it need a value in compile time. the interpreter is
invoked, it evaluates (interprets) the given code (function or
template instantiation), and then it returns result (or r
On Sunday, 14 June 2015 at 10:10:51 UTC, ketmar wrote:
i.e. when it need a value in compile time. the interpreter is
invoked, it evaluates (interprets) the given code (function or
template instantiation), and then it returns result (or raises
an error).
One important thing I didn't see stated
On Sunday, 14 June 2015 at 10:04:35 UTC, John Colvin wrote:
On Sunday, 14 June 2015 at 09:46:56 UTC, JDemler wrote:
On Sunday, 14 June 2015 at 05:52:00 UTC, ketmar wrote:
oh, seems that i managed to make everything even less
understandable...
Your code works perfectly and makes at least some
On Sun, 14 Jun 2015 09:46:54 +, JDemler wrote:
> On Sunday, 14 June 2015 at 05:52:00 UTC, ketmar wrote:
>> oh, seems that i managed to make everything even less understandable...
>
> Your code works perfectly and makes at least some sense to me.
> Thank you.
>
> If i understand it correctly:
On Sunday, 14 June 2015 at 09:46:56 UTC, JDemler wrote:
On Sunday, 14 June 2015 at 05:52:00 UTC, ketmar wrote:
oh, seems that i managed to make everything even less
understandable...
Your code works perfectly and makes at least some sense to me.
Thank you.
If i understand it correctly: __tr
On Sunday, 14 June 2015 at 05:52:00 UTC, ketmar wrote:
oh, seems that i managed to make everything even less
understandable...
Your code works perfectly and makes at least some sense to me.
Thank you.
If i understand it correctly: __traits-time =
templateinstatiation-time = pragma-time befo
On Sat, 13 Jun 2015 23:55:53 +, JDemler wrote:
> After a bit of rethinking:
>
> I guess the compiler goes through 2 loops:
> the first resolves __traits, the second does ctfe.
>
> That would explain this behavior. "a" is not present to the compiler
> while it tries to resolve my __traits cal
oh, seems that i managed to make everything even less understandable...
signature.asc
Description: PGP signature
On Saturday, 13 June 2015 at 23:51:32 UTC, JDemler wrote:
I have another one :)
module test;
struct S{
string member1;
int member2;
}
string test(string[] a)
{
const S s = { member1:"It is also important to go to Mars!"};
const string y = a[0];
return y;
}
void main()
{
enum e = [
I have another one :)
module test;
struct S{
string member1;
int member2;
}
string test(string[] a)
{
const S s = { member1:"It is also important to go to Mars!"};
const string y = a[0];
return y;
}
void main()
{
enum e = ["member1","member2"];
pragma(msg, e[0]);
pragma(msg, te
On Sat, 13 Jun 2015 10:36:39 +, John Colvin wrote:
> *for some reason it's not public, but it's very short and simple:
it's funny how many useful things are there in Phobos, carefully hidden
from user. i believe each D book should include an advice like this: "to
fully learn what you can do
On Saturday, 13 June 2015 at 10:01:45 UTC, JDemler wrote:
Hey,
i am trying to wrap my head around __traits.
One thing i just do not understand is following:
struct S{
string member1;
int member2;
}
void main(string[] args)
{
foreach(typeStr; __traits(allMembers, S))
{
auto tp
On Saturday, 13 June 2015 at 10:26:06 UTC, Marc Schütz wrote:
On Saturday, 13 June 2015 at 10:01:45 UTC, JDemler wrote:
Hey,
i am trying to wrap my head around __traits.
One thing i just do not understand is following:
struct S{
string member1;
int member2;
}
void main(string[] args)
{
On Saturday, 13 June 2015 at 10:01:45 UTC, JDemler wrote:
Hey,
i am trying to wrap my head around __traits.
One thing i just do not understand is following:
struct S{
string member1;
int member2;
}
void main(string[] args)
{
foreach(typeStr; __traits(allMembers, S))
{
auto tp
Hey,
i am trying to wrap my head around __traits.
One thing i just do not understand is following:
struct S{
string member1;
int member2;
}
void main(string[] args)
{
foreach(typeStr; __traits(allMembers, S))
{
auto tp = __traits(getMember, S, typeStr);
static if (__trait
18 matches
Mail list logo