Specify rhs at initialisation or assignment of typedef' d variable

2017-07-31 Thread Cecil Ward via Digitalmars-d-learn
Say I have used Typedef! to create some new type and I declare a variable, constant or enum of that type. Is there a way that I can express a literal value on the rhs without having to use casts, as that seems to defeat the point of the nice type safety? I may be asking for the impossible or _

Re: Specify rhs at initialisation or assignment of typedef' d variable

2017-07-31 Thread inevzxui via Digitalmars-d-learn
On Monday, 31 July 2017 at 07:16:25 UTC, Cecil Ward wrote: Say I have used Typedef! to create some new type and I declare a variable, constant or enum of that type. Is there a way that I can express a literal value on the rhs without having to use casts, as that seems to defeat the point of the

Re: Specify rhs at initialisation or assignment of typedef' d variable

2017-07-31 Thread Cecil Ward via Digitalmars-d-learn
On Monday, 31 July 2017 at 07:50:57 UTC, inevzxui wrote: On Monday, 31 July 2017 at 07:16:25 UTC, Cecil Ward wrote: Say I have used Typedef! to create some new type and I declare a variable, constant or enum of that type. Is there a way that I can express a literal value on the rhs without havi

Re: Specify rhs at initialisation or assignment of typedef' d variable

2017-07-31 Thread Cecil Ward via Digitalmars-d-learn
On Monday, 31 July 2017 at 08:53:10 UTC, Cecil Ward wrote: On Monday, 31 July 2017 at 07:50:57 UTC, inevzxui wrote: [...] I suspect that I am asking for something that literally makes no sense at all. I wanted to try and avoid opening the door to allowing the following kind of typing error n

Taking the address of an eponymous template

