I have found the problem.
It was the nested mixin that was causing the scope degradation
(not sure if that is intended behaviour).
The correct way to iterate through members and get their
attribute is like this:
foreach(member; __traits(allMembers,T))
{
I think it is a bug.
Executing linked code from a mixin statement should not reduce
the scope of the mixin, IMHO.
I will file a bug report.
On Saturday, 25 October 2014 at 21:35:44 UTC, Ali Çehreli wrote:
On 10/25/2014 08:56 AM, Rares Pop wrote:
> Indeed it worked. What is the rationale behi
On 10/25/2014 08:56 AM, Rares Pop wrote:
> Indeed it worked. What is the rationale behind the mixin(fullName) ?
__traits(getAttributes) requires a symbol but fullName is a string.
Mixing it in as code fulfills the requirement.
> However, in my project the injections function, the @Inject UDA
On Saturday, 25 October 2014 at 16:01:29 UTC, Rares Pop wrote:
I've uploaded the code here:
https://github.com/fusionbeam/infuse
compiling with ldc2 exhibits the same behaviour.
'Error: undefined identifier B'
I've uploaded the code here:
https://github.com/fusionbeam/infuse
Ali,
Many thanks for your help.
Indeed it worked. What is the rationale behind the
mixin(fullName) ?
However, in my project the injections function, the @Inject UDA
struct and some other dependencies are defined in a library
(libinfuse).
In this format the compiler gives the undefined ident
Ali,
Many thanks for your help.
What is the rationale for mixin(fullName) ?
On 10/25/2014 07:45 AM, Rares Pop wrote:
On Saturday, 25 October 2014 at 13:53:35 UTC, Adam D. Ruppe wrote:
On Saturday, 25 October 2014 at 13:45:29 UTC, Rares Pop wrote:
What do you mean by copy/pasting ?
I literally copied the code in your post (and fixed a missing
semicolon) and got it to
On Saturday, 25 October 2014 at 13:53:35 UTC, Adam D. Ruppe wrote:
On Saturday, 25 October 2014 at 13:45:29 UTC, Rares Pop wrote:
What do you mean by copy/pasting ?
I literally copied the code in your post (and fixed a missing
semicolon) and got it to compile.
Passing A as an argument to in
On Saturday, 25 October 2014 at 13:45:29 UTC, Rares Pop wrote:
What do you mean by copy/pasting ?
I literally copied the code in your post (and fixed a missing
semicolon) and got it to compile.
Passing A as an argument to injections should work. You can also
use this and typeof(this) inside
Thanks for the quick response.
What do you mean by copy/pasting ?
On Saturday, 25 October 2014 at 13:40:56 UTC, Adam D. Ruppe wrote:
On Saturday, 25 October 2014 at 13:37:56 UTC, Rares Pop wrote:
Aiming to generate code based on UDA I wonder if the following
is possible:
Yes, and copy/pasting
On 2014-10-25 13:37:54 +, Rares Pop said:
Hello everyone,
I am trying to understand UDA traits scoping while mixing in code.
Aiming to generate code based on UDA I wonder if the following is possible:
class A
{
@Inject
Logger logger;
@Inject
SomeOtherClass dependency;
On Saturday, 25 October 2014 at 13:37:56 UTC, Rares Pop wrote:
Aiming to generate code based on UDA I wonder if the following
is possible:
Yes, and copy/pasting that works for me...
Hello everyone,
I am trying to understand UDA traits scoping while mixing in code.
Aiming to generate code based on UDA I wonder if the following is
possible:
class A
{
@Inject
Logger logger;
@Inject
SomeOtherClass dependency;
mixin injections!(A)
...
}
In "injections" funct
14 matches
Mail list logo