synchronization + nothrow

2012-10-19 Thread denizzzka
How I can synchronize changing of array in the functions with nothrow? Handmade spinlock or something better?

Re: import inside function sometimes causes link errors

2012-10-19 Thread timotheecour
It's a rather recent feature, there's probably a few bugs. Feel free to file: http://d.puremagic.com/issues/ done: http://d.puremagic.com/issues/show_bug.cgi?id=8856

Re: Friends?

2012-10-19 Thread Nick Sabalausky
On Fri, 19 Oct 2012 14:36:59 -0400 "Jonathan M Davis" wrote: > On Friday, October 19, 2012 20:01:20 Alex Rønne Petersen wrote: > > On 19-10-2012 08:23, Jacob Carlborg wrote: > > > On 2012-10-18 20:51, Philippe Sigaud wrote: > > >> I mean, the 'package' access modifier. > > > > > > So did I. > >

import inside function sometimes causes link errors

2012-10-19 Thread timotheecour
does D fully support using import statements inside functions? I sometimes get link errors eg: void fun(){ import mypackage.mymodule; mypackage.mymodule.myfun(); //will cause link error } if you haven't encountered it yet I can provide a simplified test case.

Re: Friends?

2012-10-19 Thread Jonathan M Davis
On Friday, October 19, 2012 20:01:20 Alex Rønne Petersen wrote: > On 19-10-2012 08:23, Jacob Carlborg wrote: > > On 2012-10-18 20:51, Philippe Sigaud wrote: > >> I mean, the 'package' access modifier. > > > > So did I. > > > > class Foo > > { > > > > package void foo () {} > > > > } > > > > Wo

incomprehensible bug with import side effects

2012-10-19 Thread timotheecour
I've filed the following bug: see Issue 8854 (http://d.puremagic.com/issues/show_bug.cgi?id=8854) I'm curious as to what could cause such a bug, which disappears when doing any of the following seemingly innocuous changes, such as change a file name, change an import path, removing an (unused)

Re: To: Johannes Pfau

2012-10-19 Thread Johannes Pfau
Am Mon, 15 Oct 2012 02:14:57 +0200 schrieb Andrej Mitrovic : > Sorry for posting here, but Github doesn't have messaging anymore > (boo!) and there's no contact button or email anywhere to be found. :) > > Johannes, are you still working on gobject introspection? libgit has > gobject bindings so

Re: Friends?

2012-10-19 Thread Alex Rønne Petersen
On 19-10-2012 08:23, Jacob Carlborg wrote: On 2012-10-18 20:51, Philippe Sigaud wrote: I mean, the 'package' access modifier. So did I. class Foo { package void foo () {} } Would, according to the spec, imply a virtual method. But as Jonathan said, this is a bug in the spec. What? Ho

Re: Friends?

2012-10-19 Thread Philippe Sigaud
On Thu, Oct 18, 2012 at 10:44 PM, Jonathan M Davis wrote: >> Does it work? I thought it was not implemented. > > Hmm. I don't know what it's current state is. There _is_ a long-standing bug > on it in bugzilla ( http://d.puremagic.com/issues/show_bug.cgi?id=143 ) which > is still open. I had forgo

Re: Resizing array of classes

2012-10-19 Thread monarch_dodra
On Friday, 19 October 2012 at 13:41:53 UTC, Jacob Carlborg wrote: On 2012-10-19 11:42, Marco Leise wrote: When you extend the length of an array, it is filled with the static .init value for the type, which is null here. I think you'll have to create the objects manually. foreach (ref foo; a)

Re: Resizing array of classes

2012-10-19 Thread Jacob Carlborg
On 2012-10-19 11:42, Marco Leise wrote: When you extend the length of an array, it is filled with the static .init value for the type, which is null here. I think you'll have to create the objects manually. foreach (ref foo; a) foo = new Foo; Is this possible: a[] = new Foo; ? -- /Jacob Ca

Re: opCast using in template struct

2012-10-19 Thread Oleg
Problem solved partially. http://dpaste.dzfl.pl/e7871a01 in structs I use fix length arrays declarations, and alias its to structs, but not allowed casting to fix length arrays. I want check array length in compile time auto opBinary(string op,E)( E[DLen] b ) // fix length array i

Re: Implicit Conversions in Struct Construction

2012-10-19 Thread monarch_dodra
On Friday, 19 October 2012 at 09:36:14 UTC, Jonathan M Davis wrote: On Friday, October 19, 2012 10:59:07 bearophile wrote: Jonathan M Davis: > Except that that won't work for int or other built-in types, > because they lack constructors. Isn't it possible to modify D and add constructors to bui

Re: Resizing array of classes

2012-10-19 Thread Artur Skawina
On 10/19/12 11:09, m0rph wrote: > Suppose I have a dynamic array of classes, something like: > > class Foo { > int value; > } > > Foo[] a; > > Now I want to resize it and initialize new items with default values, so I do > following: > > a.length = 10; > a[0].value = 1; > > And by executi

Re: Resizing array of classes

2012-10-19 Thread Marco Leise
Am Fri, 19 Oct 2012 11:09:42 +0200 schrieb "m0rph" : > Suppose I have a dynamic array of classes, something like: > > class Foo { > int value; > } > > Foo[] a; > > Now I want to resize it and initialize new items with default > values, so I do following: > > a.length = 10; > a[0].value =

Re: Implicit Conversions in Struct Construction

2012-10-19 Thread Jonathan M Davis
On Friday, October 19, 2012 10:59:07 bearophile wrote: > Jonathan M Davis: > > Except that that won't work for int or other built-in types, > > because they lack constructors. > > Isn't it possible to modify D and add constructors to built-in > types? > > int(10) Of course, it would be possible.

Resizing array of classes

2012-10-19 Thread m0rph
Suppose I have a dynamic array of classes, something like: class Foo { int value; } Foo[] a; Now I want to resize it and initialize new items with default values, so I do following: a.length = 10; a[0].value = 1; And by executing the last line of code I've got a segmentation fault. App

Re: Implicit Conversions in Struct Construction

2012-10-19 Thread bearophile
Jonathan M Davis: Except that that won't work for int or other built-in types, because they lack constructors. Isn't it possible to modify D and add constructors to built-in types? int(10) Bye, bearophile