Re: Struct constructor, opCall mess.

2014-02-25 Thread Maxim Fomin
On Monday, 24 February 2014 at 14:14:43 UTC, Tobias Pankrath wrote: On Monday, 24 February 2014 at 13:56:01 UTC, Remo wrote: Hi, right now I am truing to figure out how the constructors behave in D2. Question 1: why it is not possible to create custom ctor for struct? The design of D reli

Re: Scalability in std.parallelism

2014-02-25 Thread thedeemon
On Monday, 24 February 2014 at 14:34:14 UTC, Russel Winder wrote: Two cores with hyperthreads generally means a maximum speed up of 2 with optimized native code. Not true. If the code is not trivial and the threads are not doing exactly same instructions (i.e. they can do some search where n

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Vladimir Panteleev
On Tuesday, 25 February 2014 at 12:45:06 UTC, Cherry wrote: Hello I want to define an enum int, but I want to make it possible to set its value when I run dmd from the command line. Is it possible in D? No, D does not allow passing values via the compiler command line. You can use the -debu

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
On Tuesday, 25 February 2014 at 12:57:51 UTC, Dejan Lekic wrote: On Tuesday, 25 February 2014 at 12:45:06 UTC, Cherry wrote: Hello I want to define an enum int, but I want to make it possible to set its value when I run dmd from the command line. Is it possible in D? Regards Cherry D offe

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
On Tuesday, 25 February 2014 at 12:45:06 UTC, Cherry wrote: Hello I want to define an enum int, but I want to make it possible to set its value when I run dmd from the command line. Is it possible in D? Regards Cherry D offers version blocks: http://dlang.org/version.html#version It would

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Tobias Pankrath
module myproggy; import std.stdio; enum foo = 5; enum bar = "walter"; int main() { writeln(bar); return foo; } ... and you call compiler like: dmd myproggy.d -Dfoo=42 -Dbar=hello smart, new D compiler would replace enums (iff they exist in the source code) with the given arguments, so

D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Cherry
Hello I want to define an enum int, but I want to make it possible to set its value when I run dmd from the command line. Is it possible in D? Regards Cherry

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
On Tuesday, 25 February 2014 at 13:21:38 UTC, bearophile wrote: Dejan Lekic: And yes, if someone builds multiple modules, he/she would have to use fully-qualified name. Example: dmd foo.d bar.d -Dfoo.var1=5 -Dbar.var4=walter If you are interested in such things I suggest you to take a look

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread bearophile
Dejan Lekic: And yes, if someone builds multiple modules, he/she would have to use fully-qualified name. Example: dmd foo.d bar.d -Dfoo.var1=5 -Dbar.var4=walter If you are interested in such things I suggest you to take a look at how the Fortress language does them. Bye, bearophile

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Dejan Lekic
I don't like it. I would prefer a CTFE-able counter part to boost::program_options that generates thouse enums from a config file. If you want a config file, you do not need -D args. You simply import() it. Right?

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Cherry
I don't like it. I would prefer a CTFE-able counter part to boost::program_options that generates thouse enums from a config file. That would be good. I would have taken that approach for my current needs, but I do not see any way to have a fallback if the config file does not exist. I m

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Cherry
I would have taken that approach for my current needs, but I do not see any way to have a fallback if the config file does not exist. I mean mixin import would just fail to compile if the configuration file is not present. I need an option to live with default values if the configuration file

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Cherry
Just a few clarifications For now maybe I could keep an empty/default config.d somewhere in the library source path. I am creating a DSL (Domain Specific Language) library. I am talking about the library src path of my DSL library. And I could use that with multiple -J options. This w

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Tobias Pankrath
On Tuesday, 25 February 2014 at 13:26:20 UTC, Dejan Lekic wrote: I don't like it. I would prefer a CTFE-able counter part to boost::program_options that generates thouse enums from a config file. If you want a config file, you do not need -D args. You simply import() it. Right? Yep, that

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Francesco Cattoglio
On Tuesday, 25 February 2014 at 14:26:13 UTC, Tobias Pankrath wrote: Something like "static if(fileExists!"config.d") mixin(import("config.d")) else ...". Thoughts? Regards - Cherry -- static if(__traits(compiles, import("config.d"))) { // import/parse/mixin } else { // default here } -- May

DUB Error

2014-02-25 Thread Steve Teale
What does the somewhat cryptic DUB error Trying to append absolute path. mean. By a process of elimination, the offending line in the json file is "importPaths": ["/usr/local/include/d/gtkd-2"] Steve

Re: Struct constructor, opCall mess.

2014-02-25 Thread Remo
On Tuesday, 25 February 2014 at 07:59:33 UTC, Maxim Fomin wrote: On Monday, 24 February 2014 at 14:14:43 UTC, Tobias Pankrath wrote: On Monday, 24 February 2014 at 13:56:01 UTC, Remo wrote: Hi, right now I am truing to figure out how the constructors behave in D2. Question 1: why it is not

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Francesco Cattoglio
On Tuesday, 25 February 2014 at 14:30:23 UTC, Francesco Cattoglio wrote: On Tuesday, 25 February 2014 at 14:26:13 UTC, Tobias Pankrath wrote: Something like "static if(fileExists!"config.d") mixin(import("config.d")) else ...". Thoughts? Regards - Cherry -- static if(__traits(compiles, impor

Re: Scalability in std.parallelism

2014-02-25 Thread Russel Winder
On Tue, 2014-02-25 at 12:33 +, thedeemon wrote: > On Monday, 24 February 2014 at 14:34:14 UTC, Russel Winder wrote: > > > Two cores with hyperthreads generally means a maximum speed up > > of 2 with optimized native code. > > Not true. If the code is not trivial and the threads are not > do

Odd Linux linking error

2014-02-25 Thread Jeremy DeHaan
I built some C shared libraries on Mint a while back and everything with my binding worked out fine. I decided to try out ubuntu and on getting everything set up there(using the same previously built shared libs), I am getting an error that I am unfamiliar with. /usr/bin/ld: -f may not be use

Re: Odd Linux linking error

2014-02-25 Thread Marc Schütz
Can you post the full command line of the linker invocation?

Re: How to install dmd2 in centos 5.3 x64

2014-02-25 Thread thr4wa
same problem: $DMDLOC/dmd2/linux/bin64/dmd hello.d /usr/bin/ld: cannot find -l:libphobos2.a collect2: ld returned 1 exit status --- errorlevel 1 $ cat $DMDLOC/dmd2/linux/bin64/dmd.conf [Environment] DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L-L%@P%/..

alias declaration spec

2014-02-25 Thread cal
Grammar spec (http://dlang.org/grammar.html#AliasDeclaration) allows: AliasDeclaration: alias BasicType Declarator DMD allows: alias ref int MyRefInt; Is the ref storage class allowed by the current grammar spec?

Re: How to install dmd2 in centos 5.3 x64

2014-02-25 Thread FreeSlave
It's not dmd problem, it's up to ld linker and the issue is same for other compiled languages including C and C++. You should specify LD_LIBRARY_PATH variable in your system before executing any compiled D application. You can add export of this environment variable to your $HOME/.profile or $H

Re: alias declaration spec

2014-02-25 Thread Jonathan M Davis
On Tuesday, February 25, 2014 22:32:44 cal wrote: > Grammar spec (http://dlang.org/grammar.html#AliasDeclaration) > allows: > > AliasDeclaration: > alias BasicType Declarator > > DMD allows: > > alias ref int MyRefInt; > > Is the ref storage class allowed by the current grammar spec? No.

Re: alias declaration spec

2014-02-25 Thread cal
On Tuesday, 25 February 2014 at 23:09:43 UTC, Jonathan M Davis wrote: On Tuesday, February 25, 2014 22:32:44 cal wrote: Grammar spec (http://dlang.org/grammar.html#AliasDeclaration) allows: AliasDeclaration: alias BasicType Declarator DMD allows: alias ref int MyRefInt; Is the ref stora

Re: A little of coordination for Rosettacode

2014-02-25 Thread bearophile
Is someone willing to write a D entry for this? http://rosettacode.org/wiki/Rendezvous Bye, bearophile

Runtime dependency checking

2014-02-25 Thread Frustrated
http://dpaste.dzfl.pl/80c6225ed090 The code above demonstrates run-time contracts using interface based programming. It provides two co-benfits: Simplified class implementation(you do not have to use interfaces for types which then requires casting that type for orthogonal behavior) and run-

Re: How to install dmd2 in centos 5.3 x64

2014-02-25 Thread thr4wa
i already tried LD_LIBRARY_PATH (and alternatives), however, looking deeper it seems like the admin has disabled LD_LIBRARY_PATH on this system (work terminal): http://stackoverflow.com/questions/9843178/linux-capabilities-setcap-seems-to-disable-ld-library-path On Tuesday, 25 February 2014 at

Re: DUB Error

2014-02-25 Thread Jesse Phillips
On Tuesday, 25 February 2014 at 14:32:42 UTC, Steve Teale wrote: What does the somewhat cryptic DUB error Trying to append absolute path. mean. By a process of elimination, the offending line in the json file is "importPaths": ["/usr/local/include/d/gtkd-2"] Steve The path you have provi

Re: A little of coordination for Rosettacode

2014-02-25 Thread Ali Çehreli
On 02/25/2014 03:48 PM, bearophile wrote: Is someone willing to write a D entry for this? http://rosettacode.org/wiki/Rendezvous Bye, bearophile I think the following satisfies the requirements. Improve at will! :p import std.stdio; import std.exception; import std.array; import std.concurre

Re: D alternative for C/C++ -Dfoo=42

2014-02-25 Thread Kagamin
On Tuesday, 25 February 2014 at 13:26:20 UTC, Dejan Lekic wrote: I don't like it. I would prefer a CTFE-able counter part to boost::program_options that generates thouse enums from a config file. If you want a config file, you do not need -D args. You simply import() it. Right? or import

Re: DUB Error

2014-02-25 Thread Steve Teale
On Wednesday, 26 February 2014 at 03:33:38 UTC, Jesse Phillips wrote: On Tuesday, 25 February 2014 at 14:32:42 UTC, Steve Teale wrote: What does the somewhat cryptic DUB error Trying to append absolute path. mean. By a process of elimination, the offending line in the json file is "importP

Re: Odd Linux linking error

2014-02-25 Thread Jeremy DeHaan
On Tuesday, 25 February 2014 at 19:41:54 UTC, Marc Schütz wrote: Can you post the full command line of the linker invocation? It was done through Mono-D, so to answer this for you I went and tried do it on a command line. I got some different errors, so I'm currently working on fixing them. I