Re: Deep nesting vs early returns

2018-10-04 Thread rikki cattermole via Digitalmars-d
On 05/10/2018 8:23 AM, Nick Sabalausky (Abscissa) wrote: I was in college during the height of the Java craze, so my instructors highly recommended the deep nesting approach. This was because return statements are control-flow, and control-flow isn't very object-orientedy, and is old-fasioned

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: Forums intermittently going down?

2018-10-04 Thread Vladimir Panteleev via Digitalmars-d
On Thursday, 4 October 2018 at 19:18:15 UTC, JN wrote: Seems like the issues with the forum got worse. It's hardly usable today, most of the time I am being greeted by "forums are being overloaded" message. Yeah, painfully aware. I've been trying a bunch of different things all day, and

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: Deep nesting vs early returns

2018-10-04 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 10/02/2018 02:14 PM, Andrei Alexandrescu wrote: Kate Gregory makes a good argument on something I've often commented in code reviews: https://youtu.be/n0Ak6xtVXno?t=2682 I was in college during the height of the Java craze, so my instructors highly recommended the deep nesting approach.

Re: Forums intermittently going down?

2018-10-04 Thread JN via Digitalmars-d
On Wednesday, 26 September 2018 at 02:33:27 UTC, Vladimir Panteleev wrote: fixed this by limiting the check to the first unread post instead of reusing a function to count all unread messages in the subscription queue: https://github.com/cybershadow/DFeed/commit/9cfcab2 Seems like the

Re: Warn on unused imports?

2018-10-04 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 09/26/2018 06:00 AM, Anonymouse wrote: On Tuesday, 25 September 2018 at 13:03:30 UTC, FeepingCreature wrote: I'm playing with a branch of DMD that would warn on unused imports: Would just like to say that I love the idea and would use it immediately. Same here. Periodically, my import

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: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread rjframe via Digitalmars-d
On Tue, 02 Oct 2018 14:49:31 +, bachmeier wrote: > I think this is something that could be done *in addition to* DConf. I > honestly don't think DConf is very effective at promoting D, except > perhaps to a small sliver of the overall population of programmers, due > to the content of most of

Re: LDC2 1.9.0 beta 1 bug

2018-10-04 Thread Steven Schveighoffer via Digitalmars-d
On 10/4/18 8:51 AM, Shachar Shemesh wrote: I got this as a report from a user, not directly running this, which is why I'm not opening a bug report. Consider the following function: void f(ARGS...)(ARGS args, bool arg1 = true, char arg2 = 'H'); Now consider the following call to it:  

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: Farewell (of sorts)

2018-10-04 Thread Nicholas Wilson via Digitalmars-d
On Thursday, 4 October 2018 at 13:15:23 UTC, Shachar Shemesh wrote: Hello everyone, First of all, I know I've had a shorter than usual fuse of late. I'd like to apologize to everyone about this. It is the culmination of quite a few things increasing the load I'm under. One of those things

Re: Farewell (of sorts)

2018-10-04 Thread bauss via Digitalmars-d
On Thursday, 4 October 2018 at 13:15:23 UTC, Shachar Shemesh wrote: Hello everyone, First of all, I know I've had a shorter than usual fuse of late. I'd like to apologize to everyone about this. It is the culmination of quite a few things increasing the load I'm under. One of those things

Re: DIP 1014

2018-10-04 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 4 October 2018 at 12:08:38 UTC, Shachar Shemesh wrote: Two distinct things. Kinke was talking about how to pass a struct through the ABI. You are talking about special-casing a specific name. Not just name, but argument passing as well. Not to mention, your special case is to

Farewell (of sorts)

2018-10-04 Thread Shachar Shemesh via Digitalmars-d
Hello everyone, First of all, I know I've had a shorter than usual fuse of late. I'd like to apologize to everyone about this. It is the culmination of quite a few things increasing the load I'm under. One of those things is this: October 14th will be my last day working for Weka.IO.

Re: LDC2 1.9.0 beta 1 bug

2018-10-04 Thread Nemanja Boric via Digitalmars-d
On Thursday, 4 October 2018 at 12:51:27 UTC, Shachar Shemesh wrote: I got this as a report from a user, not directly running this, which is why I'm not opening a bug report. [...] I'm pretty sure I saw an issue in bugzilla few weeks ago... Found it:

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

LDC2 1.9.0 beta 1 bug

