Re: Static constructors in structs.

2015-10-30 Thread BBasile via Digitalmars-d-learn
On Friday, 30 October 2015 at 20:58:37 UTC, anonymous wrote: On 30.10.2015 21:23, TheFlyingFiddle wrote: Is this intended to work? struct A { __gshared static this() { //Add some reflection info to some global stuff. addReflectionInfo!(typeof(this)); } } I just

Re: Static constructors in structs.

2015-10-30 Thread BBasile via Digitalmars-d-learn
On Friday, 30 October 2015 at 21:29:22 UTC, BBasile wrote: On Friday, 30 October 2015 at 20:58:37 UTC, anonymous wrote: On 30.10.2015 21:23, TheFlyingFiddle wrote: Is this intended to work? struct A { __gshared static this() { //Add some reflection info to some global stuff.

Re: Static constructors in structs.

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
On Friday, 30 October 2015 at 21:29:22 UTC, BBasile wrote: __gshared is mostly usefull on fields (eg public uint a) because it prevents a data to be put on the TLS, which in certain case reduces the perfs up to 30%. The byte code using a global variable that's not __gshared can be incredibly

Static constructors in structs.

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
Is this intended to work? struct A { __gshared static this() { //Add some reflection info to some global stuff. addReflectionInfo!(typeof(this)); } } I just noticed this works in 2.069, is this intended? I mean I love it! It makes it possible to do lot's of useful mixins

Re: Static constructors in structs.

2015-10-30 Thread anonymous via Digitalmars-d-learn
On 30.10.2015 21:23, TheFlyingFiddle wrote: Is this intended to work? struct A { __gshared static this() { //Add some reflection info to some global stuff. addReflectionInfo!(typeof(this)); } } I just noticed this works in 2.069, is this intended? static

Re: Static constructors in structs.

2015-10-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 30 October 2015 at 20:23:45 UTC, TheFlyingFiddle wrote: I just noticed this works in 2.069, is this intended? I thought it always worked. The __gshared there I'm pretty sure doesn't do anything and should prolly be removed. The two forms are `static this` which is called for each

good reasons not to use D?

2015-10-30 Thread Laeeth Isharc via Digitalmars-d-learn
I'm writing a talk for codemesh on the use of D in finance. I want to start by addressing the good reasons not to use D. (We all know what the bad ones are). I don't want to get into a discussion here on them, but just wanted to make sure I cover them so I represent the state of affairs

How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
I want to be able to do something like this: enum a = 32 enum b = { q,w,e,r,t,y } CtType ctype = getCtType!(a); // -> Would become CtType.enumConstant CtType ctype1 = getCtType!(b); // -> Would become CtType.enum_

Re: How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
On Friday, 30 October 2015 at 11:46:43 UTC, TheFlyingFiddle wrote: I want to be able to do something like this: enum a = 32 enum b = { q,w,e,r,t,y } CtType ctype = getCtType!(a); // -> Would become CtType.enumConstant CtType ctype1 = getCtType!(b); // -> Would become CtType.enum_ Never

Re: Failed 'dub run' with 'Failed to invoke the compiler dmd'

2015-10-30 Thread Timoses via Digitalmars-d-learn
dub run -v Linking... dmd -of.dub/build/standalone-debug-posix.osx-x86_64-dmd_2068-4E2C9DFD17A7951AAA2F7856AB27FB45/vibelog .dub/build/standalone-debug-posix.osx-x86_64-dmd_2068-4E2C9DFD17A7951AAA2F7856AB27FB45/vibelog.o ../../.dub/packages/stringex-0.0.2/libstringex.a

Re: Failed 'dub run' with 'Failed to invoke the compiler dmd'

2015-10-30 Thread Timoses via Digitalmars-d-learn
On Saturday, 31 October 2015 at 03:38:57 UTC, Mike Parker wrote: How did you install DMD? I didn't : P. First hurdle taken. It now compiles. However, I get a linking error: Linking... ld: library not found for -levent clang: error: linker command failed with exit code 1 (use -v to see

Re: good reasons not to use D?

2015-10-30 Thread ref2401 via Digitalmars-d-learn
On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote: I'm writing a talk for codemesh on the use of D in finance. I want to start by addressing the good reasons not to use D. (We all know what the bad ones are). I don't want to get into a discussion here on them, but just wanted

Re: Failed 'dub run' with 'Failed to invoke the compiler dmd'

2015-10-30 Thread Timoses via Digitalmars-d-learn
On Saturday, 31 October 2015 at 04:00:18 UTC, Timoses wrote: Linking... ld: library not found for -levent clang: error: linker command failed with exit code 1 (use -v to see invocation) --- errorlevel 1 dmd failed with exit code 1. Seems to be fixed by editing dmd.conf (added

Re: Failed 'dub run' with 'Failed to invoke the compiler dmd'

2015-10-30 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 31 October 2015 at 03:00:46 UTC, Timoses wrote: Hey, just getting started with D. I wanted to try out Vibelog. However, when trying to run dub run I receive the error: Failed to invoke the compiler dmd to determine the build platform: /bin/sh: dmd: command not found I'm on

Re: Static constructors in structs.

2015-10-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 30 October 2015 at 21:29:22 UTC, BBasile wrote: __gshared is mostly usefull on fields (eg public uint a) That's only true if it is at the module level or static. Ordinary struct members are whatever the container is and class members are on the heap unless you do something fancy.

Failed 'dub run' with 'Failed to invoke the compiler dmd'

2015-10-30 Thread Timoses via Digitalmars-d-learn
Hey, just getting started with D. I wanted to try out Vibelog. However, when trying to run dub run I receive the error: Failed to invoke the compiler dmd to determine the build platform: /bin/sh: dmd: command not found I'm on OSX - El Capitan and installed dub over Homebrew. Bests,

Re: How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 30 October 2015 at 12:18:21 UTC, Gary Willoughby wrote: On Friday, 30 October 2015 at 12:03:50 UTC, TheFlyingFiddle wrote: pragma(msg, is(b == enum)); //True pragma(msg, is(a == enum)); //False. enum isEnum(alias e) = is(e == enum); isEnum!(a) isEnum!(b) ;) isEnum!(isEnum)

Re: How can I distinguish an enum constant from an actual enum at compile time?

2015-10-30 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 30 October 2015 at 12:03:50 UTC, TheFlyingFiddle wrote: pragma(msg, is(b == enum)); //True pragma(msg, is(a == enum)); //False. enum isEnum(alias e) = is(e == enum); isEnum!(a) isEnum!(b) ;)

Re: Static constructors in structs.

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
On Friday, 30 October 2015 at 20:58:37 UTC, anonymous wrote: On 30.10.2015 21:23, TheFlyingFiddle wrote: Is this intended to work? struct A { __gshared static this() { //Add some reflection info to some global stuff. addReflectionInfo!(typeof(this)); } } I just

Re: Static constructors in structs.

2015-10-30 Thread TheFlyingFiddle via Digitalmars-d-learn
On Friday, 30 October 2015 at 20:59:46 UTC, Adam D. Ruppe wrote: On Friday, 30 October 2015 at 20:23:45 UTC, TheFlyingFiddle wrote: But yeah, the struct feature table http://dlang.org/struct.html shows them as checked. I gotta say the language documentation is shaping up nicely.