On 2013-08-20 01:51, Marek Janukowicz wrote:
Thanks, but how do I get the list of members that are of instantiated
Setting struct type? If I do it like this:
alias type = typeof(__traits(getMember, this, s));
if (is ( type == Setting))
I get:
Error: struct aa.Setting(T, string desc, T
Perhaps this thread deserves a D implementation with a small
explanation regarding D:
http://www.reddit.com/r/programming/comments/1kof0q/on_partiallyconstructed_objects/
(__ctWriteln is not yet available in D.)
Bye,
bearophile
H. S. Teoh wrote:
> On Tue, Aug 20, 2013 at 01:09:16AM +0200, Marek Janukowicz wrote:
>> Jacob Carlborg wrote:
> [...]
>> > In "settings" you should be able to:
>> >
>> > 1. Iterate over all fields of the type Setting using
>> > __tratis(derivedMembers)
>>
>> How do I do that? My understanding o
On Tue, Aug 20, 2013 at 01:09:16AM +0200, Marek Janukowicz wrote:
> Jacob Carlborg wrote:
[...]
> > In "settings" you should be able to:
> >
> > 1. Iterate over all fields of the type Setting using
> > __tratis(derivedMembers)
>
> How do I do that? My understanding of types in case of templates i
On Monday, August 19, 2013 12:18:36 Borislav Kosharov wrote:
> So if I want to have a string constant it is a lot better to
> declare it as:
>
> static immutable string MY_STRING = "Some string";
>
> Because it won't be duplicated?
Even if you copy-pasted "Some string" in your code thousands of
Jacob Carlborg wrote:
> On 2013-08-15 00:29, Marek Janukowicz wrote:
>> I need to have a generalized "settings" functionality that should work
>> like this:
>> * I need to be able to add this to a class
>> * each setting has its name, description, type and default value
>> * I need to iterate over
On Monday, 19 August 2013 at 18:28:24 UTC, Dicebot wrote:
On Monday, 19 August 2013 at 18:21:26 UTC, Craig Dillabaugh
wrote:
I am still curious though was is wrong using UDAs inside
main().
It is not exactly about UDA - key is different meaning of curly
brace {} syntax in function bodies and
So I was using D as an alternative back-end to the R programming
language. R provides a way to call into C and CPP DLLs, so what I
did was let the default C/CPP compiler compile the initial C code
into a DLL, then collect all the object files link together with
D code created by DMD...
I upda
On 08/19/2013 03:18 AM, Borislav Kosharov wrote:> So if I want to have a
string constant it is a lot better to declare it as:
>
> static immutable string MY_STRING = "Some string";
>
> Because it won't be duplicated?
enum is fine with strings.
It is a common space optimization of the compilers
On Monday, 19 August 2013 at 18:21:26 UTC, Craig Dillabaugh wrote:
I am still curious though was is wrong using UDAs inside main().
It is not exactly about UDA - key is different meaning of curly
brace {} syntax in function bodies and in declaration scopes.
Used in declaration scope {} apply
On Monday, 19 August 2013 at 18:01:40 UTC, Jacob Carlborg wrote:
On 2013-08-19 19:57, Craig Dillabaugh wrote:
When I attempt to compile the following example code from the
section on UDAs
at: http://dlang.org/attribute.html
void main(string args[]) {
template Tuple (T...)
{
alias T Tu
On 2013-08-19 19:57, Craig Dillabaugh wrote:
When I attempt to compile the following example code from the
section on UDAs
at: http://dlang.org/attribute.html
void main(string args[]) {
template Tuple (T...)
{
alias T Tuple;
}
enum EEE = 7;
@("hello") struct SSS { }
@(3) { @(4) @EEE
When I attempt to compile the following example code from the
section on UDAs
at: http://dlang.org/attribute.html
void main(string args[]) {
template Tuple (T...)
{
alias T Tuple;
}
enum EEE = 7;
@("hello") struct SSS { }
@(3) { @(4) @EEE @SSS int foo; }
alias Tuple!(__traits(getAttri
On Monday, 19 August 2013 at 17:03:18 UTC, Brad Anderson wrote:
Ok, that helps me understand how to do it with recursion and
mixin templates. I ended up doing it like this:
http://dpaste.dzfl.pl/14864b1b with help from Jakob Ovrum in
IRC.
Yes, if you can stick to semantics close to built-in
On 2013-08-19 00:31, JS wrote:
module main;
import std.stdio, std.conv;
template foo(alias T)
{
string foo(string s)
{
string x = to!string(T) ~ s ~ "";
//pragma(msg, x); // pragma see's x as a run time variable(or rather pragma is
executed before x is truly defined)
return x;
}
well, i
On Monday, 19 August 2013 at 16:40:45 UTC, Dicebot wrote:
On Monday, 19 August 2013 at 06:56:24 UTC, Brad Anderson wrote:
...
I remember asking Andrei on IRC about feature as "declaration
foreach" to exactly simplify such patterns. He kind of agreed
it may be useful and wanted to consult wit
On Monday, 19 August 2013 at 16:22:21 UTC, John Colvin wrote:
On Monday, 19 August 2013 at 06:56:24 UTC, Brad Anderson wrote:
import std.typetuple;
struct S(T...)
{
alias Types = T;
}
alias Si = S!(int, short);
alias Sf = S!(float, double);
template STypes(STy) { alias STypes = STy.Ty
On Monday, 19 August 2013 at 06:56:24 UTC, Brad Anderson wrote:
...
I remember asking Andrei on IRC about feature as "declaration
foreach" to exactly simplify such patterns. He kind of agreed it
may be useful and wanted to consult with Walter if it is worth a
DIP but seems like everyone incl
On Monday, 19 August 2013 at 06:56:24 UTC, Brad Anderson wrote:
import std.typetuple;
struct S(T...)
{
alias Types = T;
}
alias Si = S!(int, short);
alias Sf = S!(float, double);
template STypes(STy) { alias STypes = STy.Types; }
struct B(Ss...)
{
alias CombinedTypes =
On Monday, 19 August 2013 at 12:38:42 UTC, bearophile wrote:
monarch_dodra:
But yes, I think we need to document better.
Eventually it will be a good idea to add tests inside the
Phobos unittests to make sure functions keep being CTFE-able. I
have seen many regressions on this along the tim
monarch_dodra:
But yes, I think we need to document better.
Eventually it will be a good idea to add tests inside the Phobos
unittests to make sure functions keep being CTFE-able. I have
seen many regressions on this along the time.
Bye,
bearophile
On Monday, 19 August 2013 at 11:34:48 UTC, bearophile wrote:
Borislav Kosharov:
How do I know which functions are CTFE?
While Don improve CTFE, the number of CTFE-able functions
increases.
What bearophile said. The amount of functions that can be CTFE'd
is increasing everyday.
It *would
Borislav Kosharov:
How do I know which functions are CTFE?
While Don improve CTFE, the number of CTFE-able functions
increases.
I know for DDoc, bootDoc and others, but none of them(not sure)
can replace attributes like @property, pure, static and others
with icons.
Perhaps with ddoc y
Am 19/08/2013 12:02, schrieb Andrej Mitrovic:
On 8/19/13, Andrej Mitrovic wrote:
Thinking about it some more I think the .info field is empty because
there's nothing really to trace, if I write the whole exception via
writeln(thr) rather than writeln(thr.info), I'll get back the
file+line of th
How do I know which functions are CTFE? I mean from the ones in
std. I think there should be some icon or marker in the docs that
indicates which function can be called during compilation.
I remember that there was a compile time bool that checks if the
current function is called during compil
So if I want to have a string constant it is a lot better to
declare it as:
static immutable string MY_STRING = "Some string";
Because it won't be duplicated?
On 8/19/13, Andrej Mitrovic wrote:
> Nevermind, I was printing out the wrong file, there really is some
> kind of bug here. Anyway I'll file a small test-case to bugzilla.
So it turns out it has nothing to do with the win32 subsystem:
http://d.puremagic.com/issues/show_bug.cgi?id=10851
On 8/19/13, Andrej Mitrovic wrote:
> Thinking about it some more I think the .info field is empty because
> there's nothing really to trace, if I write the whole exception via
> writeln(thr) rather than writeln(thr.info), I'll get back the
> file+line of the failed assert, which should be enough f
On 8/19/13, Benjamin Thaut wrote:
> D should be calling the module constructors in the correct order so that
> the windows stack trace module (core.sys.windows.stacktrace) is
> initialized first. If this is not the case you might need to import the
> module into your main file to make sure that it
Am 18/08/2013 16:35, schrieb Andrej Mitrovic:
$ dmd -g -L/SUBSYSTEM:WINDOWS:5.01 -run test.d && type stderr.log
$ thr.info: null
If I copy-paste the code from the module ctor into main then thr.info
has the proper stack trace information.
Should I be calling some runtime initialization functio
On Monday, 19 August 2013 at 06:56:24 UTC, Brad Anderson wrote:
import std.typetuple;
struct S(T...)
{
alias Types = T;
}
alias Si = S!(int, short);
alias Sf = S!(float, double);
template STypes(STy) { alias STypes = STy.Types; }
struct B(Ss...)
{
alias CombinedTypes =
import std.typetuple;
struct S(T...)
{
alias Types = T;
}
alias Si = S!(int, short);
alias Sf = S!(float, double);
template STypes(STy) { alias STypes = STy.Types; }
struct B(Ss...)
{
alias CombinedTypes =
NoDuplicates!(TypeTuple!(staticMap!(STypes, Ss)));
32 matches
Mail list logo