Re: Should the "front" range primitive be "const" ?

2018-01-31 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 01:45:57 UTC, H. S. Teoh wrote: I haven't thought through it carefully, but if .headConst is a viable solution to the head-const problem, then conceivably we could also extend it to deal with immutable payloads too. Then we could go from, say,

Re: Don't expect class destructors to be called at all by the GC

2018-01-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, January 31, 2018 10:51:10 DanielG via Digitalmars-d-learn wrote: > On Wednesday, 31 January 2018 at 10:34:53 UTC, Mike Parker wrote: > > delete is deprecated: > > > > https://dlang.org/deprecate.html#delete > > Ah, thanks! Actually double-thanks, because my progress through > your

Re: Should the "front" range primitive be "const" ?

2018-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/31/18 7:49 PM, Jonathan M Davis wrote: On Wednesday, January 31, 2018 11:58:38 Steven Schveighoffer via Digitalmars-d-learn wrote: On 1/30/18 8:05 PM, Jonathan M Davis wrote: Except that unless front returns by ref, it really doesn't matter whether front is const unless it's violating the

Re: enforce (i > 0) for i = int.min does not throw

2018-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/31/18 6:19 PM, Azi Hassan wrote: On Saturday, 27 January 2018 at 14:13:49 UTC, kdevel wrote: I would expect this code enforce3.d --- import std.exception; void main () {    int i = int.min;    enforce (i > 0); } --- to throw an "Enforcement failed" exception, but it doesn't: $ dmd

Re: Should the "front" range primitive be "const" ?

2018-01-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, January 31, 2018 11:58:38 Steven Schveighoffer via Digitalmars-d-learn wrote: > On 1/30/18 8:05 PM, Jonathan M Davis wrote: > > Except that unless front returns by ref, it really doesn't matter > > whether > > front is const unless it's violating the range API, since front is > >

Re: enforce (i > 0) for i = int.min does not throw

2018-01-31 Thread Azi Hassan via Digitalmars-d-learn
On Saturday, 27 January 2018 at 14:13:49 UTC, kdevel wrote: I would expect this code enforce3.d --- import std.exception; void main () { int i = int.min; enforce (i > 0); } --- to throw an "Enforcement failed" exception, but it doesn't: $ dmd enforce3.d $ ./enforce3 [nothing] I

Re: Terminating multiple processes

2018-01-31 Thread Arek via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 17:44:37 UTC, Russel Winder wrote: So, I have an application which has a sort of nano-services architecture, basically it is a set of communicating processes. Terminating those processes blocked on an input channel is quite easy, send a terminate message on the

Re: How to get a range from std.container.array for use with std.format.sformat?

2018-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/30/18 2:19 PM, cc wrote: Still doesn't work without the cast it seems.. auto rng = str[]; rng.sformat!"%s:%s"("some", "string"); // Error: template std.format.sformat cannot deduce function from argument types !("%s:%s")(RangeT!(Array!char), string, string) I

Re: Terminating multiple processes

2018-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/31/18 12:44 PM, Russel Winder wrote: So, I have an application which has a sort of nano-services architecture, basically it is a set of communicating processes. Terminating those processes blocked on an input channel is quite easy, send a terminate message on the input channel. But what

Terminating multiple processes

2018-01-31 Thread Russel Winder via Digitalmars-d-learn
So, I have an application which has a sort of nano-services architecture, basically it is a set of communicating processes. Terminating those processes blocked on an input channel is quite easy, send a terminate message on the input channel. But what about a process that has no input channel, one

Re: rdmd main.d leads to Segmentation fault

2018-01-31 Thread Timoses via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 08:40:26 UTC, Kagamin wrote: On Tuesday, 30 January 2018 at 16:56:28 UTC, Timoses wrote: Output: https://pastebin.com/raw/SSx0P1Av Helps? Looks like TLS is not initialized. And I would need to do what about it? Sorry, I'm not familiar with assembly code

Re: Should the "front" range primitive be "const" ?

