Re: Make all functions from std.typecons "Proxy" inout

2012-05-10 Thread Kenji Hara
On Thursday, 10 May 2012 at 07:32:42 UTC, Namespace wrote: Can you explain me how TemplateThisParameter works? I read in the manual but a more detail explanation would help me a lot. Hmm, I have thought following code should work about foo, but doesn't. import std.stdio; struct Proxy {

Re: std.algorithm.remove strange behavior (removing items for the dynamic array)

2012-05-10 Thread Jacob Carlborg
On 2012-05-11 08:24, Jonathan M Davis wrote: On Friday, May 11, 2012 08:15:45 Jacob Carlborg wrote: Is it supposed to change the underlying array like that? It doesn't print the original sequence. Yes. To remove an element, it shifts all of the elements to the right of that element over by o

Re: std.algorithm.remove strange behavior (removing items for the dynamic array)

2012-05-10 Thread Jonathan M Davis
On Friday, May 11, 2012 08:15:45 Jacob Carlborg wrote: > On 2012-05-11 05:18, Jonathan M Davis wrote: > >> ...and got the following output: > >> > >> > >> a before: [2, 4, 8, 16, 32, 64, 128] > >> a after : [2, 4, 8, 32, 64, 128, 128] > >> a after2: [2, 8, 32, 64, 128, 128, 128] > >> > >> > >>

Re: std.algorithm.remove strange behavior (removing items for the dynamic array)

2012-05-10 Thread Jacob Carlborg
On 2012-05-11 05:18, Jonathan M Davis wrote: ...and got the following output: a before: [2, 4, 8, 16, 32, 64, 128] a after : [2, 4, 8, 32, 64, 128, 128] a after2: [2, 8, 32, 64, 128, 128, 128] I'm confused. Please tell me is it normal behavior of this function or is it a bug? Maybe i'm doing

Re: std.algorithm.remove strange behavior (removing items for the dynamic array)

2012-05-10 Thread mezozoysky
On Friday, 11 May 2012 at 03:18:41 UTC, Jonathan M Davis wrote: On Friday, May 11, 2012 04:45:18 mezozoysky wrote: Hello! I'm noticed that something non-obvious is happening with my code today and i've found that the trouble somewhere close to the removing items from the dynamic arrays e.i. cl

Re: std.algorithm.remove strange behavior (removing items for the dynamic array)

2012-05-10 Thread Jonathan M Davis
On Friday, May 11, 2012 04:45:18 mezozoysky wrote: > Hello! > I'm noticed that something non-obvious is happening with my code > today and i've found that the trouble somewhere close to the > removing items from the dynamic arrays e.i. close to > std.algorithm.remove function in this case. > > I w

Re: std.algorithm.remove strange behavior (removing items for the dynamic array)

2012-05-10 Thread mezozoysky
I almost forgot: i'm using DMD 2.059 on Debian testing (AMD64). On Friday, 11 May 2012 at 02:45:20 UTC, mezozoysky wrote: Hello! I'm noticed that something non-obvious is happening with my code today and i've found that the trouble somewhere close to the removing items from the dynamic arrays

std.algorithm.remove strange behavior (removing items for the dynamic array)

2012-05-10 Thread mezozoysky
Hello! I'm noticed that something non-obvious is happening with my code today and i've found that the trouble somewhere close to the removing items from the dynamic arrays e.i. close to std.algorithm.remove function in this case. I wrote a little test example using this function: module tes

Re: Detect unused variables

2012-05-10 Thread Namespace
Ah, I see. I wrote a short code that detects "normal" unused variables. "Normal" means those variables, which has built-in types. This means, that no types created by the user/programmer will detect. Furthermore, it doesn't detect arrays yet, but maybe there are some people here, who would he

Re: Detect unused variables

2012-05-10 Thread Jonathan M Davis
On Thursday, May 10, 2012 22:30:14 Namespace wrote: > After a short search I found a post which says, that currently > and in future no warning is shown if unused variables exist. Is > that correct? There is not currently any such warning, and I wouldn't expect there to ever be one. As I understa

Detect unused variables

