On 12/12/2013 4:44 PM, frustrated2 wrote:
thanks for your reply. its a shame that the language does not supply
ready to use headers. i can live with missing libraries, but not with
incomplete or non working bare minimal prerequisites to use it with an os.
that is a sad and sorry state!
I don't
Mike Parker:
I would be content if DMD did not ship Win32 bindings at all,
except for the minimal needed to implement cross-platform stuff
in Phobos. As it stands, the static libs for the Win32 API that
ship with DMD are old and don't include a good number of modern
functions anyway. IMO,
On Thursday, 12 December 2013 at 03:17:29 UTC, Malkierian wrote:
On Tuesday, 10 December 2013 at 03:42:10 UTC, Malkierian wrote:
On Tuesday, 10 December 2013 at 02:05:12 UTC, Jeremy DeHaan
wrote:
On Monday, 9 December 2013 at 16:49:04 UTC, Malkierian wrote:
On Monday, 9 December 2013 at
On Thursday, 12 December 2013 at 00:51:56 UTC, dnewbie wrote:
On Wednesday, 11 December 2013 at 23:42:44 UTC, Gary Willoughby
wrote:
For example i have some C code like this:
typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData
clientData, Tcl_Interp *interp));
void
On Thu, 12 Dec 2013 00:04:07 -, H. S. Teoh hst...@quickfur.ath.cx
wrote:
On Thu, Dec 12, 2013 at 12:54:58AM +0100, Gary Willoughby wrote:
On Wednesday, 11 December 2013 at 23:38:13 UTC, Adam D. Ruppe wrote:
On Wednesday, 11 December 2013 at 23:35:04 UTC, Gary Willoughby
wrote:
static
On Wednesday, 11 December 2013 at 09:04:32 UTC, frustrated2 wrote:
Are there complete windows headers and if yes where can i find
them and will they work for 64bit?
I've also generated from Mingw64 windows static binding[1]. So it
definitely will work with Windows 7 64bit. However I've only
Regan Heath:
I would stop nesting the struct definition. I think that is
both cleaner and closer to the original intent - the only
reason it is nested in C is because C allows definition and
declaration that way, and D does not. Then you don't need
static at all.
It's mostly a matter of
On Thu, 12 Dec 2013 08:18:51 -, Mike Parker aldac...@gmail.com wrote:
On 12/12/2013 4:44 PM, frustrated2 wrote:
thanks for your reply. its a shame that the language does not supply
ready to use headers. i can live with missing libraries, but not with
incomplete or non working bare minimal
I prefer languages with more batteries included - for sure. its
a nice compiler, love the language, but i do not want to waste
the time to do everything myself. even basic compilers (yuck)
offer more tools, windows programming and db stuff than D.
On Thursday, 12 December 2013 at 09:49:31
Gary Willoughby:
alias void function(ClientData clientData, Tcl_Interp* interp)
Tcl_InterpDeleteProc;
extern (C) void Tcl_CallWhenDeleted(Tcl_Interp* interp,
Tcl_InterpDeleteProc proc, ClientData clientData);
With recent D compilers I prefer the alias with = and a more
aligned colums
On Thursday, 12 December 2013 at 11:11:55 UTC, bearophile wrote:
Gary Willoughby:
alias void function(ClientData clientData, Tcl_Interp* interp)
Tcl_InterpDeleteProc;
extern (C) void Tcl_CallWhenDeleted(Tcl_Interp* interp,
Tcl_InterpDeleteProc proc, ClientData clientData);
With recent D
On Thursday, 12 December 2013 at 11:08:41 UTC, Regan Heath wrote:
Does DMD support the M$ dll/lib format or is that still an
issue? I know there is a conversion tool, but IIRC you have to
pay for that.. this hassle was another reason I stopped using
D for my personal projects.
with -m64
On 12/12/2013 8:20 PM, frustrated2 wrote:
I prefer languages with more batteries included - for sure. its a nice
compiler, love the language, but i do not want to waste the time to do
everything myself. even basic compilers (yuck) offer more tools, windows
programming and db stuff than D.
I
On 12/12/2013 8:08 PM, Regan Heath wrote:
MinGW distros. Even with VC, you still have to download the Windows
SDK separately.
I don't believe this last statement is true. I am fairly certain that
upon installing VC you have everything you need to call/use Win32
functions. The only reason to
Am Wed, 11 Dec 2013 11:04:29 +0100
schrieb Gianni Pisetta pisetta.gia...@alice.it:
On Wednesday, 11 December 2013 at 08:54:18 UTC, Marco Leise wrote:
Am Wed, 11 Dec 2013 09:10:09 +0100
schrieb Gianni Pisetta pisetta.gia...@alice.it:
No, i think fork or something similar is the way i
Am Wed, 11 Dec 2013 17:40:39 +0100
schrieb Joseph Rushton Wakeling joseph.wakel...@webdrake.net:
On 11/12/13 11:10, John Colvin wrote:
A lot of the performance loss is down to missed optimisations, in particular
inlining.
Simple example:
foreach(i; iota(0, 10)) { ... }
should
I created a separate branch for the syntax Type[$] and auto[$]:
https://github.com/Dgame/dmd/commit/438a519d28d1683086083e673b2630a64c269f5f
Example:
int[$] arr_a1 = [54, 74, 90, 2010];
assert(is(typeof(arr_a1) == int[4]));
assert(arr_a1 == [54, 74, 90, 2010]);
int[$] arr_a2 = [2010, 90,
Namespace:
Sadly I don't know how I could deduce the type of:
auto[$] a_arr2 = dyn_arr[4 .. 8]; /// Sadly not possible for me
It seems a valid use case.
Bye,
bearophile
I presume the situation with this code is not changed by your
patches:
string[3] a = [redgreen,blue];
void main() {}
Bye,
bearophile
On 2013-12-11 23:45, Gary Willoughby wrote:
How to handle nested structs when converting C headers?
In the following snippet i'm currently converting, how would you convert
the nested typed union and structures? Would you declare them separately
then use their types in the Tcl_Obj struct? or is
string[3] a = [redgreen,blue];
void main() {}
I suggested to support such incomplete literals only with this
extra syntax:
int[3] a = [1, 2, ...];
void main() {}
Bye,
bearophile
I am not sure if this belongs in D.learn, but it might be of
interest. I was writing some C++ code for a project at work and
have a class that stores image data from a file. The image data
can be in just about any numeric (int/float/complex) type, so I
wanted a 'wrapper' class/struct that
On Wednesday, 11 December 2013 at 16:40:48 UTC, Joseph Rushton
Wakeling wrote:
[* If I recall right, it's achievable by special-casing iota
when the increment is 1, but don't quote me on that.]
That shouldn't be necessary if the iota operations are inlined
(which, if their not, is a much
On 12/11/2013 05:09 PM, bearophile wrote:
Ali Çehreli:
int[] arr2 = [7, 8, 9]s;
assert(is(typeof(arr2) == int[3]));
That looks very confusing. The left-hand side looks like a slice,
which I can append elements to but its type is a static array?
No, the type of the literal is
On Thu, 12 Dec 2013 12:16:57 -, Mike Parker aldac...@gmail.com wrote:
On 12/12/2013 8:08 PM, Regan Heath wrote:
MinGW distros. Even with VC, you still have to download the Windows
SDK separately.
I don't believe this last statement is true. I am fairly certain that
upon installing VC
Ali Çehreli:
But look at the assertion: the type of the *slice* arr2 is
int[3]. :)
I didn't notice that. It looks strange... I don't understand it.
Bye,
bearophile
On Thursday, 12 December 2013 at 15:35:52 UTC, bearophile wrote:
Ali Çehreli:
But look at the assertion: the type of the *slice* arr2 is
int[3]. :)
I didn't notice that. It looks strange... I don't understand it.
Bye,
bearophile
I already pointed out why it was that way AND that it's
Consider the following:
struct JustZeroes {
int front = 0;
enum bool = false;
void popFront() {}
}
Is that guaranteed to work as an input range? I ask because I've
so often written:
T current;
@property T front() { return current; }
that it just seems silly to me to write
I'd expect http://dlang.org/phobos/std_range.html#.isInputRange
to be standard answer to this question (== yes, it is ok).
On Thu, Dec 12, 2013 at 05:19:28PM +0100, Adam D. Ruppe wrote:
Consider the following:
struct JustZeroes {
int front = 0;
enum bool = false;
void popFront() {}
}
Is that guaranteed to work as an input range? I ask because I've so
often written:
T current;
@property
Adam D. Ruppe:
Consider the following:
struct JustZeroes {
int front = 0;
enum bool = false;
void popFront() {}
}
Is that guaranteed to work as an input range?
It seems similar to 0.repeat
When you are not sure add a static assert below the range, to
verify it is the kind of
Hello,
when I try to compile something with dmd,
I get following message:
/usr/include/dmd/phobos/std/bitmanip.d(416): Error: undefined
identifier '_xopCmp'
Error: ICE: _xopCmp not found in object module. You must update
druntime
How to 'update druntime' ?
On 12/12/2013 08:19 AM, Adam D. Ruppe wrote:
Consider the following:
struct JustZeroes {
int front = 0;
enum bool = false;
You meant empty = false;
void popFront() {}
}
Is that guaranteed to work as an input range?
Yes it is perfectly fine. And if it works for empty it
On 12/12/13 17:19, Adam D. Ruppe wrote:
Is that guaranteed to work as an input range? I ask because I've so often
written:
T current;
@property T front() { return current; }
that it just seems silly to me to write the extra lines when current == front. I
realize there is a small
On 12/12/13 17:51, Joseph Rushton Wakeling wrote:
Isn't the issue here not whether or not it will work in terms of your type being
a range, and more that it means that users can overwrite the value of front?
... if OTOH the idea is that front never changes, then I'd suggest an enum, as
is
On Thursday, 12 December 2013 at 16:52:12 UTC, Joseph Rushton
Wakeling wrote:
and more that it means that users can overwrite the value of
front?
Yeah, that's what I meant by the lvalue thing, though most the
time I don't think it is even that big of a deal if it gets
overwritten since the
On Thursday, 12 December 2013 at 16:45:05 UTC, H. S. Teoh wrote:
I do this with my own ranges sometimes. Sometimes, it's more
performant to precompute the value of .front and store it (as
.front)
Yeah, that's exactly what I was doing here.
My question was mostly on if there's the chance that
void rename(in char[] from, in char[] to);
Rename file from to to. If the target file exists, it is
overwritten.
Throws:
FileException on error.
Just wanted to know if this operation is atomic?
or does it depend on the underlying file system?
In short, in the file
On Thursday, 12 December 2013 at 14:55:28 UTC, Craig Dillabaugh
wrote:
I am not sure if this belongs in D.learn, but it might be of
interest. I was writing some C++ code for a project at work
and have a class that stores image data from a file. The image
data can be in just about any numeric
With some improvements you also can provide compile-time error
about instantiation of non-specialized function (i.e. which has T
as parameter), but I'm not sure what's good way to do it in C++.
Namespace:
Your gig:
https://github.com/D-Programming-Language/dmd/pull/2952#discussion_r8288045
This is part of the thread there:
Furhtermore, what if we indeed want to pass a dynamic array ?
Kenji Use cast. In real world, if overloaded function takes both
int[] and int[3], normally
On Thursday, 12 December 2013 at 16:44:28 UTC, Benji wrote:
Hello,
when I try to compile something with dmd,
I get following message:
/usr/include/dmd/phobos/std/bitmanip.d(416): Error: undefined
identifier '_xopCmp'
Error: ICE: _xopCmp not found in object module. You must update
druntime
On Thursday, 12 December 2013 at 16:52:12 UTC, Joseph Rushton
Wakeling wrote:
On 12/12/13 17:19, Adam D. Ruppe wrote:
Is that guaranteed to work as an input range? I ask because
I've so often written:
T current;
@property T front() { return current; }
that it just seems silly to me to
On Thursday, 12 December 2013 at 17:08:13 UTC, Jacek
Furmankiewicz wrote:
void rename(in char[] from, in char[] to);
Rename file from to to. If the target file exists, it
is overwritten.
Throws:
FileException on error.
Just wanted to know if this operation is
On Thursday, 12 December 2013 at 19:11:03 UTC, John Colvin wrote:
On Thursday, 12 December 2013 at 16:44:28 UTC, Benji wrote:
Hello,
when I try to compile something with dmd,
I get following message:
/usr/include/dmd/phobos/std/bitmanip.d(416): Error: undefined
identifier '_xopCmp'
Error:
On Thu, Dec 12, 2013 at 08:12:50PM +0100, Jesse Phillips wrote:
On Thursday, 12 December 2013 at 16:52:12 UTC, Joseph Rushton
Wakeling wrote:
On 12/12/13 17:19, Adam D. Ruppe wrote:
Is that guaranteed to work as an input range? I ask because I've
so often written:
T current;
@property
On Thursday, 12 December 2013 at 21:51:14 UTC, Ross Hays wrote:
if (cast(Asset)T)
Try this instead:
if(is(T : Asset))
the is thing checks types. You can do is(T == Asset) for the
specific class, or is(T : Asset) which means it implicitly
converts to it - in otherworts, if T is
On 12/12/2013 12:06 PM, H. S. Teoh wrote:
On Thu, Dec 12, 2013 at 08:12:50PM +0100, Jesse Phillips wrote:
On Thursday, 12 December 2013 at 16:52:12 UTC, Joseph Rushton
Wakeling wrote:
On 12/12/13 17:19, Adam D. Ruppe wrote:
Is that guaranteed to work as an input range? I ask because I've
so
On Thursday, 12 December 2013 at 21:53:20 UTC, Adam D. Ruppe
wrote:
On Thursday, 12 December 2013 at 21:51:14 UTC, Ross Hays wrote:
if (cast(Asset)T)
Try this instead:
if(is(T : Asset))
the is thing checks types. You can do is(T == Asset) for the
specific class, or is(T : Asset)
On 12/12/13 22:55, Ali Çehreli wrote:
That condition is what makes a slice an OutputRange, which causes the super
confusing state of output range losing elements after put'ting: :)
import std.range;
void main()
{
auto s = [ 1, 2, 3 ];
s.put(10);
assert(s.length == 2); // PASSES!
On Thursday, 12 December 2013 at 22:05:17 UTC, Ross Hays wrote:
http://dlang.org/expression.html#IsExpression and had no idea
is could be used with that syntax. The more D I learn the more
counter-intuitive I find some aspects of the language syntax.
Yeah, the is expression is one of the
What i am looking for is something like the following.
class Foo
{
int a, b, c;
}
void main() {
void[] buffer = new void[1024];
auto foo = createAt!(Foo)(buffer.ptr);
}
Where the createAt!(Foo) creates a class of the type Foo at the
specified pointer.
I have a lot of opaque types in C headers i'm porting to D. What
is the best way to handle these? Would you just use void pointers?
In the below example Tcl_AsyncHandler_ is not defined anywhere.
C:
typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
D:
alias void* Tcl_AsyncHandler;
On Thursday, 12 December 2013 at 22:54:26 UTC, TheFlyingFiddle
wrote:
What i am looking for is something like the following.
class Foo
{
int a, b, c;
}
void main() {
void[] buffer = new void[1024];
auto foo = createAt!(Foo)(buffer.ptr);
}
Where the createAt!(Foo) creates a class
emplace() is what you are looking for (found inexplicably in
std.conv).
http://dlang.org/phobos/std_conv.html#.emplace
Exactly what i wanted :) Thanks for the quick answer!
And yeah... std.conv seems like a wierd place to have this
functionallity.
On Thu, Dec 12, 2013 at 11:23:15PM +0100, Adam D. Ruppe wrote:
On Thursday, 12 December 2013 at 22:05:17 UTC, Ross Hays wrote:
http://dlang.org/expression.html#IsExpression and had no idea is
could be used with that syntax. The more D I learn the more
counter-intuitive I find some aspects of
Why don't you discuss on github?
And finally I did it:
auto[$] a_arr2 = dyn_arr[4 .. 8];
assert(is(typeof(a_arr2) == int[4]));
I will make a Pull Request tomorrow. Hope my code isn't that bad.
:/
I would like to be able to do this.
auto vector = vec4(1,2,3,4);
vector.zxy += vec3(4,4,4);
I'm currently able to do this:
vector.zxy = vec3(4,4,4);
Assigns 4 to the x,y and z components.
and this
auto other = vector.zxy;
other is a vector3 with
other.x == vector.z
other.y == vector.x
On 12/13/2013 7:52 AM, Gary Willoughby wrote:
I have a lot of opaque types in C headers i'm porting to D. What is the
best way to handle these? Would you just use void pointers?
In the below example Tcl_AsyncHandler_ is not defined anywhere.
C:
typedef struct Tcl_AsyncHandler_
Hello. I'm just getting into D (literally writing my first
program), and I can't figure out how to do this with getopt:
I want to have the option --log, which will enable logging (set a
bool variable to true). However, I want the program to also
accept --log=filename to allow the user to
On Thursday, 12 December 2013 at 18:20:25 UTC, bearophile wrote:
Namespace:
Your gig:
https://github.com/D-Programming-Language/dmd/pull/2952#discussion_r8288045
This is part of the thread there:
Furhtermore, what if we indeed want to pass a dynamic array
?
Kenji Use cast. In real world,
Hi,
The following code dies with a segfault :
import std.stdio, std.parallelism, std.process;
void main() {
auto a=[hello,world,goodbye];
foreach(s; parallel(a,1)) {
auto ls=executeShell(echo ~s);
writeln(ls.output);
}
}
both in ldc and
On Thursday, 12 December 2013 at 17:34:13 UTC, FreeSlave wrote:
On Thursday, 12 December 2013 at 14:55:28 UTC, Craig Dillabaugh
wrote:
I am not sure if this belongs in D.learn, but it might be of
interest. I was writing some C++ code for a project at work
and have a class that stores image
On Friday, 13 December 2013 at 00:53:17 UTC, TheFlyingFiddle
wrote:
I would like to be able to do this.
auto vector = vec4(1,2,3,4);
vector.zxy += vec3(4,4,4);
I'm currently able to do this:
vector.zxy = vec3(4,4,4);
Assigns 4 to the x,y and z components.
and this
auto other =
Yeah, is-expression syntax is one of the dark, ugly corners of
D that
unfortunately we're stuck with, because changing it now will
totally
break a LOT of code for merely cosmetic reasons. I honestly
wish that
one day this mess could be cleared up, though I'm not holding
my breath
for it.
T
On Friday, 13 December 2013 at 05:22:26 UTC, Ross Hays wrote:
Yeah, is-expression syntax is one of the dark, ugly corners of
D that
unfortunately we're stuck with, because changing it now will
totally
break a LOT of code for merely cosmetic reasons. I honestly
wish that
one day this mess could
On Fri, Dec 13, 2013 at 06:42:26AM +0100, Brian Rogoff wrote:
On Friday, 13 December 2013 at 05:22:26 UTC, Ross Hays wrote:
Yeah, is-expression syntax is one of the dark, ugly corners of D
that unfortunately we're stuck with, because changing it now will
totally break a LOT of code for merely
On Friday, 13 December 2013 at 04:13:04 UTC, Kenji Hara wrote:
On Thursday, 12 December 2013 at 18:20:25 UTC, bearophile wrote:
If I have a function foo that takes a slice as input, and I
want to pass it two arrays, the first time allocated on the
heap and the second on the stack, I have to
On Friday, December 13, 2013 07:19:50 Maxim Fomin wrote:
On Friday, 13 December 2013 at 04:13:04 UTC, Kenji Hara wrote:
On Thursday, 12 December 2013 at 18:20:25 UTC, bearophile wrote:
If I have a function foo that takes a slice as input, and I
want to pass it two arrays, the first time
On Thursday, December 12, 2013 17:19:28 Adam D. Ruppe wrote:
Consider the following:
struct JustZeroes {
int front = 0;
enum bool = false;
void popFront() {}
}
Is that guaranteed to work as an input range? I ask because I've
so often written:
T current;
On Thursday, 12 December 2013 at 21:55:20 UTC, Ali Çehreli wrote:
The third condition that is checked to determine whether it is
an OutputRange is indeed assignment to front.
http://dlang.org/phobos/std_range.html#.put
That condition is what makes a slice an OutputRange, which
causes the
On Friday, 13 December 2013 at 07:28:57 UTC, qznc wrote:
Ouch. That surely is confusing. Why don't arrays provide .put
which appends the element?
Basically, when you're using an array as an output range, you're
saying Hey, here's a slice of memory to put the results in.
You're _not_ saying
I remember seeing some posts about D and how the way it sounded
was that D kind of filled the role of C++, without all the burden
of years of full backwards comparability. I wouldn't dare say it
is that bad, but this is how the problem starts I feel. I would
love to see a release cycle like
73 matches
Mail list logo