2018-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/30/18 8:05 PM, Jonathan M Davis wrote: Except that unless front returns by ref, it really doesn't matter whether front is const unless it's violating the range API, since front is supposed to return the same value until popFront is called (or if it's assigned a new value via a front that

Re: enforce (i > 0) for i = int.min does not throw

2018-01-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/30/18 3:37 PM, kdevel wrote: On Sunday, 28 January 2018 at 19:17:49 UTC, Steven Schveighoffer wrote: This is insane. i > 0 is used in so many places. The only saving grace appears to be that int.min is just so uncommonly seen in the wild. And another one that it does not happen when

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread DanielG via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 12:25:36 UTC, John Chapman wrote: Just to say that it is actually possible to write modern Windows apps in D - I've done it. WinRT is just COM. Granted it's not as easy as using Microsoft's language projections, but it's doable if you really want to. The

what is local package map(local-packages.json) for dub while doing building?

2018-01-31 Thread Johann via Digitalmars-d-learn
$ dub build -b release -v Using dub registry url 'https://code.dlang.org/' Refreshing local packages (refresh existing: true)... Looking for local package map at /var/lib/dub/packages/local-packages.json Looking for local package map at /home/john/.dub/packages/local-packages.json Refreshing

Re: Don't expect class destructors to be called at all by the GC

2018-01-31 Thread Bienlein via Digitalmars-d-learn
On Thursday, 21 December 2017 at 18:45:27 UTC, Adam D. Ruppe wrote: On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote: When the scoped destruction of structs isn't an option, RefCounted!T seems to be a less evil alternative than an unreliable class dtor. :-/ Alas, RefCounted

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread Arredondo via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 18:52:18 UTC, I Lindström wrote: On Tuesday, 30 January 2018 at 12:30:36 UTC, rjframe wrote: VS release builds compile to native now by default; for easy Windows programming, you really can't beat C# and drawing the GUI (Windows Forms, not necessarily the new

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread John Chapman via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 11:52:20 UTC, rumbu wrote: On Windows platform, WPF is the way to go right now. Once you accommodate yourself with XAML (descriptive language for designing windows and controls), you can step up from WPF to modern Windows apps (UWP). Unfortunately, none of

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread rumbu via Digitalmars-d-learn
On Monday, 29 January 2018 at 22:55:12 UTC, I Lindström wrote: Hello all! I've been doing console apps for about a year and a half now, but my requirements are reaching the limits of easy to use with ASCII-based UI and typed commands so I'm thinking of moving into GUI-era with my projects. I

Re: Should the "front" range primitive be "const" ?

2018-01-31 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 31, 2018 at 07:08:58AM +, Simen Kjærås via Digitalmars-d-learn wrote: > On Wednesday, 31 January 2018 at 01:45:57 UTC, H. S. Teoh wrote: > > .headConst > > .headMutable. :p Head-const is something we generally want to avoid. [...] *facepalm* Yes, .headMutable, not .headConst.

Re: Don't expect class destructors to be called at all by the GC

2018-01-31 Thread DanielG via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 10:34:53 UTC, Mike Parker wrote: delete is deprecated: https://dlang.org/deprecate.html#delete Ah, thanks! Actually double-thanks, because my progress through your book is what prompted me to search for threads about class destructors. The existence of

Re: Don't expect class destructors to be called at all by the GC

2018-01-31 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 31 January 2018 at 10:14:53 UTC, DanielG wrote: Pardon my probable ignorance (D newbie and all), but why wouldn't a 'delete' work for this? https://dlang.org/spec/expression.html#delete_expressions delete is deprecated: https://dlang.org/deprecate.html#delete

Re: Don't expect class destructors to be called at all by the GC

2018-01-31 Thread DanielG via Digitalmars-d-learn
On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote: I ended up calling .destroy on the class instance explicitly just so the destructor would run at the right time, right before nulling the reference so that the GC would collect the memory. Pardon my probable ignorance (D newbie

Re: How to proceed with learning to code Windows desktop applications?

2018-01-31 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 18:52:18 UTC, I Lindström wrote: I've been looking into C# and VS2017 today along with VisualD. Reading through all this it looks like the simplest path is to learn C# and VS and go from there. I've found a pile of courses on LinkedIn that seem to build up to

Re: rdmd main.d leads to Segmentation fault

2018-01-31 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 30 January 2018 at 16:56:28 UTC, Timoses wrote: Output: https://pastebin.com/raw/SSx0P1Av Helps? Looks like TLS is not initialized.