Re: Error: import `typename` is used as a type

2013-12-15 Thread evilrat
On Monday, 16 December 2013 at 06:33:14 UTC, Dfr wrote: Hello, i struggling now to make my D program better organized. As suggested here https://github.com/bioinfornatics/MakefileForD, i put all source files to src. Here is my current directory tree: ./ Makefile src/ main.d pcre/

tango -D2 regex

2013-12-15 Thread seany
I dont find any info on backtrack on tango-D2 regex. For example, I want to match things like barFOObar or bazFOObaz so I would use, in PCRE, ^(\w*)FOO($1)$, with $1 meaning the word (given by \w* that was matced in the first subpattern (\w*) How to do the samein Tango for D2 (or even pho

Re: std.algorithm.splitter improovement?

2013-12-15 Thread seany
On Sunday, 15 December 2013 at 01:25:39 UTC, Marco Leise wrote: Am Sat, 14 Dec 2013 18:20:13 +0100 schrieb "bearophile" : Marco Leise: > Not at all, the documentation explicitly states: > > assert(equal(splitter("hello world", ' '), [ "hello", "", > "world" ])); I didn't see the ' ' in t

Re: How to link to libdl under linux

2013-12-15 Thread Jacob Carlborg
On 2013-12-16 01:54, Danny Arends wrote: Pass it depending if you use rdmd or dmd -L-ldl or -ldl It's -L-ldl regardless of it's rdmd or dmd. -- /Jacob Carlborg

Path to cmdfile?

2013-12-15 Thread Jeremy DeHaan
I've been brain storming lately on some ideas to simplify building for the library I've been working on, and I wanted to do some experimenting using cmdfiles. Is there some way that I can pass a search path for these bad boys to the compiler if they are just text files?

Error: import `typename` is used as a type

2013-12-15 Thread Dfr
Hello, i struggling now to make my D program better organized. As suggested here https://github.com/bioinfornatics/MakefileForD, i put all source files to src. Here is my current directory tree: ./ Makefile src/ main.d pcre/ capi.d pcre_regex.d Then i run make: $ make

Re: Chaining std.algorithm

2013-12-15 Thread H. S. Teoh
On Mon, Dec 16, 2013 at 05:42:10PM +1300, John Carter wrote: [...] > Now I'm sure I can use std.algorithm map to convert say a string of > characters "IVXLCDM" into an array [1,5,10,50,100,500,1000] > > but somehow D template instantiation syntax is flumoxing me. > > When I try use find in map!"f

Re: Chaining std.algorithm

2013-12-15 Thread Ali Çehreli
On 12/15/2013 09:46 PM, Ali Çehreli wrote: > On 12/15/2013 08:42 PM, John Carter wrote: > > Now I'm sure I can use std.algorithm map to convert say a string of > > characters "IVXLCDM" into an array [1,5,10,50,100,500,1000] The following program works. Note that 'result' is a lazy range. You

Re: Chaining std.algorithm

2013-12-15 Thread Ali Çehreli
On 12/15/2013 08:42 PM, John Carter wrote: > So I have an array of data... > struct romanSystemData { > string digit; > uint value; > ulong regionIndex; > ulong previous; > }; > > immutable romanSystemData romanSystem[] = [ > {"" ,0, 0, 0},//0 > {"I",1, 0, 0}

Chaining std.algorithm

2013-12-15 Thread John Carter
So I have an array of data... struct romanSystemData { string digit; uint value; ulong regionIndex; ulong previous; }; immutable romanSystemData romanSystem[] = [ {"" ,0, 0, 0},//0 {"I",1, 0, 0},//1 8-7 {"V",5, 1, 1},//2 8-6 {"X", 10, 1, 2},//3 8-5 {"L

Re: Showing off and a minor thing

2013-12-15 Thread Rikki Cattermole
On Sunday, 15 December 2013 at 19:14:46 UTC, Danny Arends wrote: Hey all, I've been working on a web server in D to learn the language, currently it runs my own website: http://www.dannyarends.nl and some other ones, but that is not really the most special thing. I've been using it now for mo

Re: regarding spawnProcess and parameters in Windows

2013-12-15 Thread Danny Arends
On Monday, 16 December 2013 at 00:59:51 UTC, Danny Arends wrote: On Sunday, 15 December 2013 at 23:14:45 UTC, Hugo Florentino wrote: Hello, I am trying to do a small launcher for a Windows application which (in order to be portable) requires a specific parameter, and I am getting this error w

Re: regarding spawnProcess and parameters in Windows

2013-12-15 Thread Danny Arends
On Sunday, 15 December 2013 at 23:14:45 UTC, Hugo Florentino wrote: Hello, I am trying to do a small launcher for a Windows application which (in order to be portable) requires a specific parameter, and I am getting this error when I try to run it in Windows 7 SP1: "std.process.ProcessExcep

Re: How to link to libdl under linux

2013-12-15 Thread Danny Arends
On Sunday, 15 December 2013 at 21:38:37 UTC, MrSmith wrote: I am trying to compile my program which uses derelict under ubuntu 13.10. DerelictUtil needs access to dl library. Simply providing libdl.a as parameter to compiler doesn't work. deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_4

Re: WinAPI Wide Functions

2013-12-15 Thread Jakob Ovrum
On Sunday, 15 December 2013 at 18:36:08 UTC, Jeroen Bollen wrote: I would but there doesn't seem to be any documentation on that binding set. How am I supposed to know which modules to use or what DLLs to link? As with most bindings, the project's interface modules mirror the headers it ports

Re: Match properties as member variables

2013-12-15 Thread comco
On Sunday, 15 December 2013 at 23:38:57 UTC, comco wrote: On Sunday, 15 December 2013 at 23:13:39 UTC, Jakob Ovrum wrote: On Friday, 13 December 2013 at 12:01:28 UTC, comco wrote: From client perspective, properties look like member variables. With (auto) ref, a generic function can catch a mem

Re: Match properties as member variables

2013-12-15 Thread comco
On Sunday, 15 December 2013 at 23:13:39 UTC, Jakob Ovrum wrote: On Friday, 13 December 2013 at 12:01:28 UTC, comco wrote: From client perspective, properties look like member variables. With (auto) ref, a generic function can catch a member variable and read it and update it: void swap(T)(ref

regarding spawnProcess and parameters in Windows

2013-12-15 Thread Hugo Florentino
Hello, I am trying to do a small launcher for a Windows application which (in order to be portable) requires a specific parameter, and I am getting this error when I try to run it in Windows 7 SP1: "std.process.ProcessException@std\process.d(518): Failed to spawn new process (Access denied.)

Re: Match properties as member variables

2013-12-15 Thread Jakob Ovrum
On Friday, 13 December 2013 at 12:01:28 UTC, comco wrote: From client perspective, properties look like member variables. With (auto) ref, a generic function can catch a member variable and read it and update it: void swap(T)(ref T a, ref T b) {...} The client can use swap with member variabl

Re: Match properties as member variables

2013-12-15 Thread comco
On Friday, 13 December 2013 at 12:01:28 UTC, comco wrote: From client perspective, properties look like member variables. With (auto) ref, a generic function can catch a member variable and read it and update it: void swap(T)(ref T a, ref T b) {...} The client can use swap with member variabl

Re: Travis-CI and D

2013-12-15 Thread lomereiter
Yep. In 'before_install' download a D compiler and add it to $PATH; in 'script' specify commands for running tests.

Re: Access violation error using Derelict GL3

2013-12-15 Thread Ross Hays
On Sunday, 15 December 2013 at 21:31:21 UTC, Andrej Mitrovic wrote: On 12/15/13, Ross Hays wrote: Am I doing something wrong here? You're likely not loading the function pointers first. Try calling DerelictGL.reload() first. That was it... knew it was something dumb. I had it in there ori

How to link to libdl under linux

2013-12-15 Thread MrSmith
I am trying to compile my program which uses derelict under ubuntu 13.10. DerelictUtil needs access to dl library. Simply providing libdl.a as parameter to compiler doesn't work. deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): In function `_D8derelict4util9sharedlib13LoadShar

Re: Access violation error using Derelict GL3

2013-12-15 Thread Andrej Mitrovic
On 12/15/13, Ross Hays wrote: > Am I doing something wrong here? You're likely not loading the function pointers first. Try calling DerelictGL.reload() first.

Access violation error using Derelict GL3

2013-12-15 Thread Ross Hays
I have run into a problem using the Derelict GL3 binding and I am not sure if I am doing something wrong or if this is a bug. I have a class that contains several uints that are to represent the ids returned by OpenGL functions. I have a call to glDeleteBuffers that always result in "object.Er

Travis-CI and D

2013-12-15 Thread Dylan Knutson
Has anyone had success with using Travis-CI for building/testing D programs? Travis-CI has been really useful for me in the past when writing Ruby, and I noticed that it supported testing C/C++ programs, so I'd think D isn't a huge stretch.

Compiling file with std.net.curl in Ubuntu 13.10 64bit

2013-12-15 Thread Ben
Hi all, I'm attempting to compile a file using dmd. Below is the code: import std.stdio; import std.net.curl; void main(){ writeln("hello world"); writeln(get("http://google.com";)); } I found a few threads that indicate I needed to compile using the linker flags for phobos a

Showing off and a minor thing

2013-12-15 Thread Danny Arends
Hey all, I've been working on a web server in D to learn the language, currently it runs my own website: http://www.dannyarends.nl and some other ones, but that is not really the most special thing. I've been using it now for months already and got a significant speed up compared to the java

Re: WinAPI Wide Functions

2013-12-15 Thread Jeroen Bollen
On Sunday, 15 December 2013 at 14:26:26 UTC, Marco Leise wrote: Am Sun, 15 Dec 2013 15:17:39 +0100 schrieb "Jeroen Bollen" : Are there default bindings to the WinAPI's Wide Functions? I'm talking about for example 'CreateWindowW'. I know of this project: http://www.dsource.org/projects/bindin

Re: How to obtain certain traits of delegates returned by functions in template constraints?

2013-12-15 Thread TheFlyingFiddle
template strip(T) if(is(T == delegate)) Typo should be stripped.

Re: How to obtain certain traits of delegates returned by functions in template constraints?

2013-12-15 Thread TheFlyingFiddle
On Sunday, 15 December 2013 at 10:44:38 UTC, Jacob Carlborg wrote: Hmm, there might be a way to strip all the attributes of a function. template strip(T) if(is(T == delegate)) { alias stripped = ReturnType!T delegate(ParameterTypeTuple!T); } template strip(T) if(is(T == function)) { a

Re: updating druntime

2013-12-15 Thread Joseph Rushton Wakeling
On 15/12/13 14:27, Marco Leise wrote: As it should. But I keep wondering why it didn't work on Ubuntu which is based on Debian. Oh well... :) Forgot to copy phobos/etc to include/d2/etc ... ?

Using threads on Mac OS X using D1 and Tango

2013-12-15 Thread Jacob Carlborg
I'm trying to use threads on Mac OS X using D1 and Tango. I have this very simple example: import tango.core.Thread; void main () { Thread thread = new Thread({ }); thread.start(); thread.join(); } I'm using DMD 1.076 to compile the above example on Mac OS X 10.8.5 as 32bit. When

Re: rounding floats up to specified number of decimal digits

2013-12-15 Thread John Colvin
On Sunday, 15 December 2013 at 14:35:04 UTC, ref2401 wrote: I'm seeking for a way to round floats up to specified number of decimal digits. e.g. roundToDigits(3.1415, 2) should return 3.14. Is there a standard function for that or what is the most correct way to do that? You can quite easily

rounding floats up to specified number of decimal digits

2013-12-15 Thread ref2401
I'm seeking for a way to round floats up to specified number of decimal digits. e.g. roundToDigits(3.1415, 2) should return 3.14. Is there a standard function for that or what is the most correct way to do that?

Re: WinAPI Wide Functions

2013-12-15 Thread Marco Leise
Am Sun, 15 Dec 2013 15:17:39 +0100 schrieb "Jeroen Bollen" : > Are there default bindings to the WinAPI's Wide Functions? I'm > talking about for example 'CreateWindowW'. Well, just scroll back through this forum to the topic Win Headers -- Marco

Re: WinAPI Wide Functions

2013-12-15 Thread Marco Leise
Am Sun, 15 Dec 2013 15:17:39 +0100 schrieb "Jeroen Bollen" : > Are there default bindings to the WinAPI's Wide Functions? I'm > talking about for example 'CreateWindowW'. I know of this project: http://www.dsource.org/projects/bindings/wiki/WindowsApi -- Marco

Re: Custom Exponents

2013-12-15 Thread Marco Leise
Am Sun, 15 Dec 2013 06:22:45 +0100 schrieb "Malkierian" : > Alright, so I'm trying to do hex string to integer conversion, > but I can't for the live of me find how to do exponent > calculation in D. Java has a Math.pow() function that allows you > to specify the base and the exponent, but all

WinAPI Wide Functions

2013-12-15 Thread Jeroen Bollen
Are there default bindings to the WinAPI's Wide Functions? I'm talking about for example 'CreateWindowW'.

Re: Custom Exponents

2013-12-15 Thread Marco Leise
Am Sun, 15 Dec 2013 13:52:55 +0100 schrieb Philippe Sigaud : > > - > > void main() > > { > > int a = 2, b = 2; > > auto c = a ^^ b; > > } > > - > > > > test.d(6): Error: must import std.math to use ^^ operator > > ?? The ^^ operator is defined in std.math? dmd lacks a native impl

Re: Language Support - Read and Write

2013-12-15 Thread Marco Leise
Am Sun, 15 Dec 2013 11:19:43 +0100 schrieb "Siavash Babaei" : > Yes and No: I kind of knew that and just wanted to make sure. > Thank you for confirming it. On the other hand, when I define a > string variable and set it to say, "سلام", and want to output it > to the CMD (write, writeln, writef

Re: updating druntime

2013-12-15 Thread Marco Leise
Am Sun, 15 Dec 2013 09:06:16 +0100 schrieb "Benji" : > On Saturday, 14 December 2013 at 16:58:06 UTC, Marco Leise wrote: > > Am Sat, 14 Dec 2013 08:43:42 +0100 > > schrieb "Benji" : > > > >> On Saturday, 14 December 2013 at 00:15:30 UTC, Marco Leise > >> wrote: > >> > Am Fri, 13 Dec 2013 21:40:10

Re: Language Support - Read and Write

2013-12-15 Thread Philippe Sigaud
FWIW, on my box (Kubuntu, 32bits), without changing anything in my config. auto s = "سلام"; writeln(s); Prints the string correctly at the command line (exact same chars). What OS are you using?

Re: ubyte array changing values between calls? Possible bug?

2013-12-15 Thread Gary Willoughby
On Sunday, 15 December 2013 at 00:21:37 UTC, Ali Çehreli wrote: On 12/14/2013 10:48 AM, Gary Willoughby wrote: > On Friday, 13 December 2013 at 17:35:27 UTC, John Colvin wrote: >>> public void opAssign(uint value) >>> { >>> this._octets = value.nativeToBigEndian(); >>> a

Re: Custom Exponents

2013-12-15 Thread Philippe Sigaud
> - > void main() > { > int a = 2, b = 2; > auto c = a ^^ b; > } > - > > test.d(6): Error: must import std.math to use ^^ operator ?? The ^^ operator is defined in std.math? > Side-note: Importing std.stdio implicitly imports std.math, so you > won't have any errors (boy do I hat

Re: eclipse - adding custom flags to dmd when compiling

2013-12-15 Thread Mike Parker
On 12/15/2013 9:01 PM, Benji wrote: I want to compile file 'main.d' within Eclipse by following way: dmd ~/main.d -L-lcurl How to achieve that? By default, Eclipse compiles it without -L-lcurl flag. You should be able to configure that by going to Project->Properties in the menu, or right-

eclipse - adding custom flags to dmd when compiling

2013-12-15 Thread Benji
I want to compile file 'main.d' within Eclipse by following way: dmd ~/main.d -L-lcurl How to achieve that? By default, Eclipse compiles it without -L-lcurl flag.

Re: Custom Exponents

2013-12-15 Thread Andrej Mitrovic
On 12/15/13, Philippe Sigaud wrote: >> >> http://dlang.org/phobos/std_math.html#.pow >> >> See the fourth overload: `if (isFloatingPoint!F && isFloatingPoint!G)`. > > Is there any difference between using `a ^^ b` and `pow(a,b)`? Depends on whether the arguments are known at compile-time, and the

Re: How to obtain certain traits of delegates returned by functions in template constraints?

2013-12-15 Thread Jacob Carlborg
On 2013-12-14 23:38, DoctorCaptain wrote: This is a very concise way to do what I want to do, but this check cares about other attributes of the function/delegate, i.e. if the function or delegate is designated as pure or nothrow and those don't show up in the check, it will fail. As in: auto n

Re: Language Support - Read and Write

2013-12-15 Thread Siavash Babaei
Yes and No: I kind of knew that and just wanted to make sure. Thank you for confirming it. On the other hand, when I define a string variable and set it to say, "سلام", and want to output it to the CMD (write, writeln, writef), what I get is gibberish and CMD is set correctly BTW.

Re: Language Support - Read and Write

2013-12-15 Thread qznc
On Sunday, 15 December 2013 at 08:41:42 UTC, Siavash Babaei wrote: Is it not possible to read and write in non-latin languages like Hebrew, Arabic, Farsi, etc?! If so, how, and if not, why? D source files are UTF-8. You can name your variables and functions using the fullw wealth of Unicode.

Language Support - Read and Write

2013-12-15 Thread Siavash Babaei
Is it not possible to read and write in non-latin languages like Hebrew, Arabic, Farsi, etc?! If so, how, and if not, why?

Re: updating druntime

2013-12-15 Thread Benji
On Saturday, 14 December 2013 at 16:58:06 UTC, Marco Leise wrote: Am Sat, 14 Dec 2013 08:43:42 +0100 schrieb "Benji" : On Saturday, 14 December 2013 at 00:15:30 UTC, Marco Leise wrote: > Am Fri, 13 Dec 2013 21:40:10 +0100 > schrieb "Benji" : > >> I got two errors mentioned above at once.. :( >