Re: Can't install DMD 2.060 on OS X 10.6.8

2012-09-17 Thread Jacob Carlborg
On 2012-09-17 07:49, Elias Zamaria wrote: I am planning to try D for the first time in my life. I have a MacBook Pro running OS X 10.6.8 (Snow Leopard). I went on the D downloads page and clicked on the link for the dmd 2.060 installer for OS X. I opened it and double clicked on the DMD2.pkg

Re: Packaging D libraries, cross compiler compatibility

2012-09-17 Thread Jacob Carlborg
On 2012-09-17 01:33, Joseph Rushton Wakeling wrote: If we're talking Debian, the only compilers to consider are GDC and LDC -- DMD is non-free by Debian standards. I'm sure the runtimes are different anyway. Although, I don't know how LDC handles the calling convention. -- /Jacob Carlborg

Re: Can't install DMD 2.060 on OS X 10.6.8

2012-09-17 Thread Elias Zamaria
Check the Console? How do I do that? What console are you referring to? Also, why is this installer on the official-looking download page if it doesn't work? Should whoever is in control of the page put this other thing there instead? I have no idea how I was supposed to know about DVM. On

Re: Can't install DMD 2.060 on OS X 10.6.8

2012-09-17 Thread Jacob Carlborg
On 2012-09-17 08:49, Elias Zamaria wrote: Check the Console? How do I do that? What console are you referring to? /Applications/Utilities/Console.app Also, why is this installer on the official-looking download page if it doesn't work? Should whoever is in control of the page put this other

ref keys

2012-09-17 Thread Namespace
Until now it is possible to have const keys in assocative arrays, e.g. Tile[const Vector2s], but it isn't possible to have ref keys, e.g. Tile[ref Vector2s]. If I have this code: [code] class A { } A a1 = new A(); int[A] array; [/code] I can do: array[new A()] = 42; array[a1] = 23; Both

Regarding type deduction

2012-09-17 Thread bearophile
Do you think it's useful and possible to extend the D type inference (deduction) for templates to support something like this (I know there are different ways to do this in D)? struct Tree1 { static struct Node { int x; } } struct Tree2 { static struct Node { int x, y; } } void

Re: Regarding type deduction

2012-09-17 Thread Jesse Phillips
On Monday, 17 September 2012 at 14:54:48 UTC, bearophile wrote: Do you think it's useful and possible to extend the D type inference (deduction) for templates to support something like this (I know there are different ways to do this in D)? struct Tree1 { static struct Node { int x; } }

Get identifier of this

2012-09-17 Thread Andre
Hi, assuming I have following constuct: public class Bank{ public enum test() { return writeln(\~__traits(identfier, this)~\);; } } public static void main(){ Bank b = new Bank; mixin(b.test()); } During compile time, following code should be generated: writeln(b); Is

Re: Get identifier of this