2012-05-10 Thread Namespace
After a short search I found a post which says, that currently and in future no warning is shown if unused variables exist. Is that correct?

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Joseph Rushton Wakeling
On 10/05/12 20:47, Dmitry Olshansky wrote: mm I've been using this beast for ages with great success. rdmd --main -unittest std\regex.d may it be that -unittest should go first? D'oh! Yup. :-\

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
Oops, that doesn't fix the error. Seg. faults occurs...

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
I think I found it! I have modified main: void main() { DerelictSDL.load(); int val = SDL_Init(SDL_INIT_EVERYTHING); writeln(val); SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); writeln("ok"); DerelictSDL

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
It certainly doesn't happen inside SDL_Init because "writeln()" is shown even when the seg. fault occurs... It has to be inside SDL_SetVideoMode.

Re: Put Tuple in templates in a class fails

2012-05-10 Thread Philippe Sigaud
On Thu, May 10, 2012 at 4:48 PM, Xan wrote: > public class Algorisme(V,U...) { > > but when I do: https://gist.github.com/2653643 > > I get error: > prova_amb_tuples_a_Algorisme.d:84: Error: 'alg' is not of arithmetic type, > it is a prova_amb_tuples_a_Algorisme.Algorisme!(int,int).Algorisme > pr

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread H. S. Teoh
On Thu, May 10, 2012 at 09:19:57PM +0200, Minas wrote: > I forgot about that :p > > Here it is: > Starting program: > /home/minas/Projects/OpenGL/D_template/D_template/bin/Debug/D_template > [Thread debugging using libthread_db enabled] > Using host libthread_db library > "/lib/x86_64-linux-gnu/l

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
I forgot about that :p Here it is: Starting program: /home/minas/Projects/OpenGL/D_template/D_template/bin/Debug/D_template [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7fffee989700 (LWP 13351)] [Thread

Re: [Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread H. S. Teoh
On Thu, May 10, 2012 at 09:08:04PM +0200, Minas wrote: > Well, my code is really simple, compiles and runs fine. > > [code] [...] > [/code] > > But sometimes (at about 3-5 runs), I get a segmentation fault! > > 0 > bash: line 1: 12951 Segmentation fault (core dumped) > /home/minas/Projects

[Derelict2] Code SOMETIMES seg. faults!

2012-05-10 Thread Minas
Well, my code is really simple, compiles and runs fine. [code] import std.stdio; import derelict.sdl.sdl; void main() { DerelictSDL.load(); int val = SDL_Init(SDL_INIT_EVERYTHING); writeln(val); SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL

Re: Linking to static libraries

2012-05-10 Thread H. S. Teoh
On Thu, May 10, 2012 at 09:00:02PM +0200, Minas wrote: > I figured it out, this is the correct: > > -L-L/usr/lib/Derelict2 -L-lDerelictSDL -L-lDerelictUtil -L-ldl > > I don't know why, but the dl library is needed. Thank you for your > help. This is most likely because Derelict uses dynamic load

Re: Linking to static libraries

2012-05-10 Thread Minas
I figured it out, this is the correct: -L-L/usr/lib/Derelict2 -L-lDerelictSDL -L-lDerelictUtil -L-ldl I don't know why, but the dl library is needed. Thank you for your help.

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Dmitry Olshansky
On 10.05.2012 22:11, Joseph Rushton Wakeling wrote: On 10/05/12 19:33, Jesse Phillips wrote: rdmd --main mymod.d -unittest ... on second thoughts, that doesn't seem to work. I tested by putting in place a guaranteed-fail unittest; no result. :-( mm I've been using this beast for ages with g

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Joseph Rushton Wakeling
On 10/05/12 19:33, Jesse Phillips wrote: rdmd --main mymod.d -unittest ... on second thoughts, that doesn't seem to work. I tested by putting in place a guaranteed-fail unittest; no result. :-(

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Joseph Rushton Wakeling
On 10/05/12 19:33, Jesse Phillips wrote: rdmd --main mymod.d -unittest Thanks muchly. :-)

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Jonathan M Davis
On Thursday, May 10, 2012 10:14:12 H. S. Teoh wrote: > On Thu, May 10, 2012 at 07:05:27PM +0200, Christian Köstlin wrote: > > On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote: > > >Hello all, > > > > > >Is there any way to specify individual Phobos modules to unittest when > > >building, inste

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Jesse Phillips
On Thursday, 10 May 2012 at 16:22:11 UTC, Joseph Rushton Wakeling wrote: Hello all, Is there any way to specify individual Phobos modules to unittest when building, instead of having to do the whole lot? When working on 1 single module, it'd be nice to be able to unittest that one alone and

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Christian Köstlin
sorry ... i did not get this, as i never have developed phobos.

Re: How to structure templated classes

2012-05-10 Thread Christian Köstlin
On 05/10/2012 06:47 PM, Jacob Carlborg wrote: On 2012-05-10 17:39, Christian Köstlin wrote: ok .. sure you can use them by the way of InnerClasses, but you cannot use them directly anymore, which was one motivation to extract them from InnerClasses. Ah, I missed that. But one mixin isn't that

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread H. S. Teoh
On Thu, May 10, 2012 at 07:05:27PM +0200, Christian Köstlin wrote: > On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote: > >Hello all, > > > >Is there any way to specify individual Phobos modules to unittest when > >building, instead of having to do the whole lot? > > > >When working on 1 single

Re: Specifying which Phobos modules to unittest

2012-05-10 Thread Christian Köstlin
On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote: Hello all, Is there any way to specify individual Phobos modules to unittest when building, instead of having to do the whole lot? When working on 1 single module, it'd be nice to be able to unittest that one alone and not have to worry abo

Re: How to structure templated classes

2012-05-10 Thread Jacob Carlborg
On 2012-05-10 17:39, Christian Köstlin wrote: ok .. sure you can use them by the way of InnerClasses, but you cannot use them directly anymore, which was one motivation to extract them from InnerClasses. Ah, I missed that. But one mixin isn't that bad? Or do you want to place them in several

Re: Runtime.loadLibrary() on Linux

2012-05-10 Thread F i L
On Thursday, 10 May 2012 at 11:11:14 UTC, Jacob Carlborg wrote: On 2012-05-10 09:09, F i L wrote: Is it possible? I get a message "rt_loadLibrary() not supported on Posix" when I try. Is there something I'm doing wrong or is loading shared libraries not supported at all on Linux systems? th

Specifying which Phobos modules to unittest

2012-05-10 Thread Joseph Rushton Wakeling
Hello all, Is there any way to specify individual Phobos modules to unittest when building, instead of having to do the whole lot? When working on 1 single module, it'd be nice to be able to unittest that one alone and not have to worry about doing the complete set of tests until ready to pu

Re: How to structure templated classes

2012-05-10 Thread Christian Köstlin
On 05/10/2012 02:13 PM, Jacob Carlborg wrote: On 2012-05-10 13:41, Christian Köstlin wrote: thank for your answer, yes .. that could possibly work, but would still force me to add all the mixins to the main class. in addition to that i could not longer use the mixin-classes standalone (i would

Put Tuple in templates in a class fails

2012-05-10 Thread Xan
Hi, I have this code: https://gist.github.com/2653620 and I want to change public class Algorisme(U,V) { to public class Algorisme(V,U...) { but when I do: https://gist.github.com/2653643 I get error: prova_amb_tuples_a_Algorisme.d:84: Error: 'alg' is not of arithmetic type, it is a prova_a

Re: Linking to static libraries

2012-05-10 Thread Jacob Carlborg
On 2012-05-10 15:21, Minas wrote: $ dmd icy.d /usr/lib/Derelict3/DerelictSDL2 This doesn't because dmd thinks that I'm talking about a .d file. Hmm, that wasn't quite right, try this: $ dmd icy.d /usr/lib/Derelict3/libDerelictSDL2.a (Or whatever the full path to the library is) -- /Jacob C

Re: Linking to static libraries

2012-05-10 Thread Minas
On Thursday, 10 May 2012 at 13:14:36 UTC, Jacob Carlborg wrote: On 2012-05-10 14:55, Minas wrote: I have a static library (libDerelictSDL2.a) in /usr/lib/Derelict3. What I want to to is just link to that. My code does not use anything from it. My .d file is icy.d. I try to compile using: a)

Re: Linking to static libraries

2012-05-10 Thread Jacob Carlborg
On 2012-05-10 14:55, Minas wrote: I have a static library (libDerelictSDL2.a) in /usr/lib/Derelict3. What I want to to is just link to that. My code does not use anything from it. My .d file is icy.d. I try to compile using: a) dmd icy.d -I/usr/lib/Derelict3 -L-lDerelictSDL2 b) dmd icy.d -L-I/

Linking to static libraries

2012-05-10 Thread Minas
I have a static library (libDerelictSDL2.a) in /usr/lib/Derelict3. What I want to to is just link to that. My code does not use anything from it. My .d file is icy.d. I try to compile using: a) dmd icy.d -I/usr/lib/Derelict3 -L-lDerelictSDL2 b) dmd icy.d -L-I/usr/lib/Derelict3 -L-lDerelictSDL