2018-10-04 Thread Shachar Shemesh via Digitalmars-d
I got this as a report from a user, not directly running this, which is why I'm not opening a bug report. Consider the following function: void f(ARGS...)(ARGS args, bool arg1 = true, char arg2 = 'H'); Now consider the following call to it: f(true, 'S'); Theoretically, this can either be

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: DIP 1014

2018-10-04 Thread Shachar Shemesh via Digitalmars-d
On 04/10/18 13:43, Stanislav Blinov wrote: * move the data as part of the call hook rather than before * Use a different name and signature on the hook function Yes, exactly. It would have to be special if you don't want to leave room for the compiler implementors. That's not how

Re: Deep nesting vs early returns

2018-10-04 Thread Jacob Carlborg via Digitalmars-d
On Thursday, 4 October 2018 at 06:43:02 UTC, Gopan wrote: Certain people recommend that there be only one return statement (usually at the end) from a function. The said advantage is that, in a maintenance code, if you later want to do something before returning, you can add it just above

Re: Deep nesting vs early returns

2018-10-04 Thread Jacob Carlborg via Digitalmars-d
On Tuesday, 2 October 2018 at 20:53:40 Is it: For optional binding, Swift 2 has sugar for if let !( ){} Or am I missing the point of the guard statement? The variable declared in the guard statement is available after the statement. It’s like an if statement without the then part, only an

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: DIP 1014

2018-10-04 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 4 October 2018 at 08:32:44 UTC, Shachar Shemesh wrote: On 04/10/18 11:16, Paolo Invernizzi wrote: While I want to thank you both, about the quality of this thread, what kind of "consequences that go beyond what I think you understand" are you thinking of? Can you give an example?

Re: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread Joakim via Digitalmars-d
On Thursday, 4 October 2018 at 10:02:28 UTC, Russel Winder wrote: On Thu, 2018-10-04 at 08:06 +, Joakim via Digitalmars-d wrote: […] The link in my OP links to a guy who maintained a spreadsheet of Apple-related conferences as evidence. He lists several that went away and says nothing

Re: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread Russel Winder via Digitalmars-d
On Thu, 2018-10-04 at 08:06 +, Joakim via Digitalmars-d wrote: > […] > > The link in my OP links to a guy who maintained a spreadsheet of > Apple-related conferences as evidence. He lists several that went > away and says nothing replaced them. If you don't even examine > the evidence

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: `shared`...

2018-10-04 Thread Kagamin via Digitalmars-d
On Tuesday, 2 October 2018 at 07:42:13 UTC, Walter Bright wrote: Having it transitive would make it unworkable, actually What would be broken by transitive scope?

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: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread Joakim via Digitalmars-d
On Thursday, 4 October 2018 at 08:54:29 UTC, Iain Buclaw wrote: On Thursday, 4 October 2018 at 08:06:24 UTC, Joakim wrote: On Thursday, 4 October 2018 at 07:53:54 UTC, Iain Buclaw wrote: [...] Did anybody pay attention to the live talks either? ;) That's the real comparison. Anyway, the

Re: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread Iain Buclaw via Digitalmars-d
On Thursday, 4 October 2018 at 08:06:24 UTC, Joakim wrote: On Thursday, 4 October 2018 at 07:53:54 UTC, Iain Buclaw wrote: I went to a conference once where they had mixed live talks and prerecorded talks - questions where taken at the end to the speaker of the prerecorded talk via a sip

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

Re: DIP 1014

2018-10-04 Thread Shachar Shemesh via Digitalmars-d
On 04/10/18 11:16, Paolo Invernizzi wrote: While I want to thank you both, about the quality of this thread, what kind of "consequences that go beyond what I think you understand" are you thinking of? Can you give an example? Assuming I understand Stanislav's proposal correctly (an assumption

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: DIP 1014

2018-10-04 Thread Paolo Invernizzi via Digitalmars-d
On Thursday, 4 October 2018 at 08:10:31 UTC, Shachar Shemesh wrote: On 04/10/18 11:05, Stanislav Blinov wrote: On Thursday, 4 October 2018 at 03:06:35 UTC, Shachar Shemesh wrote: [...] For the love of Pete, that program was an example of how a move hook should work, *not* a demonstration

Re: DIP 1014

2018-10-04 Thread Shachar Shemesh via Digitalmars-d
On 04/10/18 11:05, Stanislav Blinov wrote: On Thursday, 4 October 2018 at 03:06:35 UTC, Shachar Shemesh wrote: If you do *anything* to that program, and that includes even changing its compilation flags (try enabling inlining), it will stop working. You should have known that when you found

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: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread Joakim via Digitalmars-d
On Thursday, 4 October 2018 at 07:12:03 UTC, Russel Winder wrote: On Wed, 2018-10-03 at 18:46 +, Joakim via Digitalmars-d wrote: […] I don't doubt that some are like you and prefer viewing live, but given how conferences keep dying off and online tech talks are booming, you're in an

