Error: variable 'xyz' has scoped destruction, cannot build closure

2018-10-04 Thread Jon Degenhardt via Digitalmars-d-learn
I got the compilation error in the subject line when trying to create a range via std.range.generate. Turns out this was caused by trying to create a closure for 'generate' where the closure was accessing a struct containing a destructor. The fix was easy enough: write out the loop by hand

Re: What does -vtls compiler flag does and ...

2018-10-04 Thread Seb via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 20:58:01 UTC, Stanislav Blinov wrote: On Wednesday, 3 October 2018 at 20:41:15 UTC, welkam wrote: I was playing around with dmd`s make file trying to see if I can compile dmd with different compilers and different compilation flags. By playing around I found

Re: What does -vtls compiler flag does and ...

2018-10-04 Thread bauss via Digitalmars-d-learn
On Thursday, 4 October 2018 at 13:48:24 UTC, welkam wrote: Oh so its like thread local globals sort of. My reasoning was that stack is a form of storage and is thread local so... Thread local storage IS "global" per thread though, instead of per process which "global" is in other languages.

Re: What does -vtls compiler flag does and ...

2018-10-04 Thread welkam via Digitalmars-d-learn
On Wednesday, 3 October 2018 at 21:50:49 UTC, Stanislav Blinov wrote: Thread-local storage is memory allocated for each thread. Only static non-immutable variables go there. Regular variables on the stack aren't explicitly placed in any TLS, they're, well, on the stack as it is. Oh so its

Re: std.socket tutorials? examples?

2018-10-04 Thread bauss via Digitalmars-d-learn
On Thursday, 4 October 2018 at 13:09:17 UTC, bauss wrote: On Thursday, 4 October 2018 at 13:07:30 UTC, bauss wrote: buffer = buffer[0 .. $]; // Slice the buffer to the actual size of the received data. ``` Typo... Was supposed to be "received" and not "$"... buffer = buffer[0 ..

Re: std.socket tutorials? examples?

2018-10-04 Thread bauss via Digitalmars-d-learn
On Thursday, 4 October 2018 at 09:54:40 UTC, Chris Katko wrote: On Thursday, 4 October 2018 at 08:52:28 UTC, Andrea Fontana wrote: On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket

Re: std.socket tutorials? examples?

2018-10-04 Thread bauss via Digitalmars-d-learn
On Thursday, 4 October 2018 at 13:07:30 UTC, bauss wrote: buffer = buffer[0 .. $]; // Slice the buffer to the actual size of the received data. ``` Typo... Was supposed to be "received" and not "$"... buffer = buffer[0 .. received]; // Slice the buffer to the actual size

Re: std.socket tutorials? examples?

2018-10-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. My book has a few examples https://www.packtpub.com/application-development/d-cookbook of course, buying it for just std.socket (which is just like one page out of the

Re: Compile time sequences

2018-10-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 4, 2018 5:44:55 AM MDT drug via Digitalmars-d-learn wrote: > I was incorrect with description of the problem. The problem is that > there is no simple way to distinct types and symbols if symbols are > private. Because private symbol is not accessible you can not get any >

Re: Compile time sequences

2018-10-04 Thread drug via Digitalmars-d-learn
04.10.2018 14:44, drug пишет: I was incorrect with description of the problem. The problem is that there is no simple way to distinct types and symbols if symbols are private. Because private symbol is not accessible you can not get any info on it, including is it type or symbol or value. And

Re: Compile time sequences

2018-10-04 Thread drug via Digitalmars-d-learn
I was incorrect with description of the problem. The problem is that there is no simple way to distinct types and symbols if symbols are private. Because private symbol is not accessible you can not get any info on it, including is it type or symbol or value. And you can not get protection for

Re: std.socket tutorials? examples?

2018-10-04 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:52:28 UTC, Andrea Fontana wrote: On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket dlang examples"... is for TANGO. That's how old it is. Socket

Re: Private struct constructor

2018-10-04 Thread Ritchie via Digitalmars-d-learn
On Thursday, 4 October 2018 at 09:21:39 UTC, Simen Kjærås wrote: This is apparently a known issue: https://issues.dlang.org/show_bug.cgi?id=18979 which is basically just a special case of this issue: https://issues.dlang.org/show_bug.cgi?id=2775 -- Simen I see. Looks like the chances of

Re: Private struct constructor

2018-10-04 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:52:50 UTC, Ritchie wrote: I apologize for not making it clear. I was talking about the private constructor only. The @disable this() is there to prevent struct literal syntax and the other disables really have no reason to be there for the purpose of this

Re: std.socket tutorials? examples?

2018-10-04 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote: I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket dlang examples"... is for TANGO. That's how old it is. Socket paradigm is quite standard across languages. Anyway you can find a

Re: Private struct constructor

2018-10-04 Thread Ritchie via Digitalmars-d-learn
On Thursday, 4 October 2018 at 08:14:44 UTC, Simen Kjærås wrote: On Thursday, 4 October 2018 at 07:31:21 UTC, Ritchie wrote: Any reason why this works? https://run.dlang.io/is/TALlyw Yup. Alright, so there's a few features in use here - which one are you asking about? 1. Private

std.socket tutorials? examples?

2018-10-04 Thread Chris Katko via Digitalmars-d-learn
I've been Google'ing and there's like... nothing out there. One of the top results for "std.socket dlang examples"... is for TANGO. That's how old it is.

Re: Private struct constructor

2018-10-04 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 4 October 2018 at 07:31:21 UTC, Ritchie wrote: Any reason why this works? https://run.dlang.io/is/TALlyw Yup. Alright, so there's a few features in use here - which one are you asking about? 1. Private constructor. You can call the private constructor because the unit of

Re: Private struct constructor

2018-10-04 Thread Ritchie via Digitalmars-d-learn
On Thursday, 4 October 2018 at 07:55:48 UTC, Andrea Fontana wrote: On Thursday, 4 October 2018 at 07:31:21 UTC, Ritchie wrote: Any reason why this works? https://run.dlang.io/is/TALlyw Why not? The constructor is private.

Re: Private struct constructor

2018-10-04 Thread John Chapman via Digitalmars-d-learn
On Thursday, 4 October 2018 at 07:31:21 UTC, Ritchie wrote: Any reason why this works? https://run.dlang.io/is/TALlyw "private" applies to the module, not the type. https://dlang.org/spec/attribute.html#visibility_attributes

Re: Private struct constructor

2018-10-04 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 4 October 2018 at 07:31:21 UTC, Ritchie wrote: Any reason why this works? https://run.dlang.io/is/TALlyw Why not?

Private struct constructor

2018-10-04 Thread Ritchie via Digitalmars-d-learn
Any reason why this works? https://run.dlang.io/is/TALlyw