Re: Make all functions from std.typecons "Proxy" inout

2012-05-10 Thread Kagamin
Looks like it infers the declaring type's modifiers.

Re: Right way to share object through threads

2012-05-10 Thread Andrea Fontana
On Thursday, 10 May 2012 at 11:42:44 UTC, sclytrack wrote: On 05/10/2012 01:12 PM, Andrea Fontana wrote: I can't understand which is the right way to share MyClass thru threads. MyClass performs a lot of operation during init (it has to parse a lot of data). After this long init, it runs very

Re: How to structure templated classes

2012-05-10 Thread Jacob Carlborg
On 2012-05-10 13:41, Christian Köstlin wrote: thank for your answer, yes .. that could possibly work, but would still force me to add all the mixins to the main class. in addition to that i could not longer use the mixin-classes standalone (i would have to mixin them into the place i want to us

Re: Right way to share object through threads

2012-05-10 Thread sclytrack
On 05/10/2012 01:12 PM, Andrea Fontana wrote: I can't understand which is the right way to share MyClass thru threads. MyClass performs a lot of operation during init (it has to parse a lot of data). After this long init, it runs very fast operations so I want to build it just one time and use i

Re: How to structure templated classes

2012-05-10 Thread Christian Köstlin
On 05/09/2012 10:48 PM, Jacob Carlborg wrote: Perhaps you can use template mixins (untested). class Test (T) { mixin InnerClasses!(T); } template InnerClasses (T) { static class Inner1 : Test!(T) {} // ... and so on } thank for your answer, yes .. that could possibly work, but would still fo

Right way to share object through threads

2012-05-10 Thread Andrea Fontana
I can't understand which is the right way to share MyClass thru threads. MyClass performs a lot of operation during init (it has to parse a lot of data). After this long init, it runs very fast operations so I want to build it just one time and use it on different threads. Declaring it as a

Re: Runtime.loadLibrary() on Linux

2012-05-10 Thread Jacob Carlborg
On 2012-05-10 09:09, F i L wrote: Is it possible? I get a message "rt_loadLibrary() not supported on Posix" when I try. Is there something I'm doing wrong or is loading shared libraries not supported at all on Linux systems? thanks. No, not using "rt_loadLibrary". You can still use the good o

Re: Make all functions from std.typecons "Proxy" inout

2012-05-10 Thread Namespace
Can you explain me how TemplateThisParameter works? I read in the manual but a more detail explanation would help me a lot.

Re: Frustration [Was: mysql binding/wrapper?]

2012-05-10 Thread #coder
As for mysqln, I merged jrogers patches and changed uint to size_t so it compiles on x64. You can look at it here: https://github.com/simendsjo/mysqln/tree/compile-on-recent-dmd It hasn't been tested beyond connecting to the database and fetching metadata yet. And my repository will go away ve

Re: Runtime.loadLibrary() on Linux

2012-05-10 Thread F i L
I should not I've only tried with DMD (so far). I'll try with LDC and GDC in the morning.

Runtime.loadLibrary() on Linux

2012-05-10 Thread F i L
Is it possible? I get a message "rt_loadLibrary() not supported on Posix" when I try. Is there something I'm doing wrong or is loading shared libraries not supported at all on Linux systems? thanks.