Re: What's up with GDC?

2016-06-14 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 13 June 2016 at 20:21:28 UTC, Joerg Joergonson wrote: Are you running some other program that might be sending a lot of broadcast messages? Not that I know of. I haven't tried running it outside VS though so it might be doing something weird. I'll investigate further when I get

short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread Nick B via Digitalmars-d-learn
Hi, Can anyone assist me with the short D programme. It is taken straight from "Programming in D" by Ali Cehreli. The code below is the solution, on page 684. The Exercise is on Page 27, item 2 half way down the page. The problem is that the program crashes, when it runs. The only thing

Re: How to call one static method from another?

2016-06-14 Thread pineapple via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 07:35:36 UTC, Andrea Fontana wrote: Simply: method2(); Also, typeof(this).method2();

Re: How to call one static method from another?

2016-06-14 Thread Konstantin Kutsevalov via Digitalmars-d-learn
May be my question was not enought clean... this is example of code: ``` class ClassName { public static void function method1() { // do something // and now I need to call other static method ClassName.method2(); // What I can use insted of full class name?

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread cym13 via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 09:39:05 UTC, Nick B wrote: On Tuesday, 14 June 2016 at 09:28:18 UTC, cym13 wrote: On Tuesday, 14 June 2016 at 09:17:35 UTC, Nick B wrote: Hi, Can anyone assist me with the short D programme. It is taken straight from "Programming in D" by Ali Cehreli. The code

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread cym13 via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 09:17:35 UTC, Nick B wrote: Hi, Can anyone assist me with the short D programme. It is taken straight from "Programming in D" by Ali Cehreli. The code below is the solution, on page 684. The Exercise is on Page 27, item 2 half way down the page. [...]

Re: Parse File at compile time, but not embedded

2016-06-14 Thread cym13 via Digitalmars-d-learn
On Tuesday, 7 June 2016 at 04:17:05 UTC, Pie? wrote: Ok, I will assume it will be able to be removed for release. It is an easy check(just search if binary contains file info). I'm sure an easy fix could be to write 0's over the data in the binary if necessary. Binaries aren't magical

Re: Accessing COM Objects

2016-06-14 Thread Kagamin via Digitalmars-d-learn
Visual D has a tool to convert IDL files to D.

Re: How to call one static method from another?

2016-06-14 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 07:20:47 UTC, Konstantin Kutsevalov wrote: May be my question was not enought clean... this is example of code: ``` class ClassName { public static void function method1() { // do something // and now I need to call other static method

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread Nick B via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 09:28:18 UTC, cym13 wrote: On Tuesday, 14 June 2016 at 09:17:35 UTC, Nick B wrote: Hi, Can anyone assist me with the short D programme. It is taken straight from "Programming in D" by Ali Cehreli. The code below is the solution, on page 684. The Exercise is on

Re: How to call one static method from another?

2016-06-14 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 07:35:36 UTC, Andrea Fontana wrote: On Tuesday, 14 June 2016 at 07:20:47 UTC, Konstantin Kutsevalov wrote: May be my question was not enought clean... this is example of code: ``` class ClassName { public static void function method1() { // do

Re: how to get rid of "cannot deduce function from argument types" elegantly

2016-06-14 Thread pineapple via Digitalmars-d-learn
On Monday, 13 June 2016 at 22:54:13 UTC, Ali Çehreli wrote: Tree!T tree(TL, T, TR)(TL left, T node, TR right) { return new Tree!T(left, node, right); } There's also this: Tree!T tree(TL, T, TR)(TL left, T node, TR right) if( (is(TL == Tree!T) || is(TL == typeof(null))) &&

Re: Accessing COM Objects

2016-06-14 Thread John via Digitalmars-d-learn
On Monday, 13 June 2016 at 19:26:08 UTC, Incognito wrote: On Monday, 13 June 2016 at 19:11:59 UTC, John wrote: On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote: Cool. Oleview gives me the idl files. How to convert the idl files to d or possibly c? Would I just use them in place of

Re: nested inout return type

2016-06-14 Thread Simon Bürger via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 01:50:17 UTC, Era Scarecrow wrote: On Monday, 13 June 2016 at 23:51:40 UTC, Era Scarecrow wrote: inout(Slice) opSlice(size_t a, size_t b) inout { return cast(inout(Slice)) Slice(ptr+a, b-a); } Seems the pointer has to be force-cast back to

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread Nick B via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 09:53:03 UTC, cym13 wrote: On Tuesday, 14 June 2016 at 09:39:05 UTC, Nick B wrote: On Tuesday, 14 June 2016 at 09:28:18 UTC, cym13 wrote: On Tuesday, 14 June 2016 at 09:17:35 UTC, Nick B wrote: Hi, Can anyone assist me with the short D programme. It is taken

Re: Are __gshared globals gc scanned?

2016-06-14 Thread ketmar via Digitalmars-d-learn
cat $subj | sed -r 's/^Are (.+) (gc.+)\?$/\1 are \2./'

Re: Are __gshared globals gc scanned?

2016-06-14 Thread Tofu Ninja via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 13:53:10 UTC, ketmar wrote: __gshared globals are gc scanned. Ah cool, thanks I had to login to my work computer just to read your answer lol

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 7:52 AM, Nick B wrote: On Tuesday, 14 June 2016 at 09:53:03 UTC, cym13 wrote: On Tuesday, 14 June 2016 at 09:39:05 UTC, Nick B wrote: On Tuesday, 14 June 2016 at 09:28:18 UTC, cym13 wrote: On Tuesday, 14 June 2016 at 09:17:35 UTC, Nick B wrote: Hi, Can anyone assist me with the

Re: Are __gshared globals gc scanned?

2016-06-14 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 14, 2016 at 02:04:15PM +, Tofu Ninja via Digitalmars-d-learn wrote: > On Tuesday, 14 June 2016 at 13:53:10 UTC, ketmar wrote: > > __gshared globals are gc scanned. > > Ah cool, thanks > I had to login to my work computer just to read your answer lol What, you mean you can't just

Re: how to get rid of "cannot deduce function from argument types" elegantly

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 6:05 AM, pineapple wrote: On Monday, 13 June 2016 at 22:54:13 UTC, Ali Çehreli wrote: Tree!T tree(TL, T, TR)(TL left, T node, TR right) { return new Tree!T(left, node, right); } There's also this: Tree!T tree(TL, T, TR)(TL left, T node, TR right) if( (is(TL ==

Re: How to call one static method from another?

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 6:08 AM, pineapple wrote: On Tuesday, 14 June 2016 at 07:35:36 UTC, Andrea Fontana wrote: Simply: method2(); Also, typeof(this).method2(); Yes, if you want to distinguish between another function named method2. -Steve

Re: GTKD - Attach Button to Grid in specific column and row

2016-06-14 Thread TheDGuy via Digitalmars-d-learn
On Saturday, 11 June 2016 at 21:14:43 UTC, Mike Wey wrote: The way GTK manages width and height, usually widgets are given the minimum size they need. So when the button is the only widget in the grid the other rows and columns have a height/width of 0. You can force the button / gird cell

Re: Are __gshared globals gc scanned?

2016-06-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 13:53:10 UTC, ketmar wrote: cat $subj | sed -r 's/^Are (.+) (gc.+)\?$/\1 are \2./' lol nice answer so yeah they are scanned for pointers just like anything else (meaning if they contain no pointers they are not scanned!) but remember globals never go out of

Re: nested inout return type

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 9:22 AM, Simon Bürger wrote: On Tuesday, 14 June 2016 at 01:50:17 UTC, Era Scarecrow wrote: On Monday, 13 June 2016 at 23:51:40 UTC, Era Scarecrow wrote: inout(Slice) opSlice(size_t a, size_t b) inout { return cast(inout(Slice)) Slice(ptr+a, b-a); } Seems

Are __gshared globals gc scanned?

2016-06-14 Thread Tofu Ninja via Digitalmars-d-learn
Title says it all...

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 11:44 AM, Ali Çehreli wrote: On 06/14/2016 04:52 AM, Nick B wrote: Thanks for the assistance. I assumed that the compiler would at least throw a line number, to hint at where the problem was. Further, when the format string is a literal like the one used in the program, the

Re: Strange Issues regarding aliases

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 11:29 AM, Joerg Joergonson wrote: I have stuff like public static class fGL { nothrow @nogc extern(System) { alias CullFace = void function(tGL.Enum); alias FrontFace = void function(tGL.Enum); alias HInt = void function(tGL.Enum, tGL.Enum);

Re: nested inout return type

2016-06-14 Thread Simon Bürger via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 14:47:11 UTC, Steven Schveighoffer wrote: * only do one mutable version of opSlice * add implicit cast (using "alias this") for const(Slice!T) -> Slice!(const(T)). Interesting, but unfortunately, the compiler isn't eager about this conversion. auto x = s[5 .. 7]

Strange Issues regarding aliases

2016-06-14 Thread Joerg Joergonson via Digitalmars-d-learn
I have stuff like public static class fGL { nothrow @nogc extern(System) { alias CullFace = void function(tGL.Enum); alias FrontFace = void function(tGL.Enum); alias HInt = void function(tGL.Enum, tGL.Enum); alias

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread Ali Çehreli via Digitalmars-d-learn
On 06/14/2016 04:52 AM, Nick B wrote: > Thanks for the assistance. I assumed that the compiler would at least > throw a line number, to hint at where the problem was. Further, when the format string is a literal like the one used in the program, the compiler can in theory determine at compile

Re: Strange Issues regarding aliases

2016-06-14 Thread Joerg Joergonson via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 16:08:03 UTC, Steven Schveighoffer wrote: On 6/14/16 11:29 AM, Joerg Joergonson wrote: [...] Your aliases are a bunch of function pointer types. This isn't what you likely want. I'm assuming you want to bring the existing functions into more

Re: GTKD - Attach Button to Grid in specific column and row

2016-06-14 Thread Mike Wey via Digitalmars-d-learn
On 06/14/2016 04:54 PM, TheDGuy wrote: On Saturday, 11 June 2016 at 21:14:43 UTC, Mike Wey wrote: The way GTK manages width and height, usually widgets are given the minimum size they need. So when the button is the only widget in the grid the other rows and columns have a height/width of 0.

Re: short programme from "Programming in D" by Ali Cehreli.

2016-06-14 Thread Ali Çehreli via Digitalmars-d-learn
On 06/14/2016 09:09 AM, Steven Schveighoffer wrote: >> readf (" %s, "); >> // "No argument for %s" >> >> This is a desired feature but dmd does not have this yet. Since dmd >> provides the front end to gdc and ldc, they don't have this feature >> either. > > Hm... shouldn't it at least

Re: Strange Issues regarding aliases

2016-06-14 Thread Joerg Joergonson via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 17:34:42 UTC, Joerg Joergonson wrote: This is how derelict does it, I simply moved them in to the class for simplicity. I mean glad: http://glad.dav1d.de/ It seems that a loader is required for some reason and that possibly could be one or both of the problems.

Re: Strange Issues regarding aliases

2016-06-14 Thread Joerg Joergonson via Digitalmars-d-learn
This is how derelict does it, I simply moved them in to the class for simplicity. I mean glad: http://glad.dav1d.de/

Re: Strange Issues regarding aliases

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 1:37 PM, Joerg Joergonson wrote: On Tuesday, 14 June 2016 at 17:34:42 UTC, Joerg Joergonson wrote: This is how derelict does it, I simply moved them in to the class for simplicity. I mean glad: http://glad.dav1d.de/ It seems that a loader is required for some reason and that

How to call one static method from another?

2016-06-14 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Hi, Just can't found information about "this" for static methods. Can anyone explain how to call current class from static methods? For example I have some class and I need to call some static method of current class from another static method. I don't like to use full class name for that,

Re: nested inout return type

2016-06-14 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 19:48:06 UTC, Steven Schveighoffer wrote: I honestly think the best place to go figure these things out is stackoverflow (or just the internet in general). Whenever I have a technical problem I can't figure out (or am too lazy to diagnose myself), I search and SO

Re: nested inout return type

2016-06-14 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 14:47:11 UTC, Steven Schveighoffer wrote: On Tuesday, 14 June 2016 at 01:50:17 UTC, Era Scarecrow wrote: return cast(inout(Slice)) Slice(cast(T*)ptr+a, b-a); Better: inout(Slice)(ptr+a, b-a); Of course... My amateur D-fu skills show themselves. cast()

Re: nested inout return type

2016-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/14/16 3:38 PM, Era Scarecrow wrote: On Tuesday, 14 June 2016 at 14:47:11 UTC, Steven Schveighoffer wrote: On Tuesday, 14 June 2016 at 01:50:17 UTC, Era Scarecrow wrote: return cast(inout(Slice)) Slice(cast(T*)ptr+a, b-a); Better: inout(Slice)(ptr+a, b-a); Of course... My amateur

Re: Strange Issues regarding aliases

2016-06-14 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 14 June 2016 at 17:37:40 UTC, Joerg Joergonson wrote: On Tuesday, 14 June 2016 at 17:34:42 UTC, Joerg Joergonson wrote: This is how derelict does it, I simply moved them in to the class for simplicity. I mean glad: http://glad.dav1d.de/ It seems that a loader is required for

Re: ndslice: convert a sliced object to T[]

2016-06-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 03:11:23 UTC, data pulverizer wrote: in that case: import std.array : array; int[] x = slice.byElement.array; Are you sure you want to create a _copy_ of your data? In most cases you don't need that ;-) thanks, now I can go to bed! You are welcome. Sleep

Re: ndslice: convert a sliced object to T[]

2016-06-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 02:43:37 UTC, data pulverizer wrote: How do I unravel a sliced item T[].sliced(...) to an array T[]? For instance: import std.experimental.ndslice; auto slice = new int[12].sliced(3, 4); int[] x = ??; Thanks A slice is just a _view_ on your memory, the easiest

Re: ndslice: convert a sliced object to T[]

2016-06-14 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 02:50:30 UTC, Seb wrote: On Wednesday, 15 June 2016 at 02:43:37 UTC, data pulverizer wrote: How do I unravel a sliced item T[].sliced(...) to an array T[]? For instance: import std.experimental.ndslice; auto slice = new int[12].sliced(3, 4); int[] x = ??; Thanks

ndslice: convert a sliced object to T[]

2016-06-14 Thread data pulverizer via Digitalmars-d-learn
How do I unravel a sliced item T[].sliced(...) to an array T[]? For instance: import std.experimental.ndslice; auto slice = new int[12].sliced(3, 4); int[] x = ??; Thanks