I solved the problem by creating my own version of UnixAddress.
The existing implementation needs some work. I'll filed a bug
report.
http://d.puremagic.com/issues/show_bug.cgi?id=9384
--rt
On Thursday, 24 January 2013 at 07:41:23 UTC, Jacob Carlborg
wrote:
On 2013-01-24 07:28, Joel wrote:
How does one copy folders (with files in them) including sub
folders,
and creating any needed folders?
Like:
land\house\cat.d
land\house\rat.exe
land\house\bedroom\ants.txt
to
On Wednesday, 23 January 2013 at 16:33:08 UTC, Sarath Kumar wrote:
DMD v2.61; openSUSE 12.1
Source:
---
libA.d:
module libA;
extern (C)
{
struct Opaque;
Opaque* getObject();
void doSomething(Opaque *);
}
--
libB.d:
module libB;
extern (C)
{
On Wednesday, 23 January 2013 at 17:14:31 UTC, Ali Çehreli wrote:
On 01/23/2013 08:33 AM, Sarath Kumar wrote:
Can someone please tell me the right way to pass an opaque
object
between module's functions.
I am assuming that you are interfacing with a C library. That
library must have a D
I am trying to create a BVH tree structure to speed up
raytracing. So far it has been fine. I have created the BVH tree.
It works for 202 triangles/spheres.
However, when the scene has more spheres/triangles, I get a
segmentation fault when the rays are traces, not when the tree is
being
On Thursday, 24 January 2013 at 09:39:39 UTC, Sarath Kumar wrote:
On Thursday, 24 January 2013 at 09:04:09 UTC, Mike Parker wrote:
The error message here is deceiving. Declare the struct in one
module only and then import it in every module that uses it.
So, for example, keep the declaration
yebblies: Can an auto-ref function pointer/deltegate implicitly
convert to ref?
9rnsr: To @yebblies : I yet not implement it because this is a
basic proposal.
IMHO, what he says is that behavior proposed by yebblies is some
more complicated special cases he is not going to do within this
This is probably a question for Walter, but maybe others know.
Of all of the differences between C and D, the one which I have the most
difficulty adapting to is null being lowercase. Does anyone know why
this decision was made?
--
Matthew Caron, Software Build Engineer
Sixnet, a Red Lion
On Thursday, 24 January 2013 at 10:14:29 UTC, Minas Mina wrote:
I am trying to create a BVH tree structure to speed up
raytracing. So far it has been fine. I have created the BVH
tree. It works for 202 triangles/spheres.
skipped
Thanks.
Requests for debugging help without source code are
Matthew Caron:
Of all of the differences between C and D, the one which I have
the most difficulty adapting to is null being lowercase. Does
anyone know why this decision was made?
Probably because writing all in uppercase ugly. null is a keyword
like the others, and they are in lowercase.
On Thursday, 24 January 2013 at 12:56:03 UTC, Matthew Caron wrote:
This is probably a question for Walter, but maybe others know.
Of all of the differences between C and D, the one which I have
the most difficulty adapting to is null being lowercase. Does
anyone know why this decision was
On Thursday, 24 January 2013 at 12:56:03 UTC, Matthew Caron wrote:
This is probably a question for Walter, but maybe others know.
Of all of the differences between C and D, the one which I have
the most difficulty adapting to is null being lowercase. Does
anyone know why this decision was
Hi,
In C, NULL is a #define, and #defines are typically all-caps. In D,
null is real keyword recognized by the compiler, and those are
typically lowercase. I am just guessing here, but I'd say the choice
for 'null' instead of 'NULL' is just to be coherent with this.
Personally, I kinda like
Thanks for your answer. That explains my question.
I would love to see an official statement about this pull and
this feature. But neither in the related threads or here in
learn I get such statement. That is very sad because this
feature is very important and long discussed.
On Thursday, 24 January 2013 at 13:42:36 UTC, Namespace wrote:
Thanks for your answer. That explains my question.
I would love to see an official statement about this pull and
this feature. But neither in the related threads or here in
learn I get such statement. That is very sad because this
On Wednesday, 23 January 2013 at 16:33:08 UTC, Sarath Kumar wrote:
DMD v2.61; openSUSE 12.1
Source:
---
libA.d:
module libA;
extern (C)
{
struct Opaque;
Opaque* getObject();
void doSomething(Opaque *);
}
--
libB.d:
module libB;
extern (C)
{
On Thursday, 24 January 2013 at 13:51:27 UTC, Namespace wrote:
On Thursday, 24 January 2013 at 13:42:36 UTC, Namespace wrote:
Thanks for your answer. That explains my question.
I would love to see an official statement about this pull and
this feature. But neither in the related threads or
Hi,
I am trying to figure out the singleton pattern with a struct
instead of a class:
[code]
struct Singleton {
private :
this( int a = 0 ) {} ;
static Singleton * s ;
public :
@disable this() ;
static ref Singleton instance() {
if ( s is
On Thursday, 24 January 2013 at 11:52:57 UTC, Mike Parker wrote:
The only potential bug I see here is in the error message. What
you're seeing is a conflict that arises from D's name mangling.
The doSomething in libA is expecting a parameter of type
libA.Opaque* and getObject is returning
On Thursday, 24 January 2013 at 14:11:10 UTC, ParticlePeter wrote:
Hi,
I am trying to figure out the singleton pattern with a struct
instead of a class:
[code]
struct Singleton {
private :
this( int a = 0 ) {} ;
static Singleton * s ;
public :
@disable this() ;
On 2013-01-24 15:43, Maxim Fomin wrote:
Even if Singleton.instance returns by ref, s object is still
stack-allocated struct, which is not affected by further modification of
private pointer.
The struct is allocated using new.
--
/Jacob Carlborg
Even if Singleton.instance returns by ref, s object is still
stack-allocated struct, which is not affected by further
modification of private pointer.
But where and when is ( a second ? ) Singleton created or
duplicated ? The only ctor is in the static instance ( it is
called only once
On Thursday, 24 January 2013 at 15:05:15 UTC, Jacob Carlborg
wrote:
On 2013-01-24 15:43, Maxim Fomin wrote:
Even if Singleton.instance returns by ref, s object is still
stack-allocated struct, which is not affected by further
modification of
private pointer.
The struct is allocated using
break *cough* valid *cough* existing code.
This wasn't really a new/changed feature that broke your code.
It was just something that worked that never should have worked.
Ok, ok, it wasn't a valid solution but it was the only solution
for handy programming with structs. We have still nothing
Got it, thanks, I changed the instance method to:
[code]
static Singleton * instance() {
if ( s is null )
s = new Singleton( 0 ) ;
return s ;
}
[\code]
and everything works as expected.
Cheers, PP !
On Thursday, 24 January 2013 at 15:50:34 UTC, ParticlePeter wrote:
Got it, thanks, I changed the instance method to:
[code]
static Singleton * instance() {
if ( s is null )
s = new Singleton( 0 ) ;
return s ;
}
[\code]
and
On Wednesday, 23 January 2013 at 17:49:23 UTC, bearophile wrote:
We are getting to the Mathematica again:
http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity
Bye,
bearophile
We're even now ;)
http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#D
On Thursday, 24 January 2013 at 16:07:36 UTC, Maxim Fomin wrote:
Yes, but this can be broken by:
void main()
{
Singleton s = * Singleton.instance;
printf( %d\n, s.val ) ; //
Singleton.instance.val = 2 ;
printf( %d\n, s.val ) ; //0
}
Here s is explicitly
On Thursday, 24 January 2013 at 16:17:34 UTC, Era Scarecrow wrote:
On Thursday, 24 January 2013 at 16:07:36 UTC, Maxim Fomin wrote:
Yes, but this can be broken by:
void main()
{
Singleton s = * Singleton.instance;
printf( %d\n, s.val ) ; //
Singleton.instance.val = 2 ;
Yes, but this can be broken by:
import core.stdc.stdio : printf;
struct Singleton {
private :
this( int a = 0 ) {} ;
static Singleton * s ;
public :
@disable this() ;
static Singleton* instance() {
if ( s is null )
s =
On 01/24/2013 08:52 AM, ParticlePeter wrote:
This method here ( my first approach ) does return a reference to an
object on the heap, right ?
Yes, but the caller does not get a reference.
static ref Singleton instance() {
if ( s is null )
s = new Singleton( 0 ) ;
return * s ;
}
so
On Thursday, 24 January 2013 at 12:56:03 UTC, Matthew Caron wrote:
This is probably a question for Walter, but maybe others know.
Of all of the differences between C and D, the one which I have
the most difficulty adapting to is null being lowercase. Does
anyone know why this decision was
Hello all,
Is there a way to construct a tuple of the types that need to be passed to a
struct or class's constructor?
I tried using ParameterTypeTuple either on the class or its constructor:
ParameterTypeTuple!A
or
ParameterTypeTuple!(A.this)
... but neither works: the former
On Thursday, 24 January 2013 at 17:00:44 UTC, Ali Çehreli wrote:
On 01/24/2013 08:52 AM, ParticlePeter wrote:
This method here ( my first approach ) does return a
reference to an
object on the heap, right ?
Yes, but the caller does not get a reference.
Actually the caller gets the
On 01/24/13 17:52, ParticlePeter wrote:
Yes, but this can be broken by:
import core.stdc.stdio : printf;
struct Singleton {
private :
this( int a = 0 ) {} ;
static Singleton * s ;
public :
@disable this() ;
static Singleton* instance() {
On 1/24/13, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
On 1/24/13, Joseph Rushton Wakeling joseph.wakel...@webdrake.net wrote:
ParameterTypeTuple!(A.this)
Use ParameterTypeTuple!(A.__ctor)
If you have multiple constructors you can pick the parameters with a
helper template:
On 01/24/13 18:14, Artur Skawina wrote:
struct Singleton {
private:
this( int a = 0 ) {} ;
static Singleton* s ;
public:
@disable this();
@disable this(this);
static instance() @property {
static struct Ref(T) { T* obj; ref g() @property { return *obj; }
On Thursday, 24 January 2013 at 17:00:44 UTC, Ali Çehreli wrote:
On 01/24/2013 08:52 AM, ParticlePeter wrote:
This method here ( my first approach ) does return a
reference to an
object on the heap, right ?
Yes, but the caller does not get a reference.
static ref Singleton instance() {
if
On 01/24/2013 06:14 PM, Andrej Mitrovic wrote:
On 1/24/13, Joseph Rushton Wakeling joseph.wakel...@webdrake.net wrote:
ParameterTypeTuple!(A.this)
Use ParameterTypeTuple!(A.__ctor)
Brilliant. Thanks very much. :-)
On Thursday, 24 January 2013 at 17:21:38 UTC, Artur Skawina wrote:
On 01/24/13 17:52, ParticlePeter wrote:
Yes, but this can be broken by:
import core.stdc.stdio : printf;
struct Singleton {
private :
this( int a = 0 ) {} ;
static Singleton * s ;
public :
@disable
On 01/24/2013 09:26 AM, ParticlePeter wrote:
Thanks, I re-read the purpose of ref type function() in the D
programming language, and the sole purpose is that such a function call
can be directly a parameter to another function expecting a ref ?
As Maxim Fomin noted, I didn't word it
On 01/24/13 18:35, ParticlePeter wrote:
On Thursday, 24 January 2013 at 17:21:38 UTC, Artur Skawina wrote:
On 01/24/13 17:52, ParticlePeter wrote:
Why is the s inside the struct and another_s not identical ?
Afaik that is the purpose of the ref keyword ?
There currently are no reference
On 01/24/2013 04:56 AM, Matthew Caron wrote:
This is probably a question for Walter, but maybe others know.
Of all of the differences between C and D, the one which I have the most
difficulty adapting to is null being lowercase. Does anyone know why
this decision was made?
Similarly, the
There may be more than one this, so you'll have to specify the
args for each specific constructor manually.
Disclaimer: Someone else may have a better solution as I'm not
that much of an expert in this area.
This sample may point you in the right direction ...
import std.typetuple;
struct
On Thursday, 24 January 2013 at 17:35:58 UTC, Ali Çehreli wrote:
On 01/24/2013 09:26 AM, ParticlePeter wrote:
Thanks, I re-read the purpose of ref type function() in the D
programming language, and the sole purpose is that such a
function call
can be directly a parameter to another function
On Thursday, 24 January 2013 at 16:49:53 UTC, Maxim Fomin wrote:
On Thursday, 24 January 2013 at 16:17:34 UTC, Era Scarecrow
wrote:
Hmmm. You could separate the data and remove the pointer...
then use alias this.
[code]
struct Singleton {
static SingletonData single;
alias single this;
You can use magic functions __ctor and __dtor which actually
serve as constructor and destructor implementations behind the
scene.
Example and proof-of-concept: http://dpaste.1azy.net/fd924332
Have no idea if it is explicitly defined by spec somewhere though.
On 01/24/2013 01:08 AM, dale wrote:
I am following these helpful suggestions, but still having trouble
linking properly. I have Visual Studio 10 and its 64-bit extension
installed, and I believe the amd64\link.exe is getting called, but I
must have something configured incorrectly, because it
On Thursday, January 24, 2013 18:24:32 Namespace wrote:
In relation to this post:
http://forum.dlang.org/thread/hlyospppnjiziyokf...@forum.dlang.org?page=2#po
st-qxqvreqpniftjnwxvqgt:40forum.dlang.org
I dicided to test a bit with manual auto ref.
This Code works as expected.
[code]
On 01/24/2013 11:33 AM, Jonathan M Davis wrote:
It's intended. constness matters more than refness when selecting a
function
overload. From the docs ( http://dlang.org/function.html#ufunction/u-
overloading ):
-
Functions are overloaded based on how well the arguments to a function
On Thursday, 24 January 2013 at 20:06:34 UTC, Ali Çehreli wrote:
On 01/24/2013 11:33 AM, Jonathan M Davis wrote:
It's intended. constness matters more than refness when
selecting a function overload. From the docs (
http://dlang.org/function.html#ufunction/u-overloading ):
-
Functions
On 01/24/2013 12:50 PM, Ali Çehreli wrote:
Similarly, the common macros TRUE and FALSE are replaced by the 'true'
and 'false' keywords.
Ironically, those don't bother me because I never used them.
--
Matthew Caron, Software Build Engineer
Sixnet, a Red Lion business | www.sixnet.com
+1 (518)
On 01/24/2013 12:04 PM, Rob T wrote:
You'll get used to it, it's actually much better than typing in NULL,
and it's a real type instead on an int, which never worked well in C.
Just be warned that when checking for null *do not* use equality operator
Yeah, the compiler helped me find that one
On Thursday, January 24, 2013 12:06:33 Ali Çehreli wrote:
On 01/24/2013 11:33 AM, Jonathan M Davis wrote:
It's intended. constness matters more than refness when selecting a
function
overload. From the docs ( http://dlang.org/function.html#ufunction/u-
overloading ):
-
On Thursday, 24 January 2013 at 20:06:34 UTC, Ali Çehreli wrote:
On 01/24/2013 11:33 AM, Jonathan M Davis wrote:
It's intended. constness matters more than refness when
selecting a function
overload. From the docs (
http://dlang.org/function.html#ufunction/u-
overloading ):
-
On Thursday, 24 January 2013 at 18:41:31 UTC, mist wrote:
You can use magic functions __ctor and __dtor which actually
serve as constructor and destructor implementations behind the
scene.
Example and proof-of-concept: http://dpaste.1azy.net/fd924332
Have no idea if it is explicitly defined
On Thursday, 24 January 2013 at 13:22:20 UTC, Maxim Fomin wrote:
On Thursday, 24 January 2013 at 10:14:29 UTC, Minas Mina wrote:
I am trying to create a BVH tree structure to speed up
raytracing. So far it has been fine. I have created the BVH
tree. It works for 202 triangles/spheres.
On Thu, Jan 24, 2013 at 10:34 PM, Rob T al...@ucora.com wrote:
On Thursday, 24 January 2013 at 18:41:31 UTC, mist wrote:
You can use magic functions __ctor and __dtor which actually serve as
constructor and destructor implementations behind the scene.
Example and proof-of-concept:
On 1/24/13, Philippe Sigaud philippe.sig...@gmail.com wrote:
IIRC, you can use __traits(getOverloads, mytype.__ctor) to get all
constructor overloads.
See:
http://dlang.org/traits.html#getOverloads
I used this in conjunction with __traits(getMember, ...) to get the
entire list of member,
Brilliant! Thanks.
I think the silent one has errors. But I've used the first
function in my program now. With mine, strait after doing the
copying is was supposed then update a file, but didn't. Your one
seems to work though.
On Thursday, 24 January 2013 at 08:58:06 UTC, monarch_dodra
On Thursday, 24 January 2013 at 22:49:33 UTC, Andrej Mitrovic
wrote:
On 1/24/13, Philippe Sigaud philippe.sig...@gmail.com wrote:
IIRC, you can use __traits(getOverloads, mytype.__ctor) to get
all
constructor overloads.
See:
http://dlang.org/traits.html#getOverloads
I used this in conjunction
On 01/24/2013 12:25 PM, Era Scarecrow wrote:
What is also considered in function selection is the rvalue-lvalue
distinction, which shouldn't affect the outcome here either.
In case David's explanation was too confusing, then let's look at it. If
your variable is non-const, it will always
On 01/24/2013 12:42 PM, Matthew Caron wrote:
for not null checks
if ( ptr !is null) ...
And too much perl has me wanting to write:
if (ptr is not null)
IIRC, the !is operator is thanks to bearophile. We would have to reverse
the logic before he insisted on !is: :)
if (!(ptr is
qznc:
We're even now ;)
http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#D
I have cut some lines, and I have used a more functional style,
that fits well for this entry. Compared to the C++ entry this D
entry is nicer.
I greatly prefer the verbose option of the
On Thursday, January 24, 2013 17:13:36 Ali Çehreli wrote:
On 01/24/2013 12:25 PM, Era Scarecrow wrote:
What is also considered in function selection is the rvalue-lvalue
distinction, which shouldn't affect the outcome here either.
In case David's explanation was too confusing, then let's
This is the current syntax to import several modules from the std
package:
import std.stdio, std.algorithm, std.range, std.array;
This is the syntax to import names from a module:
import std.stdio: writeln, write;
Currently this is not accepted, but do you like a syntax to
import modules
On 1/25/13, bearophile bearophileh...@lycos.com wrote:
Currently this is not accepted, but do you like a syntax to
import modules that is more consistent (the same as the one used
to import names from a module)?
import std: stdio, algorithm, range, array;
FWIW this was filed as an
Andrej Mitrovic:
FWIW this was filed as an enhancement a few years ago:
http://d.puremagic.com/issues/show_bug.cgi?id=3603
Thank you. Commented and voted.
Bye,
bearophile
On Friday, 25 January 2013 at 01:57:02 UTC, Jonathan M Davis
wrote:
The compiler _has_ to pick either const or ref as having higher
precedence. ref was almost certainly chosen as having higher
precedence because it avoids a conversion, but also by picking
ref, you end up with fewer unnecessary
On Friday, January 25, 2013 05:14:45 Era Scarecrow wrote:
On Friday, 25 January 2013 at 01:57:02 UTC, Jonathan M Davis
wrote:
The compiler _has_ to pick either const or ref as having higher
precedence. ref was almost certainly chosen as having higher
precedence because it avoids a
On Thursday, 24 January 2013 at 07:41:23 UTC, Jacob Carlborg
wrote:
Someone posted code in these newsgroups of a parallel
implementation of copy and remove.
I posted a parallel implementation a while back, and also put it
on github.
The parallel trick is to create the folder structure
On Friday, 25 January 2013 at 04:26:18 UTC, Jonathan M Davis
wrote:
With templated code, it can be important. But then again, if
there's no point in having a non-const overload, you can simply
not declare any overloads without const. You only run into
problems when you mix const and non-const.
On Thursday, January 24, 2013 21:38:42 Ali Çehreli wrote:
If const really requires a conversion then we have a language design
problem here.
No. const T is _not_ the same type as T, therefore assigning a T to a const T
_is_ a type conversion. _Any_ time that a variable of one type is assigned
Sounds cool. I've bookmarked your github hub link.
Just wondering with this:
// parallel foreach for regular files
foreach(fn ; taskPool.parallel(files,100)) {
string dfn = destRoot ~ fn[srcLen..$];
copy(fn,dfn);
}
What is the 100 number for?
On Friday, 25 January 2013 at 05:30:11
On Friday, 25 January 2013 at 01:52:27 UTC, bearophile wrote:
qznc:
We're even now ;)
http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#D
I have cut some lines, and I have used a more functional style,
that fits well for this entry. Compared to the C++ entry this D
75 matches
Mail list logo