Re: DIP 1014

2018-10-04 Thread Stanislav Blinov via Digitalmars-d
On Thursday, 4 October 2018 at 03:06:35 UTC, Shachar Shemesh wrote: If you do *anything* to that program, and that includes even changing its compilation flags (try enabling inlining), it will stop working. You should have known that when you found out it doesn't work on ldc: ldc and dmd

Re: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread rikki cattermole via Digitalmars-d
On 04/10/2018 8:53 PM, Iain Buclaw wrote: I went to a conference once where they had mixed live talks and prerecorded talks - questions where taken at the end to the speaker of the prerecorded talk via a sip call. The organisers at the end admitted that the prerecorded talks experiment

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?

Re: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread Iain Buclaw via Digitalmars-d
On Wednesday, 3 October 2018 at 16:17:48 UTC, Joakim wrote: On Wednesday, 3 October 2018 at 01:28:37 UTC, Adam Wilson wrote: On 10/2/18 4:34 AM, Joakim wrote: On Tuesday, 2 October 2018 at 09:39:14 UTC, Adam Wilson wrote: On 10/1/18 11:26 PM, Joakim wrote: [snip] I disagree. It is not

Re: Deep nesting vs early returns

2018-10-04 Thread Trass3r via Digitalmars-d
On Tuesday, 2 October 2018 at 18:14:55 UTC, Andrei Alexandrescu wrote: Kate Gregory makes a good argument on something I've often commented in code reviews: https://youtu.be/n0Ak6xtVXno?t=2682 Sean Parent covered early exits years ago in an excellent talk I just can't find anymore (maybe

Re: Deep nesting vs early returns

2018-10-04 Thread Jack Applegame via Digitalmars-d
On Thursday, 4 October 2018 at 06:43:02 UTC, Gopan wrote: Certain people recommend that there be only one return statement (usually at the end) from a function. The said advantage is that, in a maintenance code, if you later want to do something before returning, you can add it just above the

Private struct constructor

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

Re: Please don't do a DConf 2018, consider alternatives

2018-10-04 Thread Russel Winder via Digitalmars-d
On Wed, 2018-10-03 at 18:46 +, Joakim via Digitalmars-d wrote: > […] > > I don't doubt that some are like you and prefer viewing live, but > given how conferences keep dying off and online tech talks are > booming, you're in an extreme minority that prefers that > high-cost live version.

[Issue 19284] alias this not used in nested functions of a method

2018-10-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19284 Eyal changed: What|Removed |Added Severity|major |critical --

Re: Just found this debugger...

2018-10-04 Thread JN via Digitalmars-d
On Wednesday, 3 October 2018 at 23:51:38 UTC, tide wrote: On Wednesday, 3 October 2018 at 13:20:03 UTC, JN wrote: On Wednesday, 3 October 2018 at 03:25:04 UTC, solidstate1991 wrote: Then I had a thought: Is there anything usable on the market besides these? It may not be enough for your

Re: Deep nesting vs early returns

2018-10-04 Thread Gopan via Digitalmars-d
On Tuesday, 2 October 2018 at 18:14:55 UTC, Andrei Alexandrescu wrote: Kate Gregory makes a good argument on something I've often commented in code reviews: https://youtu.be/n0Ak6xtVXno?t=2682 Thank you Andrei for mentioning this. I always had this question of which one to choose - early

Re: DIP 1014

2018-10-04 Thread Manu via Digitalmars-d
On Wed, Oct 3, 2018 at 11:00 PM Timothee Cour via Digitalmars-d wrote: > > @Manu, @Jonathan M Davis > > > GNU's std::string implementation stores an interior pointer! >_< > > it's not just GNU's std::string ; it can crop up in other places, see > https://github.com/Syniurge/Calypso/issues/70 in

Re: DIP 1014

2018-10-04 Thread Timothee Cour via Digitalmars-d
@Manu, @Jonathan M Davis > GNU's std::string implementation stores an interior pointer! >_< it's not just GNU's std::string ; it can crop up in other places, see https://github.com/Syniurge/Calypso/issues/70 in opencv (cv:: MatStep) On Wed, Oct 3, 2018 at 8:10 PM Shachar Shemesh via