I can see them:
import std.traits;
struct foo;
struct bar;
void f(@foo int, @foo @bar @("baz") real);
pragma(msg, Parameters!f);
// (@(foo) int, @(tuple(tuple(foo), tuple(bar)),
tuple("baz")) real)
...but I cannot find how to get hold of them:
pragma(msg, (Myste
On Tuesday, 14 April 2020 at 21:35:12 UTC, Jean-Louis Leroy wrote:
I can see them:
There's some weird tricks to it. Check out my old blog sidebar
about it here:
http://dpldocs.info/this-week-in-d/Blog.Posted_2019_02_11.html#how-to-get-uda-on-a-function-param
On Tuesday, 14 April 2020 at 21:44:51 UTC, Adam D. Ruppe wrote:
On Tuesday, 14 April 2020 at 21:35:12 UTC, Jean-Louis Leroy
wrote:
I can see them:
There's some weird tricks to it. Check out my old blog sidebar
about it here:
http://dpldocs.info/this-week-in-d/Blog.Posted_2019_02_11.html#how
On Tuesday, 14 April 2020 at 21:54:14 UTC, Jean-Louis Leroy wrote:
O.kay. It looks like `is` is D's Swiss army chainsaw.
Aye, is and __traits are the two built-in compile-time reflection
avenues. The phobos std.traits things (for the most part, look at
the source for the default parameter
On Wed, Apr 15, 2020 at 12:01:51AM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
[...]
> is() is a bit weird, but I described it in my "D Cookbook" to some
> success... and writing that description helped me make sense of it.
> The docs list like seven forms of it, but they are mostly just o
Thanks to both of you!
As part of implementing full support for attributes in
openmethods, I am developing a reflection library. That helped a
lot.
is() is a bit weird, but I described it in my "D Cookbook" to
some success...
I am going to order it...even though it is not available on
Kin
Alas the presence of parameter UDAs breaks
std.traits.ParameterDefaults:
import std.traits;
struct attr;
void f(@attr int);
pragma(msg, ParameterDefaults!f.stringof);
Error:
dmd -c bug.d
bug.d(4): Error: undefined identifier `attr`, did you mean
variable `ptr`?
/home/jll/dlang/dmd-2.090.1/
On Friday, 17 April 2020 at 16:40:15 UTC, Jean-Louis Leroy wrote:
Alas the presence of parameter UDAs breaks
std.traits.ParameterDefaults:
import std.traits;
struct attr;
void f(@attr int);
This part seems fine...
pragma(msg, ParameterDefaults!f.stringof);
It is this, specifically, that
On Friday, 17 April 2020 at 16:54:42 UTC, Adam D. Ruppe wrote:
This part seems fine...
pragma(msg, ParameterDefaults!f.stringof);
It is this, specifically, that causes the problem. Replace it
with:
void main() {
import std.stdio;
writeln(ParameterDefaults!f.stringof);
}
an
On Friday, 17 April 2020 at 16:54:42 UTC, Adam D. Ruppe wrote:
void main() {
import std.stdio;
writeln(ParameterDefaults!f.stringof);
}
and it is fine.
Well, can't do. I need this purely at compile time, and
cross-module. That's for supporting UDAs and default parameter
value
On Fri, Apr 17, 2020 at 05:33:23PM +, Simen Kjærås via Digitalmars-d-learn
wrote:
> On Friday, 17 April 2020 at 16:54:42 UTC, Adam D. Ruppe wrote:
[...]
> > So pragma(msg) is doing something really weird, the bug doesn't
> > appear to be in Phobos per se, I think it is the compiler doing the
>
On Friday, 17 April 2020 at 17:31:32 UTC, Jean-Louis Leroy wrote:
Well, can't do. I need this purely at compile time, and
cross-module.
And the CTFE engine gets weird with it too dmd will have to
fix this.
But default parameters might not be possible in general at CT
anyway... it is act
On Friday, 17 April 2020 at 17:48:06 UTC, Adam D. Ruppe wrote:
On Friday, 17 April 2020 at 17:31:32 UTC, Jean-Louis Leroy
wrote:
Well, can't do. I need this purely at compile time, and
cross-module.
And the CTFE engine gets weird with it too dmd will have to
fix this.
But default parame
On Friday, 17 April 2020 at 18:05:39 UTC, Jean-Louis Leroy wrote:
Interesting example, but all hope is not lost. `a` could
(should?) be passed as an alias in __parameters.
Okay I take this back...
On Friday, 17 April 2020 at 18:05:39 UTC, Jean-Louis Leroy wrote:
Interesting example, but all hope is not lost. `a` could
(should?) be passed as an alias in __parameters.
Well, __parameters itself actually kinda works. The compiler
knows it is an expression and can stringify it or evaluate it
On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh wrote:
I wonder if the ultimate cause of the above case is ultimately
caused by
the change to import semantics that hid private symbols from
outside the
module. Perhaps something, somewhere, is triggering an illegal
access of
a private
On Saturday, 18 April 2020 at 09:19:48 UTC, Simen Kjærås wrote:
On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh
wrote:
I wonder if the ultimate cause of the above case is ultimately
caused by
the change to import semantics that hid private symbols from
outside the
module. Perhaps s
17 matches
Mail list logo