Re: Function template argument deduction
On Saturday, 7 April 2018 at 05:10:05 UTC, Paul Backus wrote: I'm playing around with functional programming in D, and have run into a problem with the following code: [...] I don't see the error you are talking about: https://run.dlang.io/is/XWPIc1 Are you using the latest compiler?
Function template argument deduction
I'm playing around with functional programming in D, and have run into a problem with the following code: --- list.d import std.variant: Algebraic, This, visit; import std.typecons: Tuple, tuple; struct Nil {} alias List(T) = Algebraic!( Nil, Tuple!(T, "head", This*, "tail") ); alias Cons(T) = Tuple!(T, "head", List!T*, "tail"); List!T* list(T)(T[] items...) { if (items.length == 0) return new List!T(Nil()); else return new List!T(Cons!T(items[0], list(items[1..$]))); } string list2string(T)(List!T list) { import std.stdio: write; list.visit!( (Nil _) => "nil", (Cons!T cons) => "cons(" ~ cons.head ~ ", " ~ list2string(*cons.tail) ~ ")" ); } unittest { List!int* myList = list(1, 2, 3); assert(list2string(*myList) == "cons(1, cons(2, cons(3, nil)))"); } --- The error I get is "template list.list2string cannot deduce function from argument types [...]"; i.e., the compiler can't figure out that T is supposed to be 'int'. My question is, why not? Is there anything I can do to get this to work? The compiler seems to be able to handle this sort of thing in general (e.g., it can deduce 'int' from an argument of type 'Tuple!(int, int)'), so what makes this particular case fail?
Space before parens in all function definitions
Why is there a space before "(" in our /library/ docs? https://dlang.org/library/std/stdio/file.tmpfile.html The paren here has role similar to that in mathematics, not literary. Thanks, Andrei
[OT] Re: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
On 04/06/2018 10:03 AM, Abdulhaq wrote: On Friday, 6 April 2018 at 13:10:07 UTC, jason wrote: what is this? It's a perl program that converts D code into APL Genius.
[Issue 18740] dmd deletes similar named files
https://issues.dlang.org/show_bug.cgi?id=18740 greenifychanged: What|Removed |Added CC||greeen...@gmail.com --
Re: DIP 1009 (Add Expression-Based Contract Syntax) Accepted
On 06.04.2018 19:36, H. S. Teoh wrote: On Fri, Apr 06, 2018 at 05:02:54PM +, Adam D. Ruppe via Digitalmars-d-announce wrote: On Friday, 6 April 2018 at 16:57:21 UTC, Jonathan M Davis wrote: Now, if the contracts ended up in the documentation or something My documentation generator supports contracts, but I found in practice, most of them are so illegible it doesn't actually help any to include them, so I never do. But if they were simpler single expressions, it might make sense to revisit that. Yeah, I think having expression syntax will make contracts more readable. We'll just have to see. When will this DIP be implemented? AIUI Timon already has an implementation sitting around somewhere. Can't wait for it to get merged... T I'll rebase it against master and create a pull request ASAP.
Re: What are AST Macros?
On Friday, 6 April 2018 at 21:23:00 UTC, Jonathan M Davis wrote: D does not have any kind of AST macros and likely never will. Walter is completely against the idea - though I'd have to go digging through newsgroup's history to find posts where he talked about it to give the exact reasons. It's been a while since they were discussed last, and I don't recall them at the moment. I think Walter's reason was that such macros would hide too many idiosyncrasies in how they were programmed, such that a lot of code which seems simple on the surface will actually obfuscate complicated and arbitrary macro-programming patterns. Thus, code that uses them will become much less maintainable, because it is liable to do so many different and hidden things. Also, the tasks for which AST-macros would typically be used are already largely accommodated by templates and other features. Thus, the real need for them isn't that high.
Re: How to destruct class instances allocated by a Region-allocator over a single GC block
On Tuesday, 3 April 2018 at 09:14:28 UTC, Eduard Staniloiu wrote: So, say `reg` is your allocator, your workflow would be auto obj = reg.make!Type(args); /* do stuff */ reg.dispose(obj); // If Type has a __dtor, it will call obj.__dtor // and then reg.deallocate(obj) If I do sucessive calls to reg.make!X where X are different kinds of classes of different sizes how does reg.dispose(obj) figure out at which address(es) (where emplace filled in the data) the objects reside?
Re: DIP 1009 (Add Expression-Based Contract Syntax) Accepted
On Friday, 6 April 2018 at 12:26:36 UTC, Mike Parker wrote: Congratulations to Zach Tollen and everyone who worked on DIP 1009. It took a painful amount of time to get it through the process, but it had finally come out of the other side with an approval. The proposal itself was approved early on, but it needed quite a bit of revision to get to an acceptable final draft. The DIP in its final form: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1009.md Great work. Great syntax.
Re: What are AST Macros?
On Friday, April 06, 2018 20:33:10 Chris Katko via Digitalmars-d wrote: > Sorry if this is "re-opening" an old thread, but did anything > come from this and DIP50? It seems like a really interesting > concept and this thread was one of the first results for a Google > search. D does not have any kind of AST macros and likely never will. Walter is completely against the idea - though I'd have to go digging through newsgroup's history to find posts where he talked about it to give the exact reasons. It's been a while since they were discussed last, and I don't recall them at the moment. Either way, DIP 50 was part of the old DIP process where DIPs were not always really reviewed like they should have been, so it was never officially accepted or rejected. I don't know if Walter or Andrei have even ever looked at it. And for any DIP to be accepted now, it must go through the new DIP process: https://github.com/dlang/DIPs So, regardless of what Walter thinks of AST macros, for them to make it into the language, someone will have to submit a DIP through the new DIP process, and no one has done that yet. However, based on what Walter has said in the past, I would fully expect such a DIP to be rejected. - Jonathan M Davis
Re: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
I want to know whose bright idea it was to turn l33tspeak into a programming language.
[Issue 17906] Deprecated Language features should be allowed without a deprecation in a deprecated scope
https://issues.dlang.org/show_bug.cgi?id=17906 Issue 17906 depends on issue 18647, which changed state. Issue 18647 Summary: Use of delete should be allowed without a deprecation in a deprecated scope https://issues.dlang.org/show_bug.cgi?id=18647 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 18647] Use of delete should be allowed without a deprecation in a deprecated scope
https://issues.dlang.org/show_bug.cgi?id=18647 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/a03f88a5371bbb171be93a15c6ffc23f08ad136f Fix Issue 18647 - Use of delete should be allowed without a deprecation in a deprecated scope https://github.com/dlang/dmd/commit/b9a190bf1d37aae71558870873be4ee881d26de3 Merge pull request #8066 from wilzbach/fix-17906 Fix Issue 18647 - Use of delete should be allowed without a deprecation in a deprecated scope --
[Issue 18515] freebsd 11 ships with gcc unable to link 32 bit binaries, dmd uses it by default
https://issues.dlang.org/show_bug.cgi?id=18515 --- Comment #8 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/5f4d97ce92f7715d71dc53724ae655f3060c542b issue 18515: Fix it so that neither g++ nor CC is required. It was previously fixed so that cc is used if CC isn't set when compiling dmd, but the test suite still had g++ hardcoded, so if the system was set up with clang and not gcc, the dmd test suite barfed midway through. This fixes it so that it uses c++ if CC isn't set instead of using g++. https://github.com/dlang/dmd/commit/77b3d453a49f908e0e09e192852c198dc4c3787f Merge pull request #8012 from wilzbach/fix-win32-64-stable [stable] issue 18515: Fix it so that neither g++ nor CC is required. --
[Issue 17942] Enums are evaluated differently in global scope
https://issues.dlang.org/show_bug.cgi?id=17942 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 18647] Use of delete should be allowed without a deprecation in a deprecated scope
https://issues.dlang.org/show_bug.cgi?id=18647 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 18670] compiler segfault if `new` on a union type with dip1000
https://issues.dlang.org/show_bug.cgi?id=18670 --- Comment #8 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7bf608bdbca8c147c413614f3ca7a2062a0c1909 Fix Issue 18670 - compiler segfault if new on a union type with dip1000 https://github.com/dlang/dmd/commit/15213da2465922c7a33fe8037941122926325f6c Merge pull request #8095 from RazvanN7/Issue_18670v2 Fix Issue 18670 - compiler segfault if new on a union type with dip1000 --
[Issue 17942] Enums are evaluated differently in global scope
https://issues.dlang.org/show_bug.cgi?id=17942 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8c28783bbc6ccbef576bcc227cf6426277ef940b fix Issue 17942 - Enums are evaluated differently in global scope https://github.com/dlang/dmd/commit/cee0643ba4256bb1f24cbd24bb2b43435ea041a4 Merge pull request #8077 from WalterBright/fix17942 fix Issue 17942 - Enums are evaluated differently in global scope merged-on-behalf-of: Iain Buclaw--
[Issue 18645] DMD segmentation fault
https://issues.dlang.org/show_bug.cgi?id=18645 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/5c11b2969441e2a05596e267fdfd944df21cd615 Fix Issue 18645 - DMD segmentation fault (Enum Initialization) https://github.com/dlang/dmd/commit/faa6f89bfb190b78619688897ccd49bc9750cd44 Merge pull request #8072 from JinShil/fix_18645 Fix Issue 18645 - DMD segmentation fault (Enum Initialization) --
[Issue 18732] Can use template as type in a templatized class
https://issues.dlang.org/show_bug.cgi?id=18732 ag0aep6gchanged: What|Removed |Added Status|NEW |RESOLVED CC||ag0ae...@gmail.com Resolution|--- |INVALID --- Comment #1 from ag0aep6g --- Working as intended. class Foo(bool b) { } is equivalent to template Foo(bool b) { class Foo { ... } } https://dlang.org/spec/template.html#aggregate_templates Inside the class, the name "Foo" refers to the class itself. To refer to the template, you have to use `.Foo`. However, you can use `Foo!false`, because the compiler is being nice. I don't know if that's in the spec, or if it's just a welcome quirk. Closing as invalid. Feel free to reopen if I'm missing something here. --
[Issue 18717] Segfault in BitManip
https://issues.dlang.org/show_bug.cgi?id=18717 Walter Brightchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=18730 --
[Issue 18730] dmd miscompiles core.bitop.bt with -O
https://issues.dlang.org/show_bug.cgi?id=18730 Walter Brightchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=18717 --
Re: What are AST Macros?
Sorry if this is "re-opening" an old thread, but did anything come from this and DIP50? It seems like a really interesting concept and this thread was one of the first results for a Google search. Thanks.
[Issue 18741] std.math.sqrt doesn't use sqrtl when it's available
https://issues.dlang.org/show_bug.cgi?id=18741 Jack Stoufferchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from Jack Stouffer --- (In reply to kinke from comment #1) > It always uses the core.math intrinsic, which has all 3 overloads. Gah you're right, I confused it with the core.stdc.math calls. --
[Issue 18730] dmd miscompiles core.bitop.bt with -O
https://issues.dlang.org/show_bug.cgi?id=18730 Walter Brightchanged: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #7 from Walter Bright --- This covers 64 bit operations too: http://www.felixcloutier.com/x86/BT.html --
[Issue 18738] [scope] scope delegates can be escaped via closure
https://issues.dlang.org/show_bug.cgi?id=18738 ag0aep6gchanged: What|Removed |Added Keywords||safe CC||ag0ae...@gmail.com Hardware|x86_64 |All OS|Linux |All --
[Issue 18741] std.math.sqrt doesn't use sqrtl when it's available
https://issues.dlang.org/show_bug.cgi?id=18741 ki...@gmx.net changed: What|Removed |Added CC||ki...@gmx.net --- Comment #1 from ki...@gmx.net --- It always uses the core.math intrinsic, which has all 3 overloads. --
[Issue 18741] New: std.math.sqrt doesn't use sqrtl when it's available
https://issues.dlang.org/show_bug.cgi?id=18741 Issue ID: 18741 Summary: std.math.sqrt doesn't use sqrtl when it's available Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: j...@jackstouffer.com std.math.sqrt always uses the double overload of core.stdc.math.sqrt even when sqrtl is given on the platform. --
[Issue 18691] assigning a std.regex.Captures with 3 or more groups causes double free
https://issues.dlang.org/show_bug.cgi?id=18691 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/b602b5a3f42456faa39b56082510d2181b6b844a Fix issue 18691 - memory errors in std.regex.Captures Instead of a messy code that ended up with refcount at the wrong place provide a clean fixed-size array with required semantics and build on top of that. https://github.com/dlang/phobos/commit/71692cd4746bc9601c312a71eb8b20fd22f3 Merge pull request #6379 from DmitryOlshansky/fix-issue-18691 Fix issue 18691 - memory errors in std.regex.Captures merged-on-behalf-of: Jack Stouffer--
[Issue 18691] assigning a std.regex.Captures with 3 or more groups causes double free
https://issues.dlang.org/show_bug.cgi?id=18691 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
Re: code-d 0.17.0 + serve-d 0.1.2
Nice job WebFreak001 on the new changes. For the first time in years the code-d plugin works out of the box on Windows without any issues. A small tip: associate the .d file extension in the Visual Studio Code marketplace with Code-d. Currently Code-D does not show up when VSC suggests plugins for the .d file extension.
[Issue 18275] dmd deletes source file fun.cpp with `dmd fun.cpp.o main.d`
https://issues.dlang.org/show_bug.cgi?id=18275 --- Comment #4 from ArturG--- done https://issues.dlang.org/show_bug.cgi?id=18740 --
[Issue 18740] New: dmd deletes similar named files
https://issues.dlang.org/show_bug.cgi?id=18740 Issue ID: 18740 Summary: dmd deletes similar named files Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: var.spool.mail...@gmail.com if i have 2 files with the same name, like this test test.d and execute dmd -D test dmd picks test.d and generates the test.html but deletes the test file. --
Re: Making emplaceRef public
On Friday, 6 April 2018 at 17:46:26 UTC, Per Nordlöw wrote: Why isn't `std.conv.emplaceRef` public when `std.conv.emplace` is? AFAICT, emplaceRef(x, ...) is a bit more @safe than emplace(, ...) ... I had the same thoughts too: https://issues.dlang.org/show_bug.cgi?id=18701 We can even do this without introducing a new symbol, but simply let emplace accept pointers and ref like we need with formattedRead for nice backwards compatibility.
Re: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
On Friday, 6 April 2018 at 14:03:18 UTC, Abdulhaq wrote: On Friday, 6 April 2018 at 13:10:07 UTC, jason wrote: what is this? It's a perl program that converts D code into APL I didn't know perl syntax got such improvment for readability.
Making emplaceRef public
Why isn't `std.conv.emplaceRef` public when `std.conv.emplace` is? AFAICT, emplaceRef(x, ...) is a bit more @safe than emplace(, ...) ...
Re: DIP 1009 (Add Expression-Based Contract Syntax) Accepted
On Fri, Apr 06, 2018 at 05:02:54PM +, Adam D. Ruppe via Digitalmars-d-announce wrote: > On Friday, 6 April 2018 at 16:57:21 UTC, Jonathan M Davis wrote: > > Now, if the contracts ended up in the documentation or something > > My documentation generator supports contracts, but I found in > practice, most of them are so illegible it doesn't actually help any > to include them, so I never do. > > But if they were simpler single expressions, it might make sense to > revisit that. Yeah, I think having expression syntax will make contracts more readable. We'll just have to see. When will this DIP be implemented? AIUI Timon already has an implementation sitting around somewhere. Can't wait for it to get merged... T -- GEEK = Gatherer of Extremely Enlightening Knowledge
[Issue 8048] Missing head function in std.net.curl
https://issues.dlang.org/show_bug.cgi?id=8048 vladvi...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED CC||vladvi...@gmail.com Resolution|--- |WONTFIX --- Comment #1 from vladvi...@gmail.com --- Please see realted discussion at https://github.com/dlang/phobos/pull/6352 --
Re: DIP 1009 (Add Expression-Based Contract Syntax) Accepted
On Friday, 6 April 2018 at 16:57:21 UTC, Jonathan M Davis wrote: Now, if the contracts ended up in the documentation or something My documentation generator supports contracts, but I found in practice, most of them are so illegible it doesn't actually help any to include them, so I never do. But if they were simpler single expressions, it might make sense to revisit that.
Re: DIP 1009 (Add Expression-Based Contract Syntax) Accepted
On Friday, April 06, 2018 08:00:42 H. S. Teoh via Digitalmars-d-announce wrote: > On Fri, Apr 06, 2018 at 12:26:36PM +, Mike Parker via Digitalmars-d- announce wrote: > > Congratulations to Zach Tollen and everyone who worked on DIP 1009. It > > took a painful amount of time to get it through the process, but it > > had finally come out of the other side with an approval. > > WOOHOO Just this week, I've started to wonder whatever happened to > this DIP. So happy to hear it's approved!! Finally, sane contract > syntax! It definitely improves the syntax, but I confess that I still don't see much point in using contracts outside of virtual functions. Everywhere else, the behavior is the same if you just put assertions at the top of the function. Now, if the contracts ended up in the documentation or something - or if it were actually changed so that contracts were compiled in based on how the caller were compiled rather than the callee - then maybe having an actual contract would make sense, but as it stands, I don't see the point. - Jonathan M Davis
[Issue 18739] New: std.math.remquo's returns 0 when y is zero only on FreeBSD 32bit
https://issues.dlang.org/show_bug.cgi?id=18739 Issue ID: 18739 Summary: std.math.remquo's returns 0 when y is zero only on FreeBSD 32bit Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: j...@jackstouffer.com version(FreeBSD) { version(x86) assert(remquo(-1.0, 0.0, n) == 0); } else assert(remquo(-1.0, 0.0, n) is -real.nan); --
Re: Proper way to fix core.exception.UnicodeException@src\rt\util\utf.d(292): invalid UTF-8 sequence by File.readln()
On Friday, April 06, 2018 16:10:56 Dr.No via Digitalmars-d-learn wrote: > I'm reading line by line the lines from a CSV file provided by > the user which is assumed to be UTF8. But an user has provided an > > ANSI file which resulted in the error: > >core.exception.UnicodeException@src\rt\util\utf.d(292): invalid > >UTF-8 sequence > > (it happend when the user took the originally UTF8 encoded file > generated by another application, made some edit using an editor > (which I don't know the name) then saved not aware it was > changing the encoding to ANSI. > > My question is: what's the proper way to solve that? using toUTF8 > > didn't solve: > > while((line = csvFile.readln().toUTF8) !is null) { > > I didn't find a way to set explicitly the encoding with > std.stdio.File to set to UTF8 regardless it's an ANSI or already > UTF8. > I don't want to conver the whole file to UTF8, the CSV file can > be large and might take quite while. And if I do so to a > temporary copy the file (which will make things even more slow) > to avoid touch user's original file. > > I thought in writing my own readLine() with > std.stdio.File.byChunk to take as many bytes as possible until > '\n' byte is seen, treat it as UTF8 and return. > > But I'd like to not reinvent the wheel and use something native, > if possible. Any ideas? In general, Phobos pretty much requires that text files be in UTF-8 or that they be in UTF-16 or UTF-32 with the native endianness. Certainly, char, wchar, and dchar are assumed by both the language and the library to be valid UTF-8, UTF-16, and UTF-32 respectively, and if you do anything with a string as a range, by default, it will decode the code units to code points, meaning that it will validate the UTF. If you want to read in anything that is not going to be valid UTF, then you're going to have to read it in as ubytes rather than as characters. If you're dealing with text that is supposed to be valid UTF but might contain invalid characters, then you can use std.utf.byCodeUnit to treat a string as a range of code units where it replaces invalid UTF with the Unicode replacement character, but you'd still have to read in the text as bytes (e.g. readText validates that the text is proper UTF). std.utf.byUTF could be use instead of byCodeUnit to convert to UTF-8, UTF-16, or UTF-32, and invalid UTF will be replaced with the replacement character (so it doesn't have to be the target encoding, but it does have to be one of those three encodings and not something else). byUTF8 is basically the version of byUTF!char / byChar that returns a string rather than a lazy range, which is why it would have not worked for you if the file is not UTF-8, UTF-16, or UTF-32. If you're dealing with an encoding other than UTF-8, UTF-16, or UTF-32, and you've read the data in as ubytes, then std.encoding _might_ help, but it's not a great module and doesn't support a lot of encodings. On the other hand, if by ANSI, you mean the encoding that Windows uses with the A versions of its functions, then you can use std.windows.charset.fromMBSz to convert it to string, though it will need to be a null terminated immutable(char)* to work with fromMBSz, so somewhat stupidly, it basically needs to be a null-terminated string that isn't valid UTF-8 that you pass using str.ptr or [0]. If the encoding you're dealing with is not one that works with fromMBSz, and it is not one of the few supported by std.encoding, then you're on your own. - Jonathan M Davis
Re: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
On Friday, 6 April 2018 at 14:03:18 UTC, Abdulhaq wrote: On Friday, 6 April 2018 at 13:10:07 UTC, jason wrote: what is this? It's a perl program that converts D code into APL I laughed way too hard at this
Proper way to fix core.exception.UnicodeException@src\rt\util\utf.d(292): invalid UTF-8 sequence by File.readln()
I'm reading line by line the lines from a CSV file provided by the user which is assumed to be UTF8. But an user has provided an ANSI file which resulted in the error: core.exception.UnicodeException@src\rt\util\utf.d(292): invalid UTF-8 sequence (it happend when the user took the originally UTF8 encoded file generated by another application, made some edit using an editor (which I don't know the name) then saved not aware it was changing the encoding to ANSI. My question is: what's the proper way to solve that? using toUTF8 didn't solve: while((line = csvFile.readln().toUTF8) !is null) { I didn't find a way to set explicitly the encoding with std.stdio.File to set to UTF8 regardless it's an ANSI or already UTF8. I don't want to conver the whole file to UTF8, the CSV file can be large and might take quite while. And if I do so to a temporary copy the file (which will make things even more slow) to avoid touch user's original file. I thought in writing my own readLine() with std.stdio.File.byChunk to take as many bytes as possible until '\n' byte is seen, treat it as UTF8 and return. But I'd like to not reinvent the wheel and use something native, if possible. Any ideas?
[Issue 18275] dmd deletes source file fun.cpp with `dmd fun.cpp.o main.d`
https://issues.dlang.org/show_bug.cgi?id=18275 Sebchanged: What|Removed |Added CC||greensunn...@gmail.com --- Comment #3 from Seb --- (In reply to ArturG from comment #2) > is this the same bug? > if i have 2 files with the same name, like this > > test > test.d > > and execute dmd -D test > > dmd picks test.d and generates the test.html but deletes the test file. It's probably related, but it would be great if you could open a new issue for it, s.t. it can be properly tracked. Thanks! --
[Issue 18275] dmd deletes source file fun.cpp with `dmd fun.cpp.o main.d`
https://issues.dlang.org/show_bug.cgi?id=18275 ArturGchanged: What|Removed |Added CC||var.spool.mail...@gmail.com --- Comment #2 from ArturG --- is this the same bug? if i have 2 files with the same name, like this test test.d and execute dmd -D test dmd picks test.d and generates the test.html but deletes the test file. --
Re: dustmite watch shell script (.test vs .lookahead.*)
On Friday, 6 April 2018 at 15:35:59 UTC, Anonymouse wrote: The dustmite wiki[0] lists the following example script for use to monitor the reduction progress: Here's a more complete version that also works with -j: https://gist.github.com/CyberShadow/2e8f01895c248111c171e982313bb008
dustmite watch shell script (.test vs .lookahead.*)
The dustmite wiki[0] lists the following example script for use to monitor the reduction progress: #!/bin/sh watch -cn 0.1 "zsh -c 'ls -al $1.reduced/**/*.d ; colordiff -ru $1.reduced $1.test'" This repeatedly compares the $1.reduced directory with a $1.test directory. The dustmite run however doesn't seem to produce a (stable) $1.test, only several $1.lookahead.* directories. drwxr-xr-x 1 zorael zorael 362 apr 6 17:21 . drwxr-xr-x 1 zorael zorael 24 apr 6 17:21 source.lookahead.7170 drwxr-xr-x 1 zorael zorael 24 apr 6 17:21 source.lookahead.7169 drwxr-xr-x 1 zorael zorael 24 apr 6 17:21 source -rwxr-xr-x 1 zorael zorael 186 apr 6 10:23 tester The command used was `dustmite -j2 --strip-comments source /abs/path/to/tester`. I'm limiting the number of jobs to 2 so as not to run out of memory. dmd is a bit unreasonable. Why is there no .test directory? Changing the script to $1.lookahead.* doesn't work as it passes (jobs+1) arguments to colordiff, which only accepts 2. Is there any way to glob only one .lookahead.* directory? Some other solution? [0]: https://github.com/CyberShadow/DustMite/wiki
[Issue 18738] New: [scope] scope delegates can be escaped via closure
https://issues.dlang.org/show_bug.cgi?id=18738 Issue ID: 18738 Summary: [scope] scope delegates can be escaped via closure Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: default_357-l...@yahoo.de Consider the following code: int delegate() @safe foo(scope int delegate() @safe dg) @safe { return { return dg(); }; } int delegate() @safe bar() @safe { int k = 5; return foo({ return k; }); } void main() @safe { writefln("%s", bar()()); } The writefln outputs random noise because k is out of scope. Doesn't seem very safe... Probably foo should not have been allowed to allocate a closure that captured a scope delegate parameter. --
[Issue 15768] std.stdio.File does not support __gshared semantics of stdout/err/in
https://issues.dlang.org/show_bug.cgi?id=15768 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 15768] std.stdio.File does not support __gshared semantics of stdout/err/in
https://issues.dlang.org/show_bug.cgi?id=15768 --- Comment #12 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/9410ed02d3cf402fe991fb1ad1ca2a3d89f8f9b8 Fix Issue 15768 - std.stdio.trustedStdout accesses __gshared data without synchronization https://github.com/dlang/phobos/commit/77624187be34ce6455b08a6d565082d36fcc5e8a Merge pull request #6382 from JackStouffer/safe-file Fix Issue 15768 - std.stdio.trustedStdout accesses __gshared data wit… merged-on-behalf-of: Jack Stouffer--
Re: c2 classes
On Friday, 6 April 2018 at 14:43:25 UTC, Ali wrote: On Friday, 6 April 2018 at 14:31:49 UTC, Alex wrote: On Friday, 6 April 2018 at 13:41:50 UTC, aerto wrote: [...] A question from me, since I am also still learning D what is the difference between those following two declarations UUsers[int] uid; UUsers[] uid; T[U] declares an Associative Array but T[] declares a Dynamic Array. Some examples will help: --- void main() { char[int] s1; char[] s2; s1[1] = 'c'; //allowed, it is an Associative array. key 1 stores value 'c' s2[0] = 1; //error: out of bounds of array s2 } --- You can check out the spec[0] and the tour[1] [0]: https://dlang.org/spec/hash-map.html [1]: https://tour.dlang.org/tour/en/basics/associative-arrays
Re: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
On Fri, Apr 06, 2018 at 01:10:07PM +, jason via Digitalmars-d wrote: > what is this? It's a poor man's URL matcher. (Yeah, hard to believe, but most of the unreadability is caused by the Leaning Toothpick Syndrome caused by the poor choice of using / as regex delimiter when literal '/'s occur so frequently in the pattern.) T -- A program should be written to model the concepts of the task it performs rather than the physical world or a process because this maximizes the potential for it to be applied to tasks that are conceptually similar and, more important, to tasks that have not yet been conceived. -- Michael B. Allen
Re: DIP 1009 (Add Expression-Based Contract Syntax) Accepted
On Fri, Apr 06, 2018 at 12:26:36PM +, Mike Parker via Digitalmars-d-announce wrote: > Congratulations to Zach Tollen and everyone who worked on DIP 1009. It > took a painful amount of time to get it through the process, but it > had finally come out of the other side with an approval. WOOHOO Just this week, I've started to wonder whatever happened to this DIP. So happy to hear it's approved!! Finally, sane contract syntax! T -- The computer is only a tool. Unfortunately, so is the user. -- Armaphine, K5
Re: c2 classes
On Friday, 6 April 2018 at 14:31:49 UTC, Alex wrote: On Friday, 6 April 2018 at 13:41:50 UTC, aerto wrote: its possible to make this work ?? import std.stdio; class UUsers { public: int age; } class users { public: int[int] uid; } void main() { users newuser = new users(); newuser.uid[0].age = 23; writeln(newuser.uid[0].age); } It depends on what you want to achieve... This is runnable: ``` import std.stdio; class UUsers { this(int val) { age = val; } public: int age; } class users { public: UUsers[int] uid; } void main() { users newuser = new users(); newuser.uid[0] = new UUsers(23); writeln(newuser.uid[0].age); } ``` A question from me, since I am also still learning D what is the difference between those following two declarations UUsers[int] uid; UUsers[] uid;
Re: c2 classes
On Friday, 6 April 2018 at 13:41:50 UTC, aerto wrote: its possible to make this work ?? import std.stdio; class UUsers { public: int age; } class users { public: int[int] uid; } void main() { users newuser = new users(); newuser.uid[0].age = 23; writeln(newuser.uid[0].age); } This will work import std.stdio; class UUsers { public: int age; } class users { public: UUsers[] uid; } void main() { users userList = new users(); userList.uid ~= new UUsers(); userList.uid[0].age = 24 ; writeln(userList.uid[0].age); } Let me try to explain why Basically, what you wanted to do is have two classes one will hold user's information, and another holding a user list For the second class to hold user list this line int[int] uid; became this line UUsers[] uid; In you code, there was no relation between the two classes Then in your main You instantiate your users list object users userList = new users(); Then you instantiate a user object and append it to the list (~= is the append operator) userList.uid ~= new UUsers(); Finally you assign a value to your user object age and print it userList.uid[0].age = 24 ; writeln(userList.uid[0].age);
Re: c2 classes
On Friday, 6 April 2018 at 13:41:50 UTC, aerto wrote: its possible to make this work ?? import std.stdio; class UUsers { public: int age; } class users { public: int[int] uid; } void main() { users newuser = new users(); newuser.uid[0].age = 23; writeln(newuser.uid[0].age); } It depends on what you want to achieve... This is runnable: ``` import std.stdio; class UUsers { this(int val) { age = val; } public: int age; } class users { public: UUsers[int] uid; } void main() { users newuser = new users(); newuser.uid[0] = new UUsers(23); writeln(newuser.uid[0].age); } ```
Re: DIP 1009 (Add Expression-Based Contract Syntax) Accepted
On Friday, 6 April 2018 at 12:26:36 UTC, Mike Parker wrote: Congratulations to Zach Tollen and everyone who worked on DIP 1009. It took a painful amount of time to get it through the process, but it had finally come out of the other side with an approval. The proposal itself was approved early on, but it needed quite a bit of revision to get to an acceptable final draft. The DIP in its final form: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1009.md It looks very well designed! And makes using of in/out contracts very pleasant and clear. Thank you to everyone who worked on this DIP!
Re: Compile-time variables
On Friday, 6 April 2018 at 14:15:08 UTC, Kayomn wrote: On Friday, 6 April 2018 at 13:55:55 UTC, nkm1 wrote: [...] Figured I had a handle on how it worked doing but guess not. One final question, however. [...] Nevermind, I'm blind. I missed the post-increment in newID().
Re: Compile-time variables
On Friday, 6 April 2018 at 13:55:55 UTC, nkm1 wrote: On Friday, 6 April 2018 at 13:10:23 UTC, Kayomn wrote: ID tags are unique and spsecific to the class type. There shouldn't be more than one type ID assigned to one class type. The idea behind what it is I am doing is I am implementing a solution to getting a type index, similar to std.variant.Variant.type(). The way that I implemented this in C++ is like so: inline unsigned int getNodeTypeID() { static unsigned int lastID = 0; return lastID++; } template inline unsigned int getNodeTypeID() { static unsigned int typeID = getNodeTypeID(); return typeID; } In this C++ example I am exploiting the fact that templates are generated at compile-time to execute getNodeTypeID for each new type instance generated. After initial type generation, whenever they are called at runtime they were return the ID assigned to that function template instance that was generated at compile-time. It's pretty simple, and to be honest I'm surprised this has been causing me such a headache implementing it in D. That's because the C++ code doesn't do what you think it does. Apparently you think that getNodeID() is executed at compile time. This is not the case, which you can verify by adding "constexpr" to it: $ g++ -std=c++14 -Wall -Wextra -c -o example example.cpp main.cpp: In function ‘constexpr unsigned int getNodeTypeID()’: main.cpp:2:25: error: ‘lastID’ declared ‘static’ in ‘constexpr’ function static unsigned int lastID = 0; In fact, you're "exploiting" the fact that static variables in C++ can be initialized at runtime (which is probably not what you want). The equivalent D code is: uint newID() { static uint lastID; return lastID++; } uint getNodeID(T)() { static bool inited; static uint id; if (!inited) { id = newID(); inited = true; } return id; } (yes, C++ does insert some hidden bool that tells it whether the variable was initialized or not). Naturally, you can't use that for constructing switches or other compile time constructs. Figured I had a handle on how it worked doing but guess not. One final question, however. I've implemented this test bed with your example to what I think is your exact implementation, but it seems to be giving unexpected output. import std.stdio; uint newID() { static uint lastID; return lastID; } uint getNodeID(T)() { static bool inited; static uint id; if (!inited) { id = newID(); inited = true; } return id; } class Node {} class Sprite {} class Camera {} void main() { // Test 01. writeln("Test 01."); writeln(getNodeID!(Node)(),'\t',getNodeID!(Sprite)(),'\t',getNodeID!(Camera)()); // Test 02. writeln("Test 02."); writeln(getNodeID!(Node)(),'\t',getNodeID!(Sprite)(),'\t',getNodeID!(Camera)()); } Output: Performing "debug" build using gdc for x86_64. dlangtest ~master: building configuration "application"... Running ./dlangtest Test 01. 0 0 0 Test 02. 0 0 0 Have I misunderstood something?
Re: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
On Friday, 6 April 2018 at 13:10:07 UTC, jason wrote: what is this? It's a perl program that converts D code into APL
Re: Compile-time variables
On Friday, 6 April 2018 at 13:10:23 UTC, Kayomn wrote: ID tags are unique and spsecific to the class type. There shouldn't be more than one type ID assigned to one class type. The idea behind what it is I am doing is I am implementing a solution to getting a type index, similar to std.variant.Variant.type(). The way that I implemented this in C++ is like so: inline unsigned int getNodeTypeID() { static unsigned int lastID = 0; return lastID++; } template inline unsigned int getNodeTypeID() { static unsigned int typeID = getNodeTypeID(); return typeID; } In this C++ example I am exploiting the fact that templates are generated at compile-time to execute getNodeTypeID for each new type instance generated. After initial type generation, whenever they are called at runtime they were return the ID assigned to that function template instance that was generated at compile-time. It's pretty simple, and to be honest I'm surprised this has been causing me such a headache implementing it in D. That's because the C++ code doesn't do what you think it does. Apparently you think that getNodeID() is executed at compile time. This is not the case, which you can verify by adding "constexpr" to it: $ g++ -std=c++14 -Wall -Wextra -c -o example example.cpp main.cpp: In function ‘constexpr unsigned int getNodeTypeID()’: main.cpp:2:25: error: ‘lastID’ declared ‘static’ in ‘constexpr’ function static unsigned int lastID = 0; In fact, you're "exploiting" the fact that static variables in C++ can be initialized at runtime (which is probably not what you want). The equivalent D code is: uint newID() { static uint lastID; return lastID++; } uint getNodeID(T)() { static bool inited; static uint id; if (!inited) { id = newID(); inited = true; } return id; } (yes, C++ does insert some hidden bool that tells it whether the variable was initialized or not). Naturally, you can't use that for constructing switches or other compile time constructs.
c2 classes
its possible to make this work ?? import std.stdio; class UUsers { public: int age; } class users { public: int[int] uid; } void main() { users newuser = new users(); newuser.uid[0].age = 23; writeln(newuser.uid[0].age); }
D Goes Business -- Usign D with SAP
Kai Nacke has submitted another post to the D Blog. This one demonstrates how to get started with his D bindings to the SAP NetWeaver Remote Function Call SDK. The blog: https://dlang.org/blog/2018/04/06/d-goes-business/ Reddit: https://www.reddit.com/r/programming/comments/8a9guw/d_goes_business_using_d_with_sap/
Re: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
On Friday, 6 April 2018 at 13:10:07 UTC, jason wrote: what is this? Line noise.
Re: Compile-time variables
Besides this, I tried something with types used as user defined attributes. https://dlang.org/spec/attribute.html#uda Automatic compile time tagging is not my speciality, however, I think is also achievable with mixins somehow? But I don't know how to workaround the bug https://issues.dlang.org/show_bug.cgi?id=18718 at this moment... https://run.dlang.io/is/DmBhO5 Does the default case handle an unspecified class or does it handle a class which is specified, but is not mentioned in any of previous cases? So in this example code the switch table is being used for loading data serialized into text. If the class cannot determine the node ID or it uses the default node type ID (e.g. the Node type if super "Node") it will create a simple node, as you can always be sure no matter what the type there will be sufficient information stored in the data to construct a default Node. Another information shortage is: are the tags exclusive or not? So, is it possible that a class has more then one tag (still being unique (tuple))? ID tags are unique and spsecific to the class type. There shouldn't be more than one type ID assigned to one class type. The idea behind what it is I am doing is I am implementing a solution to getting a type index, similar to std.variant.Variant.type(). The way that I implemented this in C++ is like so: inline unsigned int getNodeTypeID() { static unsigned int lastID = 0; return lastID++; } template inline unsigned int getNodeTypeID() { static unsigned int typeID = getNodeTypeID(); return typeID; } In this C++ example I am exploiting the fact that templates are generated at compile-time to execute getNodeTypeID for each new type instance generated. After initial type generation, whenever they are called at runtime they were return the ID assigned to that function template instance that was generated at compile-time. It's pretty simple, and to be honest I'm surprised this has been causing me such a headache implementing it in D.
/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, [your code here]
what is this?
Re: Compile-time variables
On Friday, 6 April 2018 at 02:20:29 UTC, Kayomn wrote: Wrong example code, here's the correct example: switch (queryString(childJson,"type")) { case (typeof (Sprite).name): child = this.addChild!(Sprite)(childName); break; case (typeof (Camera).name): child = this.addChild!(Camera)(childName); break; default: child = this.addChild!(Node)(childName); break; } Hi, could you show a bit more implementation details in the C++ version that works? Maybe someone can translate that to the appropriate D version? The problem seems to be that switching on a runtime value and pattern matching with a compile time value is hard to pull off automatically without some sort of bridge (or of course I've misunderstood this exercise) So if you had: class R { string type() { return R.stringof; } } class A: R { override string type() { return A.stringof; } } class B: R { override string type() { return B.stringof; } } string type(T: R)() { return T.stringof; } void main() { R node = new A; final switch (node.type) { case type!R: writeln("R"); break; case type!A: writeln("A"); break; case type!B: writeln("B"); break; } } (maybe not a good idea to use stringof though, typeid probably better) Cheers
DIP 1009 (Add Expression-Based Contract Syntax) Accepted
Congratulations to Zach Tollen and everyone who worked on DIP 1009. It took a painful amount of time to get it through the process, but it had finally come out of the other side with an approval. The proposal itself was approved early on, but it needed quite a bit of revision to get to an acceptable final draft. The DIP in its final form: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1009.md Though I will not retroactively apply review summaries to all previously approved DIPs, I will do so with those currently working through the process. I've started with this one. Note that I kept the 'Preliminary Review' name instead of using the new 'Community Review' so that it would match the review thread title. I would like to remind everyone that DIP 1013, "The Deprecation Process", is currently under Community Review, with very little feedback so far. I encourage everyone to take a look at it and speak up if any flaws or potential enhancements are seen. https://forum.dlang.org/thread/rxlbdijkbhanwvbks...@forum.dlang.org
[Issue 2043] Closure outer variables in nested blocks are not allocated/instantiated correctly: should have multiple instances but only have one.
https://issues.dlang.org/show_bug.cgi?id=2043 greenifychanged: What|Removed |Added CC||greeen...@gmail.com --
Re: Compile-time variables
On Friday, 6 April 2018 at 02:20:29 UTC, Kayomn wrote: Wrong example code, here's the correct example: switch (queryString(childJson,"type")) { case (typeof (Sprite).name): child = this.addChild!(Sprite)(childName); break; case (typeof (Camera).name): child = this.addChild!(Camera)(childName); break; default: child = this.addChild!(Node)(childName); break; } Ok, first of all, I'm not sure about the question, because of the following: Does the default case handle an unspecified class or does it handle a class which is specified, but is not mentioned in any of previous cases? Or does the default case handle both of these circumstances? Without a master list this play an important role, I think. Another information shortage is: are the tags exclusive or not? So, is it possible that a class has more then one tag (still being unique (tuple))? Besides this, I tried something with types used as user defined attributes. https://dlang.org/spec/attribute.html#uda Automatic compile time tagging is not my speciality, however, I think is also achievable with mixins somehow? But I don't know how to workaround the bug https://issues.dlang.org/show_bug.cgi?id=18718 at this moment... https://run.dlang.io/is/DmBhO5
[Issue 2043] Closure outer variables in nested blocks are not allocated/instantiated correctly: should have multiple instances but only have one.
https://issues.dlang.org/show_bug.cgi?id=2043 --- Comment #38 from timon.g...@gmx.ch --- (In reply to Walter Bright from comment #37) > (In reply to timon.gehr from comment #36) > > (In reply to Walter Bright from comment #35) > > As I said, just do it if the delegate does not escape. > > Yes, I thought this was clear. This only applies if the delegate escapes. > > > > 2. Doing a heap alloc/free for every loop iteration is expensive, and > > > since > > > the cost is hidden it will come as a nasty surprise. > > > ... > > > > I don't get how this is different from other implicit heap closure > > allocations. A function that does such an implicit allocation not within a > > loop in its own body might well be called in a loop and cause a performance > > bottleneck. Profile. > > People have made it clear they don't particularly like hidden allocations in > innocuous looking code. Some people. Others just want obvious code to do the obvious thing. Also, closures escaped from the loop body don't look innocuous. > Hence the genesis of the @nogc attribute. Exactly. I'm not proposing anything that would not be catched by @nogc. > For this > particular issue, it would be hard to look at a random loop and see if > allocations are occurring Not really. Annotate it with @nogc and you will see. This is really not a new issue. This is about consistently applying an existing rule. > - i.e. a nasty surprise if a small change suddenly > made a big hit in performance. Profiling is not the answer, as very, very > few people profile code. > ... A "big hit in performance" is noticeable. > > > > 3. Doing a gc allocation will generate an unbounded set of allocations, > > > also > > > coming as a nasty surprise. > > > ... > > This is true for all implicit heap allocations. They are also often > > convenient and there are already ways to flag them. > > I can hear the complaints about this already :-( > ... There will also be complaints about missing closure support. > > > > 4. Doing my delegate rewrite will cause a "by value" which changes the > > > semantics, so that won't work. > > > ... > > That's not true. > > I believe it is: > > int i = 0; > auto dg = { ++i; } > dg(); > print(i); // zero or one? > > By ref would make it one, with the rewrite it would be 0 because the ref > would be to a copy of i, not the original. > ... No, the rewrite would wrap the loop body and nothing else. foreach loops have a lowering similar to the following: foreach(i; 0..n) delegates~=()=>i; -> for(int __i=0;__ii; } Here, the rewrite would be: for(int __i=0;__i i; }() This has the same semantics as before, and every closure gets its own copy of i, as this is a different variable for each of them (because it is declared in the loop body). If you just had the for loop: for(int i=0;i i; } Then the (unnecessary!) rewrite would be: for(int i=0;i i; }(); And all closures in the body get the same copy of i, as they all see the same version. In this case, in the end, every closure would point to the same i and the value of that i would be n. For this case, no additional implicit allocations (gc or non-gc) would be necessary. > > The delegate rewrite is a very hacky way > > to implement it though, and probably not really the most convenient as you > > need to thread through control flow and the generated code will not be as > > good as it could be. > > Things get very sticky if you've got closures from functions nested several > levels deep. It turns out to be pretty hard to get all this stuff right. > Doing the rewrite means I know it will be correct, as it leverages all that > complex, debugged, working code. > ... You know that that part will be correct. Wrapping the loop body into a function does not in general result in valid code though. (E.g. break, continue, early returns, interactions with scope.) Therefore, there need to be additional hacks. > ... > BTW, I belatedly realized that it wasn't just about loop variables. > Capturing non-loop variables that get destructed when they go out of scope > also cannot be done. Yes, this is also an issue, though not related to the current one. --
Re: PR duty
On Wednesday, 4 April 2018 at 05:31:10 UTC, Andrei Alexandrescu wrote: Hi folks, I was thinking of the following. To keep the PR queue trim and in good shape, we'd need at least one full-time engineer minding it. I've done that occasionally, and the queue size got shorter, but I couldn't do much else during that time. I was thinking, we can't afford a full-time engineer, and even if we did, we'd probably have other important matters for that engineer as well. However, what we can afford - and indeed already benefit from - is a quantum of time from each of many volunteers. By organizing that time better we may be able to get more output. Here's what I'm thinking. Let's define a "PR duty" role that is one week long for each of a pool of volunteers. During that week, the person on PR duty focuses on minding github queues - merge trivial PRs, ping authors of old PRs, email decision makers for specific items in PRs, etc. Then the week ends and the role is handed off to the next person in the pool. (...) Thanks, Andrei Maybe one idea would be to get university people interested in D. A lot of work on the Scala compiler and eco system is done by students at the technical university of Lausanne where Martin Odersky (the creator of Scala) is teaching. They do work on it in their master or PhD thesis or just help on the development of tools and libraries. The EPFL is well endowed with money and pays as long as the work being done is in some way research oriented (and as long as Scala is a big thing in the IT world). So the idea would be to get some university professors interested in D. Then you have people working on D and its eco system that are paid by the university or do the work for their thesis. I would say that D is ideal for teaching programming being a high-level language with both manual memory management and a GC. It's really a win-win situation for D and teaching institutions. So I would propose to have a look at universities/academia as a new target to promote D. Students one day finish their studies and then take the language with them from which they learned a lot and know very well ... ;-).