2012-09-17 Thread Andrej Mitrovic
On 9/17/12, Andre an...@s-e-a-p.de wrote: Get identifier of this You can't really get that info at runtime, a class object isn't bound to a name, 'this' has no identifier. Symbols (like variables) have identifiers, not objects. public class Bank{ Unnecessary, declarations are public by

Re: Get identifier of this

2012-09-17 Thread Steven Schveighoffer
On Mon, 17 Sep 2012 14:01:35 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Your original sample does cause a compiler ICE but I don't know if it's worth filing since the code was invalid. Please file, ICE should never occur. -Steve

Re: Get identifier of this

2012-09-17 Thread Andrej Mitrovic
On 9/17/12, Steven Schveighoffer schvei...@yahoo.com wrote: Please file, ICE should never occur. You're bound to find a small million of these when it comes to typos in templates. :) http://d.puremagic.com/issues/show_bug.cgi?id=8679

Re: Get identifier of this

2012-09-17 Thread Andre
On Monday, 17 September 2012 at 18:01:02 UTC, Andrej Mitrovic wrote: On 9/17/12, Andre an...@s-e-a-p.de wrote: Get identifier of this You can't really get that info at runtime, a class object isn't bound to a name, 'this' has no identifier. Symbols (like variables) have identifiers, not

Re: Get identifier of this

2012-09-17 Thread Jonathan M Davis
On Monday, September 17, 2012 19:43:24 Andre wrote: Hi, assuming I have following constuct: public class Bank{ public enum test() { return writeln(\~__traits(identfier, this)~\);; } } public static void main(){ Bank b = new Bank; mixin(b.test()); } During compile time,

std.net.curl - how to set custom Content-Type?

2012-09-17 Thread Dmitry Olshansky
Recently was playing around with std.net.curl high-level API. One thing that is a blocker for me is (quoting the docs): @property void postData(const(char)[] data); Specifying data to post when not using the onSend callback. ... Content-Type will default to text/plain. Data is not converted or

Re: ref keys

2012-09-17 Thread Jonathan M Davis
On Monday, September 17, 2012 15:42:55 Namespace wrote: Until now it is possible to have const keys in assocative arrays, Keys are supposed to be immutable. If that's not enforced by the compiler, then it's a bug. Given the current issues with the implementation for AAs' it wouldn't surprise

ctfe slicing

2012-09-17 Thread Ellery Newcomer
does it still copy the slice?

Re: ref keys

2012-09-17 Thread Namespace
As you can see here, you can change the key very easily: http://dpaste.dzfl.pl/71697a23 But even they would be immutable: I have still no guarantee that my key must be a lvalue. Or am I wrong? Otherwise I'm still for ref keys.

Re: std.net.curl - how to set custom Content-Type?

2012-09-17 Thread Johannes Pfau
Am Mon, 17 Sep 2012 22:33:28 +0400 schrieb Dmitry Olshansky dmitry.o...@gmail.com: Recently was playing around with std.net.curl high-level API. One thing that is a blocker for me is (quoting the docs): @property void postData(const(char)[] data); Specifying data to post when not using

Re: std.net.curl - how to set custom Content-Type?

2012-09-17 Thread Jonathan M Davis
On Monday, September 17, 2012 20:59:05 Johannes Pfau wrote: addRequestHeader is quite dumb. It simply appends the header to a list. So by just calling it again you would actually send 2 Content-Type headers. So, you're suggesting to send 2 content headers? That can't be good. It might work,

problems with nothrow

2012-09-17 Thread Namespace
It seems that nothrow functions/methods which take a AA have some problems with .length and opApply, but I'm not sure if I should report it as a bug. Here the code: http://dpaste.dzfl.pl/a61e721e http://dpaste.dzfl.pl/3652fcc4

Re: ref keys

2012-09-17 Thread Jonathan M Davis
On Monday, September 17, 2012 20:56:21 Namespace wrote: As you can see here, you can change the key very easily: http://dpaste.dzfl.pl/71697a23 It's a bug. It should already be reported somewhere, but I can't find it, so re-reported it: http://d.puremagic.com/issues/show_bug.cgi?id=8681 The

Re: ref keys

2012-09-17 Thread Namespace
I thought that new A() could be implicit immutable. Thanks for reporting.

Re: ref keys

2012-09-17 Thread anonymous
On Monday, 17 September 2012 at 13:42:08 UTC, Namespace wrote: I can do: array[new A()] = 42; array[a1] = 23; Both lines are valid. But if I would access the elements later with their keys, I can't because I have not a valid key for the element 42, only for 23. so my suggestion is: allow

Re: problems with nothrow

2012-09-17 Thread Jonathan M Davis
On Monday, September 17, 2012 22:59:31 Namespace wrote: It seems that nothrow functions/methods which take a AA have some problems with .length and opApply, but I'm not sure if I should report it as a bug. Here the code: http://dpaste.dzfl.pl/a61e721e http://dpaste.dzfl.pl/3652fcc4 length

Re: ref keys

2012-09-17 Thread Jonathan M Davis
On Monday, September 17, 2012 23:11:42 Namespace wrote: I thought that new A() could be implicit immutable. Thanks for reporting. I'm sure that there are places where the compiler theoretically could implicitly convert a class or struct instantiated with new to immutable (e.g. when it's use

Re: Error: WndProc - nothrow

2012-09-17 Thread Simon
On 16/09/2012 23:32, cal wrote: On Sunday, 16 September 2012 at 22:08:53 UTC, deed wrote: Exactly. I couldn't remember seeing this error before. I've only used the dsource Win32 bindings, because there is often stuff missing from the phobos ones:

lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Andrej Mitrovic
I need to iterate through two arrays and do some special comparisons, but the arrays are not guaranteed to have the same length. lockstep doesn't work with the longest policy, e.g.: int[] a = [1, 2]; int[] b = [1, 2, 3]; foreach (aa, bb; lockstep(a, b, StoppingPolicy.longest)) // throws { }

Re: Error: WndProc - nothrow

2012-09-17 Thread Andrej Mitrovic
On 9/17/12, Simon s.d.hamm...@gmail.com wrote: You MUST NOT allow a D exception to propagate out of the wndproc (or indeed any other Win32 callback function) as the Win32 calling code has no idea how to process it and you'll just get a crash. That's just complete and utter bullshit. A

Re: lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Ali Çehreli
On 09/17/2012 03:00 PM, Andrej Mitrovic wrote: I need to iterate through two arrays and do some special comparisons, but the arrays are not guaranteed to have the same length. lockstep doesn't work with the longest policy, e.g.: int[] a = [1, 2]; int[] b = [1, 2, 3]; foreach (aa, bb;

Re: lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Andrej Mitrovic
On 9/18/12, Ali Çehreli acehr...@yahoo.com wrote: I think you actually want .shortest, no? No I want to continue iterating as long as one of the ranges is still not empty. I'm not doing just comparisons, once there's only one range that's not empty I have to do some special checks on its

Re: lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Andrej Mitrovic
On 9/18/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: foreach (aa, bb; lockstep(arr1, arr2)) { if (aa == sentinel) { if (aa % 2 == 0) Gah I've messed up the simple example. If aa was a sentinel then it meant I wouldn't check it at all, I'd try to

Re: lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Andrej Mitrovic
On 9/18/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 9/18/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: foreach (aa, bb; lockstep(arr1, arr2)) { if (aa == sentinel) { if (aa % 2 == 0) Gah I've messed up the simple example. If aa was a

Re: lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Ali Çehreli
On 09/17/2012 03:51 PM, Andrej Mitrovic wrote: On 9/18/12, Ali Çehreliacehr...@yahoo.com wrote: I think you actually want .shortest, no? No I want to continue iterating as long as one of the ranges is still not empty. I'm not doing just comparisons, once there's only one range that's not

Re: lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Andrej Mitrovic
On 9/18/12, Ali Çehreli acehr...@yahoo.com wrote: Then .longest with zip seems to be the way to go. Ah ain't that cool. It looks like it works. What does it use for the sentinel, Type.init perhaps?

Re: lockstep alternative for StoppingPolicy.longest

2012-09-17 Thread Andrej Mitrovic
On 9/18/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 9/18/12, Ali Çehreli acehr...@yahoo.com wrote: Then .longest with zip seems to be the way to go. Ah ain't that cool. It looks like it works. What does it use for the sentinel, Type.init perhaps? Yep just tried with floats and

undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-17 Thread Ellery Newcomer
With a deimos header file, I expect to need only to pass the dpath to it and the library it references to dmd, e.g. stuff - deimos - python - Python.d dmd otherstuff -Istuff -L-lpython2.7 I should not need to actually pass stuff/deimos/python/Python.d to dmd. Unfortunately, that is

Re: Compiler should error when goto over initialization?

2012-09-17 Thread Jesse Phillips
On Sunday, 16 September 2012 at 18:33:22 UTC, Iain Buclaw wrote: On Sunday, 16 September 2012 at 18:20:49 UTC, Jesse Phillips wrote: I'm thinking I this is supposed to be a compiler error and I should report as a bug: It is illegal for a GotoStatement to be used to skip initializations.

Re: Can't install DMD 2.060 on OS X 10.6.8

2012-09-17 Thread Elias Zamaria
I reported it, along with the console details, on the bug tracker. You can see it at http://d.puremagic.com/issues/show_bug.cgi?id=8682. I think it is kind of strange that I need to install a 3rd party app just to be able to install the compiler, especially considering that no one else seems

Re: undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-17 Thread Ellery Newcomer
On 09/17/2012 04:16 PM, Ellery Newcomer wrote: With a deimos header file, I expect to need only to pass the dpath to it and the library it references to dmd, e.g. stuff - deimos - python - Python.d dmd otherstuff -Istuff -L-lpython2.7 I should not need to actually pass