Cannot access frame of <insert whatever here>
simendsjo
simendsjo at gmail.com
Thu Sep 12 13:34:47 PDT 2013
I haven't done any D coding since May, but picked up my little
toy code again now.
Last time I had a lot of hassle with not being able to
store/access symbols through templates, and I got the same thing
now.
Am I the only one hitting these all the time?
I'm basically playing around with UDAs:
@notNull class A {
@matches("[0-9]+") string s;
@interval!"[)"(0, 10) int i;
}
void f(A a) {
mixin enforceValidParameters;
enforceValidParameters();
}
f(null); // Throws because a is null
f(new A()); // Throws because a.s doesn't match and i isn't
within [0,10)
I need a mixin there because I haven't found another way of
getting the correct function without passing any parameters. And
the second call because the mixin cannot call any code itself,
only declare.
.. But the above doesn't work. I have to do this instead:
void f(A a, A b) {
validate!(a, b)();
}
which doesn't scale. It's bad enough that I need to run a
function after mixing in code.
.. Just a bit of a rant - unable to access frames sucks :/
More information about the Digitalmars-d-learn
mailing list