Re: Get Dll functions at compile time

2017-08-08 Thread Johnson Jones via Digitalmars-d-learn
On Wednesday, 9 August 2017 at 02:11:13 UTC, Johnson Jones wrote: I like to create code that automates much of the manual labor that we, as programmers, are generally forced to do. D generally makes much of this work automatable. For example, I have created the following code which makes

Get Dll functions at compile time

2017-08-08 Thread Johnson Jones via Digitalmars-d-learn
I like to create code that automates much of the manual labor that we, as programmers, are generally forced to do. D generally makes much of this work automatable. For example, I have created the following code which makes loading dlls similar to libs: /* Import DLL functions in to type T.

Why does stringof not like functions with arguments?

2017-08-08 Thread Jason Brady via Digitalmars-d-learn
Why does the following code error out with: app.d(12,10): Error: function app.FunctionWithArguments (uint i) is not callable using argument types () Code: import std.stdio; void FunctionWithoutArguments() { } void FunctionWithArguments(uint i) { } void main() {

Re: gtkD window centering message up and no app on taskbar

2017-08-08 Thread Johnson Jones via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 21:37:40 UTC, Mike Wey wrote: On 07-08-17 23:52, Johnson Jones wrote: On Monday, 7 August 2017 at 20:57:08 UTC, Mike Wey wrote: On 07-08-17 22:46, Johnson Jones wrote: [...] This appears to be a GTK issue, a work around might be to get the Window handle from

Re: gtkD window centering message up and no app on taskbar

2017-08-08 Thread Mike Wey via Digitalmars-d-learn
On 07-08-17 23:52, Johnson Jones wrote: On Monday, 7 August 2017 at 20:57:08 UTC, Mike Wey wrote: On 07-08-17 22:46, Johnson Jones wrote: [...] This appears to be a GTK issue, a work around might be to get the Window handle from gtk and use the Windows API to set the taskbar visibility.

Re: Create class on stack

2017-08-08 Thread Johan Engelen via Digitalmars-d-learn
On Monday, 7 August 2017 at 13:40:18 UTC, Moritz Maxeiner wrote: Thanks, I wasn't aware of this. I tried fooling around scope classes and DIP1000 for a bit and was surprised that this is allowed: Thanks for the test case :-) It was fun to see that ASan can catch this bug too. Because

readText with added null-terminator that enables sentinel-based search

2017-08-08 Thread Nordlöw via Digitalmars-d-learn
Has anybody written a wrapper around `std.file.readText` (or similar) that appends a final zero-byte terminator in order to realize sentinel-based search in textual parsers.

Thread sequencer

2017-08-08 Thread Johnson Jones via Digitalmars-d-learn
I'm wondering if there is an easy way to create a single extra thread that one can pass delegates(code) to and it executes it properly. The thread never closes except at shutdown. The idea is that isn't of creating one thread per task, there is one thread that executes each task. Obviously

Re: Express "Class argument may not be null" ?

2017-08-08 Thread Adam D. Ruppe via Digitalmars-d-learn
I was about to say "use NotNull" but there still isn't one in std.typecons. ugh. But it is just a wrapper type that checks null in the contracts too, so you can do it at the function itself.

Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread Joakim via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 10:07:54 UTC, data pulverizer wrote: On Tuesday, 8 August 2017 at 09:51:40 UTC, Moritz Maxeiner wrote: If your code depends on capabilities of a specific D compiler, I wouldn't depend on build tools for that, I'd make it clear in the source code via conditional

Re: Express "Class argument may not be null" ?

2017-08-08 Thread Andre Kostur via Digitalmars-d-learn
On 2017-08-08 12:38 PM, Steven Schveighoffer wrote: On 8/8/17 2:56 PM, ag0aep6g wrote: On 08/08/2017 08:34 PM, Johan Engelen wrote: How would you express the function interface intent that a reference to a class may not be null? For a function "void foo(Klass)", calling "foo(null)" is

Re: Express "Class argument may not be null" ?

2017-08-08 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 19:38:19 UTC, Steven Schveighoffer wrote: Note that C++ also can do this, so I'm not sure the & is accomplishing the correct goal: void foo(Klass&); int main() { Klass *k = NULL; foo(*k); } In C++, it is clear that the _caller_ is doing the

Re: Express "Class argument may not be null" ?

2017-08-08 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 18:57:48 UTC, Steven Schveighoffer wrote: On 8/8/17 2:34 PM, Johan Engelen wrote: Hi all, How would you express the function interface intent that a reference to a class may not be null? For a function "void foo(Klass)", calling "foo(null)" is valid. How do I

Re: Efficiently streaming data to associative array

2017-08-08 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 16:00:17 UTC, Steven Schveighoffer wrote: I wouldn't use formattedRead, as I think this is going to allocate temporaries for a and b. What would you suggest to use in its stead? My use-case is similar to the OP's in that I have a string of tokens that I want

Re: Express "Class argument may not be null" ?

2017-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/8/17 2:56 PM, ag0aep6g wrote: On 08/08/2017 08:34 PM, Johan Engelen wrote: How would you express the function interface intent that a reference to a class may not be null? For a function "void foo(Klass)", calling "foo(null)" is valid. How do I express that that is invalid? (let's

Re: Express "Class argument may not be null" ?

2017-08-08 Thread ag0aep6g via Digitalmars-d-learn
On 08/08/2017 08:34 PM, Johan Engelen wrote: How would you express the function interface intent that a reference to a class may not be null? For a function "void foo(Klass)", calling "foo(null)" is valid. How do I express that that is invalid? (let's leave erroring with a compile error

Re: Express "Class argument may not be null" ?

2017-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/8/17 2:34 PM, Johan Engelen wrote: Hi all, How would you express the function interface intent that a reference to a class may not be null? For a function "void foo(Klass)", calling "foo(null)" is valid. How do I express that that is invalid? (let's leave erroring with a compile error

Express "Class argument may not be null" ?

2017-08-08 Thread Johan Engelen via Digitalmars-d-learn
Hi all, How would you express the function interface intent that a reference to a class may not be null? For a function "void foo(Klass)", calling "foo(null)" is valid. How do I express that that is invalid? (let's leave erroring with a compile error aside for now) Something equivalent to

Re: Efficiently streaming data to associative array

2017-08-08 Thread Guillaume Chatelet via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 16:00:17 UTC, Steven Schveighoffer wrote: On 8/8/17 11:28 AM, Guillaume Chatelet wrote: Let's say I'm processing MB of data, I'm lazily iterating over the incoming lines storing data in an associative array. I don't want to copy unless I have to. Contrived

Re: Efficiently streaming data to associative array

2017-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/8/17 11:28 AM, Guillaume Chatelet wrote: Let's say I'm processing MB of data, I'm lazily iterating over the incoming lines storing data in an associative array. I don't want to copy unless I have to. Contrived example follows: input file -- a,b,15 c,d,12 Efficient

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/8/17 10:52 AM, Suliman wrote: your examples generate me: DLANG.ru (c) DLANG 2017 That's the template without the block. The only one modification that I did I changes pages names:

Efficiently streaming data to associative array

2017-08-08 Thread Guillaume Chatelet via Digitalmars-d-learn
Let's say I'm processing MB of data, I'm lazily iterating over the incoming lines storing data in an associative array. I don't want to copy unless I have to. Contrived example follows: input file -- a,b,15 c,d,12 ... Efficient ingestion --- void main() {

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
your examples generate me: DLANG.ru (c) DLANG 2017 The only one modification that I did I changes pages names: extends home

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
Am I right understand that I can extend only one template?

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/8/17 9:19 AM, Suliman wrote: Still can't get it work. include header ..MainContainer ..Header .HeaderMenu .HeaderBlock a(href="/") General .HeaderBlock a(href="/FAQ") FAQ .HeaderBlock a(href="/book") Book .HeaderLoginBlock Sign in ..Middle f

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 13:22:58 UTC, Steven Schveighoffer wrote: On 8/8/17 9:10 AM, Suliman wrote: Yes, thanks what: extends layout mean? It means that your final file will be layout.dt, but with the block statements replaced with the contents defined by the specific view file.

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/8/17 9:10 AM, Suliman wrote: Yes, thanks what: extends layout mean? It means that your final file will be layout.dt, but with the block statements replaced with the contents defined by the specific view file. Think of it like an interface, where the "blocks" are function prototypes,

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
Still can't get it work. include header .MainContainer .Header .HeaderMenu .HeaderBlock a(href="/") General .HeaderBlock a(href="/FAQ") FAQ .HeaderBlock a(href="/book") Book .HeaderLoginBlock Sign in .Middle f include footer it's template is compilable,

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
Yes, thanks what: extends layout mean?

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/8/17 8:38 AM, Suliman wrote: On Tuesday, 8 August 2017 at 11:59:38 UTC, Suliman wrote: On Tuesday, 8 August 2017 at 11:55:09 UTC, Suliman wrote: For example I am making simple site with header and footer. header and footer will be same for all pages. I do not want to do copy-paste it in

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 11:59:38 UTC, Suliman wrote: On Tuesday, 8 August 2017 at 11:55:09 UTC, Suliman wrote: For example I am making simple site with header and footer. header and footer will be same for all pages. I do not want to do copy-paste it in every page. I want write it's once

Re: Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 11:55:09 UTC, Suliman wrote: For example I am making simple site with header and footer. header and footer will be same for all pages. I do not want to do copy-paste it in every page. I want write it's once and than simpy import in every page. Is it's possible to

Is it's possible to make modular pug template in vibed?

2017-08-08 Thread Suliman via Digitalmars-d-learn
For example I am making simple site with header and footer. header and footer will be same for all pages. I do not want to do copy-paste it in every page. I want write it's once and than simpy import in every page. Is it's possible to do with vibed?

Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread data pulverizer via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 09:51:40 UTC, Moritz Maxeiner wrote: If your code depends on capabilities of a specific D compiler, I wouldn't depend on build tools for that, I'd make it clear in the source code via conditional compilation [1]: --- version (DigitalMars) { } else version (LDC) {

Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread Moritz Maxeiner via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 09:31:49 UTC, data pulverizer wrote: On Tuesday, 8 August 2017 at 09:21:54 UTC, Moritz Maxeiner wrote: On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote: Hi, I would like to know how to specify dmd or ldc compiler and version in a json dub file.

Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread data pulverizer via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 09:21:54 UTC, Moritz Maxeiner wrote: On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote: Hi, I would like to know how to specify dmd or ldc compiler and version in a json dub file. Thanks in advance. You can't [1]. You can specify the compiler to

Re: Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread Moritz Maxeiner via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 09:17:02 UTC, data pulverizer wrote: Hi, I would like to know how to specify dmd or ldc compiler and version in a json dub file. Thanks in advance. You can't [1]. You can specify the compiler to use only on the dub command line via `--compiler=`. [1]

Specify dmd or ldc compiler and version in a json dub file?

2017-08-08 Thread data pulverizer via Digitalmars-d-learn
Hi, I would like to know how to specify dmd or ldc compiler and version in a json dub file. Thanks in advance.

Re: Create class on stack

2017-08-08 Thread Moritz Maxeiner via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 05:37:41 UTC, ANtlord wrote: On Sunday, 6 August 2017 at 15:47:43 UTC, Moritz Maxeiner wrote: If you use this option, do be aware that this feature has been > scheduled for future deprecation [1]. It's likely going to continue working for quite a while (years),

Re: Constructor is not callable using argument types

2017-08-08 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 06:03:06 UTC, Nrgyzer wrote: Hi guys, I've the following code: abstract class a {} class b : a { this(a* myAttr = null) {} } class c : a { this(a* myAttr = null) {} } void main() { auto myb = new b(); auto myc = new c(); } DMD says "Constructor c.this(a*

Constructor is not callable using argument types

2017-08-08 Thread Nrgyzer via Digitalmars-d-learn
Hi guys, I've the following code: abstract class a {} class b : a { this(a* myAttr = null) {} } class c : a { this(a* myAttr = null) {} } void main() { auto myb = new b(); auto myc = new c(); } DMD says "Constructor c.this(a* myAttr = null) is not callable using argument types (b*)".

Re: x64 build time 3x slower?

2017-08-08 Thread Johnson Jones via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 00:01:05 UTC, Johnson Jones wrote: On Monday, 7 August 2017 at 22:56:37 UTC, Moritz Maxeiner wrote: On Monday, 7 August 2017 at 22:19:57 UTC, Johnson Jones wrote: Why would that be. Program take about 4 seconds to compile and 12 for x64. There is fundamentally no

Re: rename file, execute os, etc at compile time

2017-08-08 Thread Johnson Jones via Digitalmars-d-learn
On Monday, 7 August 2017 at 12:39:31 UTC, lobo wrote: On Monday, 7 August 2017 at 00:07:26 UTC, Johnson Jones wrote: On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote: On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote: [...] It is deliberately not possible.