Re: Initalizing complex array types or some other problem ;/

2015-09-15 Thread Prudence via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 20:54:49 UTC, anonymous wrote: On Tuesday 15 September 2015 22:09, Prudence wrote: The code below doesn't work. Please be more specific in how it doesn't work. Mention the error message if there is one, or say how the code behaves differently from what

Another, is it a bug?

2015-09-15 Thread Random D user via Digitalmars-d-learn
I'm trying to make a base class with get property and a sub class with corresponding set property. The value for the base class is set via constructor. The intuitive way doesn't seem to work and workarounds are unnecessarily ugly (considering you'll sprinkle them all over the codebase).

Re: Another, is it a bug?

2015-09-15 Thread Meta via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 02:59:06 UTC, Random D user wrote: I'm trying to make a base class with get property and a sub class with corresponding set property. The value for the base class is set via constructor. The intuitive way doesn't seem to work and workarounds are unnecessarily

Re: Another, is it a bug?

2015-09-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 03:48:59 UTC, Random D user Given that, normally properties are just overloaded methods in D, it's pretty sad classes break this behavior/convention. The D behavior for overloading is different in general: http://dlang.org/hijack.html It basically never

Best Direction on Spawning Process Async

2015-09-15 Thread Mike McKee via Digitalmars-d-learn
What's the best direction from... http://dlang.org/phobos/std_process.html ...on spawning an async process and then peeking at it occasionally as it runs, and then get notified when it finishes? In other words, what std.process functions would you recommend I use? What I want to avoid is a

Re: Final templated interface method not found

2015-09-15 Thread anonymous via Digitalmars-d-learn
On Wednesday 16 September 2015 06:14, Andre wrote: > Hi, > > following coding shoud work, or? > It doesn't compile with v2.068.0. > > Kind regards > André > > interface IfStatement > { > void execute(); > > final void execute(T...)(T t) > { > execute(); >

Runtime error when calling a callback in a parallel Task

2015-09-15 Thread BBasile via Digitalmars-d-learn
Under Windows this works fine but under Linux I got a runtime error. this could be reduced to : --- import std.parallelism; alias CallBack = void function(void*); class Foo { CallBack clbck; void* param; void dotask() { // some heavy processing // tells the

Re: Another, is it a bug?

2015-09-15 Thread Random D user via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 03:17:05 UTC, Meta wrote: Considering Father defines the function `int eat()` and Daughter defines the completely different function `int eat(int)`, it doesn't surprise me. You're not using virtual dispatch when you do `return super.eat` or `d.Father.eat()`,

Re: chaining chain Result and underlying object of chain

2015-09-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/14/15 11:30 AM, Ali Çehreli wrote: On 09/14/2015 08:01 AM, Laeeth Isharc wrote: > I was trying to use the same variable eg > >auto chain1 = chain("foo", "bar"); >chain1 = chain(chain1, "baz"); [...] > It may be that the type of chain1 > and chain2 don't mix. Exactly.

Re: Load Qt UI XML File as GUI

2015-09-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/16/15 12:03 AM, Mike McKee wrote: Unfortunately, the http://dsource.org/forums/ doesn't appear to be active -- I can't login after I registered. This is where the QtD project has their forum. So, I'm asking this here. Seems to have moved here, but it doesn't look fresh:

Load Qt UI XML File as GUI

2015-09-15 Thread Mike McKee via Digitalmars-d-learn
Unfortunately, the http://dsource.org/forums/ doesn't appear to be active -- I can't login after I registered. This is where the QtD project has their forum. So, I'm asking this here. Is it possible with D and QtD to draw my GUI using QtCreator, and then take its UI XML file and load it

Final templated interface method not found

2015-09-15 Thread Andre via Digitalmars-d-learn
Hi, following coding shoud work, or? It doesn't compile with v2.068.0. Kind regards André interface IfStatement { void execute(); final void execute(T...)(T t) { execute(); } } class Statement: IfStatement { void execute(){} }

Re: Another, is it a bug?

2015-09-15 Thread Random D user via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 03:54:34 UTC, Adam D. Ruppe wrote: On Wednesday, 16 September 2015 at 03:48:59 UTC, Random D user Given that, normally properties are just overloaded methods in D, it's pretty sad classes break this behavior/convention. The D behavior for overloading is

Re: Load Qt UI XML File as GUI

2015-09-15 Thread Mike McKee via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 04:36:15 UTC, Steven Schveighoffer wrote: Seems to have moved here, but it doesn't look fresh: https://bitbucket.org/qtd/ Yep, but when I poke around in the source, I can't see anywhere that the QtD can read the .ui files that QtCreator creates.

Re: Initalizing complex array types or some other problem ;/

2015-09-15 Thread anonymous via Digitalmars-d-learn
On Wednesday 16 September 2015 03:46, Prudence wrote: > In any case, Maybe you are not as smart as you think you are if > you can't understand it? kthxbye

Nested classes question?

2015-09-15 Thread Dave Akers via Digitalmars-d-learn
When a program exits and D's memory management is cleaning up calling all of the ~this's is there a reason it calls the outer class's ~this before the inner class's ~this? I was recently exploring the possibility of using https://github.com/bheads/d-leveldb and the example in the readme seg

Re: Nested classes question?

2015-09-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 01:12:58 UTC, Dave Akers wrote: When a program exits and D's memory management is cleaning up calling all of the ~this's is there a reason it calls the outer class's ~this before the inner class's ~this? All class destructors are called in an undefined

Re: Combining Unique type with concurrency module

2015-09-15 Thread Alex via Digitalmars-d-learn
On Monday, 14 September 2015 at 08:08:35 UTC, Ali Çehreli wrote: void main() { MultiThreadedUnique!S u1 = produce(); auto childTid2 = spawn(, thisTid); u1.giveTo(childTid2); send(childTid2, cast(shared(MultiThreadedUnique!S*))); import core.thread; thread_joinAll();

Re: foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Andrew Brown via Digitalmars-d-learn
Thanks very much for your help, it seemed to work a treat (I hope :))! Compiling ldc wasn't too bad, make the changes to runtime/phobos/std/stdio.d and then just building as normal was no problem. Unittests are passing and it handles that file perfectly. On Tuesday, 15 September 2015 at

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Sep 15, 2015 at 08:55:43AM +, Fredrik Boulund via Digitalmars-d-learn wrote: > On Monday, 14 September 2015 at 18:31:38 UTC, H. S. Teoh wrote: > >I tried implementing a crude version of this (see code below), and > >found that manually calling GC.collect() even as frequently as once >

Re-named & Selective Imports

2015-09-15 Thread jmh530 via Digitalmars-d-learn
I combined a re-named import with a selective import and was surprised to find that it didn't do what I would have expected. In the code below, I would have expected only the "test2" line to have compiled, but it turned out that all three of these do. I'm guessing the logic is that it imports

Re: Checking for Homogeneous Tuples

2015-09-15 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 16:54:22 UTC, Nordlöw wrote: How do I check that all the elements of a std.typecons.Tuple all fulfil a specific predicate, in my case all have a specific type: Something like import std.typecons : isTuple; enum isTupleOf(T, E) = isTuple!T &&

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Andrew Brown via Digitalmars-d-learn
I had some luck building a local copy of llvm in my home directory, using a linux version about as old as yours (llvm 3.5 i used) specifying: --configure --prefix=/home/andrew/llvm so make install would install it somewhere I had permissions. Then I changed the cmake command to: cmake -L

Re: Checking for Homogeneous Tuples

2015-09-15 Thread Adam D. Ruppe via Digitalmars-d-learn
If it is a tuple of values too, you could just try to form an array out of it: `static if (__traits(compiles, [your_tuple]))`. But allSatisfy might be better. For the predicate there, remember it needs to take a template argument.

Re: No -v or -deps for gdc?

2015-09-15 Thread Johannes Pfau via Digitalmars-d-learn
Am Tue, 15 Sep 2015 12:19:34 + schrieb Atila Neves : > gdmd supports those options but gdc doesn't. Is that likely to > always be the case? > > Atila gdmd is just a wrapper around gdc. If something is supported by gdmd it must also be supported by gdc (the exact

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/09/15 9:00 PM, Kagamin wrote: On Tuesday, 15 September 2015 at 08:51:02 UTC, Fredrik Boulund wrote: Using char[] all around might be a good idea, but it doesn't seem like the string conversions are really that taxing. What are the arguments for working on char[] arrays rather than

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 09:09:00 UTC, Kagamin wrote: On Tuesday, 15 September 2015 at 08:53:37 UTC, Fredrik Boulund wrote: my favourite for streaming a file: enum chunkSize = 4096; File(fileName).byChunk(chunkSize).map!"cast(char[])a".joiner() Is this an efficient way of reading this

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 18:31:38 UTC, H. S. Teoh wrote: I tried implementing a crude version of this (see code below), and found that manually calling GC.collect() even as frequently as once every 5000 loop iterations (for a 500,000 line test input file) still gives about 15%

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 16:13:14 UTC, Edwin van Leeuwen wrote: See this link for clarification on what the columns/numbers in the profile file mean http://forum.dlang.org/post/f9gjmo$2gce$1...@digitalmars.com It is still difficult to parse though. I myself often use sysprof (only

Compilation error

2015-09-15 Thread Loic via Digitalmars-d-learn
Hello, I hope it's the good place to ask my question. I'am trying an hello world program in D, unfortunately the compilation, doesn't work, and found nothing on google. when I do : dmd Hello.d, the error returned is Error: cannot find source code for runtime library file 'object.d' dmd

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 08:53:37 UTC, Fredrik Boulund wrote: my favourite for streaming a file: enum chunkSize = 4096; File(fileName).byChunk(chunkSize).map!"cast(char[])a".joiner() Is this an efficient way of reading this type of file? What should one keep in mind when choosing

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 15:04:12 UTC, John Colvin wrote: I've had nothing but trouble when using different versions of libc. It would be easier to do this instead: http://wiki.dlang.org/Building_LDC_from_source I'm running a build of LDC git HEAD right now on an old server with

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 18:08:31 UTC, John Colvin wrote: On Monday, 14 September 2015 at 17:51:43 UTC, CraigDillabaugh wrote: On Monday, 14 September 2015 at 12:30:21 UTC, Fredrik Boulund wrote: [...] I am going to go off the beaten path here. If you really want speed for a file

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Fredrik Boulund via Digitalmars-d-learn
On Monday, 14 September 2015 at 16:33:23 UTC, Rikki Cattermole wrote: A lot of this hasn't been covered I believe. http://dpaste.dzfl.pl/f7ab2915c3e1 1) You don't need to convert char[] to string via to. No. Too much. Cast it. 2) You don't need byKey, use foreach key, value syntax. That way

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 08:51:02 UTC, Fredrik Boulund wrote: Using char[] all around might be a good idea, but it doesn't seem like the string conversions are really that taxing. What are the arguments for working on char[] arrays rather than strings? No, casting to string would be

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 08:45:00 UTC, Fredrik Boulund wrote: On Monday, 14 September 2015 at 15:04:12 UTC, John Colvin wrote: [...] Thanks for the offer, but don't go out of your way for my sake. Maybe I'll just build this in a clean environment instead of on my work computer to

Re: foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Martin Krejcirik via Digitalmars-d-learn
For reference, it was this PR: https://github.com/D-Programming-Language/phobos/pull/3089 which fixed the same issue for me.

Re: foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Martin Krejcirik via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 15:28:23 UTC, Andrew Brown wrote: A very naive question: would it be possible in this case to backport it into gdc/ldc by copying the pull request and building the compiler from source, or would this get me into a world of pain? Cherry-picking should work and

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 13:49:04 UTC, Fredrik Boulund wrote: On Tuesday, 15 September 2015 at 10:01:30 UTC, John Colvin wrote: [...] Nope, :( [...] Oh well, worth a try I guess.

Re: Compilation error

2015-09-15 Thread Loic via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 12:37:46 UTC, Adam D. Ruppe wrote: On Tuesday, 15 September 2015 at 09:17:26 UTC, Loic wrote: Error: cannot find source code for runtime library file 'object.d' How did you install dmd? The installer exe or the zip both should have come with all these files

Re: foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Andrew Brown via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 14:55:42 UTC, Martin Krejcirik wrote: For reference, it was this PR: https://github.com/D-Programming-Language/phobos/pull/3089 which fixed the same issue for me. A very naive question: would it be possible in this case to backport it into gdc/ldc by copying

No -v or -deps for gdc?

2015-09-15 Thread Atila Neves via Digitalmars-d-learn
gdmd supports those options but gdc doesn't. Is that likely to always be the case? Atila

tkd not linking

2015-09-15 Thread karabuta via Digitalmars-d-learn
I have tried several times to compile tkd using dub but I keep getting this message: Linking... /usr/bin/ld: cannot find -ltcl /usr/bin/ld: cannot find -ltk collect2: error: ld returned 1 exit status --- errorlevel 1 FAIL

Re: Checking for Homogeneous Tuples

2015-09-15 Thread Meta via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 16:54:22 UTC, Nordlöw wrote: How do I check that all the elements of a std.typecons.Tuple all fulfil a specific predicate, in my case all have a specific type: Something like import std.typecons : isTuple; enum isTupleOf(T, E) = isTuple!T &&

Checking for Homogeneous Tuples

2015-09-15 Thread Nordlöw via Digitalmars-d-learn
How do I check that all the elements of a std.typecons.Tuple all fulfil a specific predicate, in my case all have a specific type: Something like import std.typecons : isTuple; enum isTupleOf(T, E) = isTuple!T && is(MAGIC(T, E));

Re: tkd not linking

2015-09-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 17:37:40 UTC, karabuta wrote: Just incase, I have install version 8.6 of the Tcl/Tk libraries Did you get the development version? sudo apt-get install tk-dev or possibly sudo apt-get install tk8.6-dev should do it. I'm not actually sure if that's required

Initalizing complex array types or some other problem ;/

2015-09-15 Thread Prudence via Digitalmars-d-learn
How does one initialize a tuple type and are arrays initialized by default? The code below doesn't work. I recently converted to use a tuple and that seemed to have broke it and I don't know why, when I changed the New function to use a ref, that made it worse cause now the array is all

Re: tkd not linking

2015-09-15 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 17:37:40 UTC, karabuta wrote: I have tried several times to compile tkd using dub but I keep getting this message: Linking... /usr/bin/ld: cannot find -ltcl /usr/bin/ld: cannot find -ltk It looks like the libraries are not installed or not installed

Re: Checking for Homogeneous Tuples

2015-09-15 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 17:41:07 UTC, Meta wrote: I made a pull request for this a long time ago but it was rejected. https://github.com/D-Programming-Language/phobos/pull/1672 I'll try again because it's needed here https://github.com/D-Programming-Language/phobos/pull/3395 ;)

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Fredrik Boulund via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 18:42:29 UTC, Andrew Brown wrote: I had some luck building a local copy of llvm in my home directory, using a linux version about as old as yours (llvm 3.5 i used) specifying: --configure --prefix=/home/andrew/llvm so make install would install it somewhere I

Re: Initalizing complex array types or some other problem ;/

2015-09-15 Thread anonymous via Digitalmars-d-learn
On Tuesday 15 September 2015 22:09, Prudence wrote: > The code below doesn't work. Please be more specific in how it doesn't work. Mention the error message if there is one, or say how the code behaves differently from what you'd expect. Trying to compile the code (after kicking getch out), I

Re: Adjacent Pairs Range

2015-09-15 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 14 September 2015 at 10:45:52 UTC, Per Nordlöw wrote: On Monday, 14 September 2015 at 05:37:05 UTC, Sebastiaan Koppe wrote: What about using zip and a slice? Slicing requires a RandomAccessRange (Array). This is too restrictive. We want to change operations such as adjacentTuples

Re: foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Daniel Kozák via Digitalmars-d-learn
On Tue, 15 Sep 2015 13:56:36 + Andrwe Brown via Digitalmars-d-learn wrote: > Hi, > > I'm trying to read a file line by line, and I get a > core.exception.InvalidMemoryOperationError@(0), even after > reducing the program to: > > import std.stdio; > >

Re: foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Martin Krejcirik via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 13:56:37 UTC, Andrwe Brown wrote: I'm trying to read a file line by line, and I get a core.exception.InvalidMemoryOperationError@(0), even after https://issues.dlang.org/show_bug.cgi?id=13856 Try DMD 2.068, it has got fixed byLine implementation.

Re: foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Andrew Brown via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 14:19:13 UTC, Daniel Kozák wrote: Which OS? It's CentOS release 6.5 (Final), I tried dmd 2.068.1 and the problem has disappeared. Thanks very much for the advice, I can stick to old gdc for speed until ldc catches up to 2.068. Best Andrew

Re: Massive linker error after upgrade to DMD 2.068.1-1

2015-09-15 Thread rcorre via Digitalmars-d-learn
On Sunday, 13 September 2015 at 00:21:22 UTC, Nicholas Wilson wrote: there was talk of adding symbol name compression some time ago ( to reduce lib size ( and maybe make ddemangle not fail on long syms?). This might be the cause of your problems i.e. the new compiler emitting references to

Re: alias for regular expressions

2015-09-15 Thread Thunderbird via Digitalmars-d-learn
On Monday, 14 September 2015 at 07:11:38 UTC, Meta wrote: On Sunday, 13 September 2015 at 19:52:20 UTC, Thunderbird wrote: Thanks for your quick reply :) To expand on that, alias in D is nothing like the C macro preprocessor. D specifically disallows tricks like `#define true false`. In D,

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Fredrik Boulund via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 10:01:30 UTC, John Colvin wrote: try this: https://dlangscience.github.io/resources/ldc-0.16.0-a2_glibc2.11.3.tar.xz Nope, :( $ ldd ldc2 ./ldc2: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./ldc2) linux-vdso.so.1 =>

foreach(line; f.byLine) produces core.exception.InvalidMemoryOperationError@(0) in 2.067 but not 2.066

2015-09-15 Thread Andrwe Brown via Digitalmars-d-learn
Hi, I'm trying to read a file line by line, and I get a core.exception.InvalidMemoryOperationError@(0), even after reducing the program to: import std.stdio; void main() { File f = File("testfile"); foreach(line; f.byLine) { } } The file is a simple table of ascii characters, 811

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 13:01:06 UTC, Kagamin wrote: On Tuesday, 15 September 2015 at 09:19:29 UTC, John Colvin wrote: It provides you only one char at a time instead of a whole line. It will be quite constraining for your code if not mind-bending.

Re: Compilation error

2015-09-15 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 09:17:26 UTC, Loic wrote: Error: cannot find source code for runtime library file 'object.d' How did you install dmd? The installer exe or the zip both should have come with all these files packaged together.

Re: Speeding up text file parser (BLAST tabular format)

2015-09-15 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 15 September 2015 at 09:19:29 UTC, John Colvin wrote: It provides you only one char at a time instead of a whole line. It will be quite constraining for your code if not mind-bending. http://dlang.org/phobos/std_string.html#.lineSplitter