2017-07-31 Thread Arafel via Digitalmars-d-learn
Hi! I want to create a delegate out of a method that happens to be an eponymous (nested) template, like this: ``` class C { void foo() {} void bar(string S)() { } template baz(string S) { void baz()() { } } } void main() {

Re: Taking the address of an eponymous template

2017-07-31 Thread ag0aep6g via Digitalmars-d-learn
On 07/31/2017 11:44 AM, Arafel wrote: ``` class C { [...] template baz(string S) { void baz()() { } } } void main() { [...] void delegate() aBaz = &c.baz!"a"; // This doesn't compile. } ``` If I try &c.baz!"a".baz it doesn't work either (I get a different er

Re: Specify rhs at initialisation or assignment of typedef' d variable

2017-07-31 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 31 July 2017 at 08:53:10 UTC, Cecil Ward wrote: [ ... ] I suspect that I am asking for something that literally makes no sense at all. I wanted to try and avoid opening the door to allowing the following kind of typing error now, eg enum ip_address = 0x11223344; [ ... ] Please

Re: Taking the address of an eponymous template

2017-07-31 Thread Arafel via Digitalmars-d-learn
On 07/31/2017 12:14 PM, ag0aep6g wrote: > > You'd have to instantiate the inner template, too. Something like > `&c.baz!"a".baz!()`, but that doesn't work. I don't know how you could > make it work. > I tried this as well, and couldn't make it work either. Do you know if it's supposed to work? I

Re: D Debug101

2017-07-31 Thread Kagamin via Digitalmars-d-learn
gdb wants dwarf debug info, windows uses codeview.

Re: Is std.xml seriously broken, or is it me?

2017-07-31 Thread Kagamin via Digitalmars-d-learn
On Sunday, 30 July 2017 at 03:16:35 UTC, Mike wrote: It appears `onStartTag` does not handle the root element. Looks like a bug. Until the module is replaced, bug reports are still accepted for it.

How to test tuple in chain

2017-07-31 Thread closescreen via Digitalmars-d-learn
Hello! If I want testing tuple member in functional manner, what I shoul do? Example: "ls -l".executeShell returns me tuple (int "status", string "output") I want write somthing like: "ls -l".executeShell.smthTestingOperation!"Error: bad status."( res => res.status==0 ).output.writeln;

Re: How to test tuple in chain

2017-07-31 Thread closescreen via Digitalmars-d-learn
I read my message. Sorry for my poor english and typos.

Re: It makes me sick!

2017-07-31 Thread Grander via Digitalmars-d-learn
On Saturday, 29 July 2017 at 21:52:38 UTC, FoxyBrown wrote: On Saturday, 29 July 2017 at 21:48:09 UTC, Timon Gehr wrote: On 28.07.2017 23:30, FoxyBrown wrote: because you didn't want to spend 10 minutes to fix a program. You need to realize that the same thing applies to you. There is no "u

Re: How to test tuple in chain

2017-07-31 Thread inevzxui via Digitalmars-d-learn
On Monday, 31 July 2017 at 12:23:02 UTC, closescreen wrote: I read my message. Sorry for my poor english and typos. use res[0] and res[1] to get res.status and the res.output.

Re: Taking the address of an eponymous template

2017-07-31 Thread ag0aep6g via Digitalmars-d-learn
On 07/31/2017 01:59 PM, Arafel wrote: On 07/31/2017 12:14 PM, ag0aep6g wrote: [...] > You'd have to instantiate the inner template, too. Something like > `&c.baz!"a".baz!()`, but that doesn't work. I don't know how you could > make it work. > I tried this as well, and couldn't make it work

Compile Time versus Run Time

2017-07-31 Thread Martin Tschierschke via Digitalmars-d-learn
As a rookie in D programming I try to understand the power of templated functions with compile time parameters. With DMD 2.074 a compile time format (auto output = format!("Print this %s")(var);) was introduced, now we all know that very many of this format strings are immutable, so wouldn't i

Re: Compile Time versus Run Time

2017-07-31 Thread inevzxui via Digitalmars-d-learn
On Monday, 31 July 2017 at 15:43:21 UTC, Martin Tschierschke wrote: As a rookie in D programming I try to understand the power of templated functions with compile time parameters. With DMD 2.074 a compile time format (auto output = format!("Print this %s")(var);) was introduced, now we all kno

Re: Compile Time versus Run Time

2017-07-31 Thread Anonymouse via Digitalmars-d-learn
On Monday, 31 July 2017 at 15:46:47 UTC, inevzxui wrote: On Monday, 31 July 2017 at 15:43:21 UTC, Martin Tschierschke wrote: As a rookie in D programming I try to understand the power of templated functions with compile time parameters. With DMD 2.074 a compile time format (auto output = forma

Re: Compile Time versus Run Time

2017-07-31 Thread ag0aep6g via Digitalmars-d-learn
On 07/31/2017 05:43 PM, Martin Tschierschke wrote: As a rookie in D programming I try to understand the power of templated functions with compile time parameters. With DMD 2.074 a compile time format (auto output = format!("Print this %s")(var);) was introduced, now we all know that very many

Re: Compile Time versus Run Time

2017-07-31 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 31 July 2017 at 15:57:28 UTC, Anonymouse wrote: On Monday, 31 July 2017 at 15:46:47 UTC, inevzxui wrote: On Monday, 31 July 2017 at 15:43:21 UTC, Martin Tschierschke wrote: [...] But the parameters are not checked at compile-time unless you specifically pass the pattern string as a

Re: Compile Time versus Run Time

2017-07-31 Thread Marco Leise via Digitalmars-d-learn
Am Mon, 31 Jul 2017 15:43:21 + schrieb Martin Tschierschke : > As a rookie in D programming I try to understand the power of > templated functions with compile time parameters. With DMD 2.074 > a compile time format > (auto output = format!("Print this %s")(var);) > > was introduced, now we

gtk arch issues

2017-07-31 Thread Johnson Jones via Digitalmars-d-learn
how does one allow both gtk x86 and x64 to work side by side seamlessly? I installed x64 first and it seems, because whatever is using the path to find the gtk runtime, it looks for that first even in x86 build. Seems like gtkd's dll resolution is not very intelligent. While I could manuall

Re: gtk arch issues

2017-07-31 Thread Johnson Jones via Digitalmars-d-learn
On Monday, 31 July 2017 at 17:16:32 UTC, Johnson Jones wrote: how does one allow both gtk x86 and x64 to work side by side seamlessly? I installed x64 first and it seems, because whatever is using the path to find the gtk runtime, it looks for that first even in x86 build. Seems like gtkd's

Re: gtk arch issues

2017-07-31 Thread Johnson Jones via Digitalmars-d-learn
On Monday, 31 July 2017 at 17:50:08 UTC, Johnson Jones wrote: On Monday, 31 July 2017 at 17:16:32 UTC, Johnson Jones wrote: [...] I fixed up gtkd so that it uses x86 and x64 versions of dlls but it doesn't seem to help with x64. I was able to get x86 to compile and run but x64 just loads the

Re: gtk arch issues

2017-07-31 Thread Mike Wey via Digitalmars-d-learn
On 31-07-17 19:16, Johnson Jones wrote: how does one allow both gtk x86 and x64 to work side by side seamlessly? I installed x64 first and it seems, because whatever is using the path to find the gtk runtime, it looks for that first even in x86 build. Seems like gtkd's dll resolution is not v

Re: gtk arch issues

2017-07-31 Thread Mike Wey via Digitalmars-d-learn
On 31-07-17 19:53, Johnson Jones wrote: Also, why is gtkD even using gtksharp? That's for mono and .net! We don't. only the (C) Gtk runtime is needed. Where did you see gtksharp? -- Mike Wey

Re: gtk arch issues

2017-07-31 Thread Johnson Jones via Digitalmars-d-learn
On Monday, 31 July 2017 at 20:37:11 UTC, Mike Wey wrote: On 31-07-17 19:16, Johnson Jones wrote: how does one allow both gtk x86 and x64 to work side by side seamlessly? I installed x64 first and it seems, because whatever is using the path to find the gtk runtime, it looks for that first eve

Adding deprecated to an enum member

2017-07-31 Thread Jeremy DeHaan via Digitalmars-d-learn
I got an error today because I added deprecated to an enum member. Is there a way to achieve this, or am I out of luck? If it isn't doable, should it be? Here's what I want: enum PrimitiveType { Points, Lines, LineStrip, Triangles, TriangleStrip, TriangleFan, Quads

Re: Adding deprecated to an enum member

2017-07-31 Thread dark777 via Digitalmars-d-learn
On Tuesday, 1 August 2017 at 01:12:28 UTC, Jeremy DeHaan wrote: I got an error today because I added deprecated to an enum member. Is there a way to achieve this, or am I out of luck? If it isn't doable, should it be? Here's what I want: enum PrimitiveType { Points, Lines, LineS

mixin template, extern(C/Windows) and mangled name

2017-07-31 Thread Domain via Digitalmars-d-learn
I known there is a bug with extern(C) in mixin template: https://issues.dlang.org/show_bug.cgi?id=12575 And I can see SimpleDllMain in core.sys.windows.dll, the mangled name is correct: DllMain But my mixin template has wrong mangled name: mixin template GetMetaData() { extern(Windows) Me

Re: mixin template, extern(C/Windows) and mangled name

2017-07-31 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 1 August 2017 at 03:08:30 UTC, Domain wrote: And I can see SimpleDllMain in core.sys.windows.dll, the mangled name is correct: DllMain main, DllMain, and WinMain are special cased... for yours, I think you'll have to hack it with pragma(mangle) mixin template GetMetaData() {

Re: mixin template, extern(C/Windows) and mangled name

2017-07-31 Thread Domain via Digitalmars-d-learn
On Tuesday, 1 August 2017 at 03:30:08 UTC, Adam D. Ruppe wrote: On Tuesday, 1 August 2017 at 03:08:30 UTC, Domain wrote: And I can see SimpleDllMain in core.sys.windows.dll, the mangled name is correct: DllMain main, DllMain, and WinMain are special cased... for yours, I think you'll have to

Bug in gtkd?

2017-07-31 Thread Johnson Jones via Digitalmars-d-learn
Trying a very simple interface. When I add a notebook I get the following error (test.exe:4504): Gtk-ERROR **: failed to add UI: C:\Test\Main.Glade:27:43 Invalid property: GtkNotebook.tab_hborder When removing it from the glade file it then crashes with on the homogenous property.