On Monday, 23 April 2018 at 17:46:10 UTC, Arafel wrote:
You could also argue that function overloads are just
semantically equivalent to a single function with variadic
arguments.
It is not. As there are exact known, distinct, finite numbers and
types of arguments of functions, which can be
On Monday, 23 April 2018 at 16:52:11 UTC, Alex wrote:
On Monday, 23 April 2018 at 16:16:09 UTC, Arafel wrote:
```
import std.meta;
void main()
{
pragma(msg, __traits(getMember, A, "Foo1").stringof); //
Foo1(int N) if (N & 1)
pragma(msg, __traits(getAttributes, __traits(getMember, A,
"
On Monday, 23 April 2018 at 16:16:09 UTC, Arafel wrote:
```
import std.meta;
void main()
{
pragma(msg, __traits(getMember, A, "Foo1").stringof); //
Foo1(int N) if (N & 1)
pragma(msg, __traits(getAttributes, __traits(getMember, A,
"Foo1"))[0]); // tuple("int", "odd")
alias f1a = Ins
On Monday, 23 April 2018 at 15:44:10 UTC, Simen Kjærås wrote:
Ah, but I'm not looking to instantiate the templates, but to
learn about them - how many parameters do they take? Are their
UDAs different, so that I should warn the programmer? Must I
wrap them in different ways?
So... Do I have
I think both versions are not equivalent at all. Consider [1]:
```
import std.meta;
void main()
{
pragma(msg, __traits(getMember, A, "Foo1").stringof); // Foo1(int
N) if (N & 1)
pragma(msg, __traits(getAttributes, __traits(getMember, A,
"Foo1"))[0]); // tuple("int", "odd")
alias f1
On Monday, 23 April 2018 at 15:00:38 UTC, Alex wrote:
Ok, thats exactly the point. If you have functions
void foo() {}
void foo(int n) {}
There is no ambiguity which function will be chosen if it will
be called.
If you have templates
// form 1
template Foo(int N) if (N & 1){} // A
templ
On Monday, 23 April 2018 at 14:22:13 UTC, Simen Kjærås wrote:
As with all things D, the only real spec is the compiler source
code. :p :(
:p
Proving that two templates are equivalent is in general
impossible, since any amount of wasted computation could be
performed before the end result is
On Monday, 23 April 2018 at 13:32:49 UTC, Alex wrote:
On Monday, 23 April 2018 at 10:57:59 UTC, Simen Kjærås wrote:
There is no official definition. That's because some natural
rewrite rules are implied, which are very general, I assume...
How official do you want it to be? That's the only def
On Monday, 23 April 2018 at 10:57:59 UTC, Simen Kjærås wrote:
There is no official definition. That's because some natural
rewrite rules are implied, which are very general, I assume...
How official do you want it to be? That's the only definition
in common use by others in the context of comp
On Monday, 23 April 2018 at 08:07:52 UTC, Alex wrote:
On Monday, 23 April 2018 at 07:49:39 UTC, Simen Kjærås wrote:
That's not the definition of lowering used elsewhere, and so
will lead to confusion and misunderstanding. I would strongly
suggest you rethink your definition of lowering.
There
On Monday, 23 April 2018 at 07:49:39 UTC, Simen Kjærås wrote:
On Monday, 23 April 2018 at 04:58:38 UTC, Alex wrote:
On Monday, 23 April 2018 at 00:26:23 UTC, Simen Kjærås wrote:
There is a limited set of lowerings, and they are defined in
the language, not in user code. They include operator
o
On Monday, 23 April 2018 at 04:58:38 UTC, Alex wrote:
On Monday, 23 April 2018 at 00:26:23 UTC, Simen Kjærås wrote:
There is a limited set of lowerings, and they are defined in
the language, not in user code. They include operator
overloading (where `a op b` is translated to
`a.opBinary!op(b)`
On Monday, 23 April 2018 at 00:26:23 UTC, Simen Kjærås wrote:
// tuple("Has foo1_A")
pragma(msg, __traits(getAttributes, foo1!"a"));
// tuple("Has foo1_A")
pragma(msg, __traits(getAttributes, foo2!"a"));
// tuple("Has foo1_B")
pragma(msg, __traits(getAttributes, foo1!"b"));
// tuple("Has foo1_B")
On Sunday, 22 April 2018 at 19:27:24 UTC, Alex wrote:
On Sunday, 22 April 2018 at 18:25:29 UTC, Simen Kjærås wrote:
No lowering occurs here. A lowering is when the compiler takes
one piece of syntax and replaces it with a different one,
usually one that's more verbose.
In a way, it's kind of
On Sunday, 22 April 2018 at 18:25:29 UTC, Simen Kjærås wrote:
No lowering occurs here. A lowering is when the compiler takes
one piece of syntax and replaces it with a different one,
usually one that's more verbose.
In a way, it's kind of like a template being instantiated, in
that you write
On Saturday, 21 April 2018 at 21:10:29 UTC, Alex wrote:
On Saturday, 21 April 2018 at 19:51:05 UTC, Simen Kjærås wrote:
On Saturday, 21 April 2018 at 11:23:33 UTC, Alex wrote:
So, do you mean, that the constraint belongs to the interface
of a template?
Not necessarily - it depends on what you
On Saturday, 21 April 2018 at 19:51:05 UTC, Simen Kjærås wrote:
On Saturday, 21 April 2018 at 11:23:33 UTC, Alex wrote:
So, do you mean, that the constraint belongs to the interface
of a template?
Not necessarily - it depends on what you want to achieve. The
only thing I mean is that the code
On Saturday, 21 April 2018 at 11:23:33 UTC, Alex wrote:
On Thursday, 19 April 2018 at 17:55:47 UTC, Simen Kjærås wrote:
Your first example defines two templates (which are overloads
of the same name), the second only one. There's no ambiguity
there.
So, do you mean, that the constraint belong
On Thursday, 19 April 2018 at 17:55:47 UTC, Simen Kjærås wrote:
Your first example defines two templates (which are overloads
of the same name), the second only one. There's no ambiguity
there.
So, do you mean, that the constraint belongs to the interface of
a template?
On Thursday, 19 April 2018 at 13:57:04 UTC, Simen Kjærås wrote:
On Tuesday, 17 April 2018 at 14:22:27 UTC, Arafel wrote:
Hi!
Is there any way to get the full set of templates that are
"overloaded" (in my case, based on constraints)?
Currently, there is no way (that I've found, at least) to d
On Thursday, 19 April 2018 at 14:16:21 UTC, Alex wrote:
On Thursday, 19 April 2018 at 13:57:04 UTC, Simen Kjærås wrote:
Currently, there is no way (that I've found, at least) to do
this. If you have a workaround, that's great, but there really
should be a way - probably __traits(getOverloads).
Well, if that's the lowering, then it's indeed hard. That doesn't mean
it shouldn't happen, though... perhaps changing the lowering? I'm no
compiles expert, so no idea how).
What I'd like to get is the same that I get using
__traits(getMember,...), but repeated n times (AliasSeq perhaps?), lik
On Thursday, 19 April 2018 at 13:57:04 UTC, Simen Kjærås wrote:
Currently, there is no way (that I've found, at least) to do
this. If you have a workaround, that's great, but there really
should be a way - probably __traits(getOverloads). Having
__traits(getOverloads) return templates as well s
On Tuesday, 17 April 2018 at 14:22:27 UTC, Arafel wrote:
Hi!
Is there any way to get the full set of templates that are
"overloaded" (in my case, based on constraints)?
Currently, there is no way (that I've found, at least) to do
this. If you have a workaround, that's great, but there really
24 matches
Mail list logo