Re: How do I install a library?

2018-12-10 Thread Seb via Digitalmars-d-learn
On Monday, 10 December 2018 at 00:18:52 UTC, Murilo wrote: Hi guys, thank you for helping me out here, there is this facebook group for the D language, here we can help and teach each other. It is called Programming in D. Please join. https://www.facebook.com/groups/662119670846705/?ref=bookmar

Re: Atomic bit operations

2018-12-10 Thread Crayo List via Digitalmars-d-learn
On Tuesday, 11 December 2018 at 01:37:25 UTC, Adam D. Ruppe wrote: On Monday, 10 December 2018 at 23:20:22 UTC, Crayo List wrote: Are there atomic equivalents of bt(), btc(), bts(), btr() ... etc from core.bitop? Those are intrinsics that compile into a single cpu instruction, so they are pro

Re: Atomic bit operations

2018-12-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 10 December 2018 at 23:20:22 UTC, Crayo List wrote: Are there atomic equivalents of bt(), btc(), bts(), btr() ... etc from core.bitop? Those are intrinsics that compile into a single cpu instruction, so they are probably already atomic...

Re: Calling function explicitly from mixin template results in recursive call instead

2018-12-10 Thread Dennis via Digitalmars-d-learn
On Monday, 10 December 2018 at 21:16:23 UTC, aliak wrote: Does this fix your issue? struct S { mixin operators ops; S opBinary(string op, T)(T a) { alias opBinary = ops.opBinary; // explicitly alias opBinary in this scope return opBinary!op(a); } } It does, thanks

Atomic bit operations

2018-12-10 Thread Crayo List via Digitalmars-d-learn
Are there atomic equivalents of bt(), btc(), bts(), btr() ... etc from core.bitop? Thanks

Re: Calling function explicitly from mixin template results in recursive call instead

2018-12-10 Thread aliak via Digitalmars-d-learn
On Sunday, 9 December 2018 at 18:36:50 UTC, Dennis wrote: I'm using Adam's workaround from https://issues.dlang.org/show_bug.cgi?id=19365, but now I have endless recursion. Reduced code: ``` mixin template operators() { S opBinary(string op: "+")(S rhs) { return rhs; } //

Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread Neia Neutuladh via Digitalmars-d-learn
On Mon, 10 Dec 2018 17:58:32 +, aliak wrote: > string parseConfig(string str) { >string ret; >foreach (line; str.split("\n")) { > auto parts = line.split("="); > ret ~= `string ` ~ parts[0] ~ ` = "` parts[2] `";`; >} >return ret; > } That works as long as none of the

Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread Narxa via Digitalmars-d-learn
On Monday, 10 December 2018 at 17:47:37 UTC, Neia Neutuladh wrote: On Mon, 10 Dec 2018 11:08:23 +, Narxa wrote: Hello, people! I would like to have a constant with the value of some environment variable that is defined at compile time. In your build script, echo the environment variable

Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread aliak via Digitalmars-d-learn
On Monday, 10 December 2018 at 11:08:23 UTC, Narxa wrote: Hello, people! I would like to have a constant with the value of some environment variable that is defined at compile time. In FreePascal, it can be done by defining it in source as: VALUE_OF_SOMETHING = {$I %SOMETHING%}; And I can c

Re: How to set constant value to environment variable at compile time?

2018-12-10 Thread Neia Neutuladh via Digitalmars-d-learn
On Mon, 10 Dec 2018 11:08:23 +, Narxa wrote: > Hello, people! > > I would like to have a constant with the value of some environment > variable that is defined at compile time. In your build script, echo the environment variable into a file. Then import() that file and use the value. > I kn

Re: cannot use local f as parameter to non-global template

2018-12-10 Thread Paul Backus via Digitalmars-d-learn
On Monday, 10 December 2018 at 16:15:36 UTC, aliak wrote: Ah, that's a good way of breaking it down. But ok, so then the other version would be lowered to: template match(handlers...) { template match(T) { auto match(T holder) { return handlers[0](holder); }

Re: cannot use local f as parameter to non-global template

2018-12-10 Thread aliak via Digitalmars-d-learn
On Saturday, 8 December 2018 at 14:21:01 UTC, Paul Backus wrote: On Saturday, 8 December 2018 at 09:57:29 UTC, aliak wrote: This compiles fine. However, if I change the match template to: template match(handlers...) { auto match(alias f)(Holder!f holder) { return handlers[0](holder)

Re: How may I tell dub where to find a C library for linking?

2018-12-10 Thread Mike Parker via Digitalmars-d-learn
On Monday, 10 December 2018 at 15:38:24 UTC, Pab De Nápoli wrote: 1) Setting the LD_LIBRARY_PATH environment variable with export LD_LIBRARY_PATH=/usr/lib/llvm-6.0/lib/ and using "libs" : ["LLVM-6.0"] in dub.json. (this is somewhat nasty, it would be nice to keep all the information toget

Re: How may I tell dub where to find a C library for linking?

2018-12-10 Thread Pab De Nápoli via Digitalmars-d-learn
On Monday, 10 December 2018 at 05:24:16 UTC, evilrat wrote: On Monday, 10 December 2018 at 02:59:21 UTC, Pablo De Nápoli wrote: On my system (Debian GNU/Linux 9, 64 bits) the library is in the directory /usr/lib/llvm-6.0/lib/ $ ls -l /usr/lib/llvm-6.0/lib/libLLVM.so lrwxrwxrwx 1 root root 14

Re: Calling function explicitly from mixin template results in recursive call instead

2018-12-10 Thread Dennis via Digitalmars-d-learn
On Sunday, 9 December 2018 at 18:36:50 UTC, Dennis wrote: Does anyone know how to get this working? I added this to the mixin template: ``` alias mixinOpBinary = opBinary; ``` And called mixinOpBinary instead in the forwarded function. I think that solved it. I think I'll just file an issue f

How to set constant value to environment variable at compile time?

2018-12-10 Thread Narxa via Digitalmars-d-learn
Hello, people! I would like to have a constant with the value of some environment variable that is defined at compile time. In FreePascal, it can be done by defining it in source as: VALUE_OF_SOMETHING = {$I %SOMETHING%}; And I can call the compiler with (bash): SOMETHING='Anything' export

Re: Library settings, best practices?

2018-12-10 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Saturday, 8 December 2018 at 17:05:50 UTC, Adam D. Ruppe wrote: Alternatively, you could perhaps have it keep an internal is_initialized flag and lazily call init on your other function calls if it is not already done. Then if the user wants to customize settings, they just call init before