Re: Parenthesis around if/for/while condition is not necessary
On Saturday, 23 June 2018 at 04:45:07 UTC, user1234 wrote: On Saturday, 23 June 2018 at 01:27:30 UTC, aedt wrote: for line in stdin.lines() {} if condition {} while condition {} for init; condition; op {} What's the rationale of keeping the requirement that the condition of if/for/while must be wrapped with a parenthesis (other than keeping parser simple)? Modern languages have already dropped this requirement (i.e. Rust, Nim) and I don't see any reason not to do so. There is this case that requires parens: if a && b c; Is there a missing && or not ? It seems obvious for a human but compiler parsers are "apparatchiks", i.e rules are rules. That being said this would work by allowing parens for disambiguation. Same thing as the following" return a && b; I'm not saying to drop parens completely, I'm saying why is it not optional. D seems to have no problem with x.to!string or std.lines
Parenthesis around if/for/while condition is not necessary
for line in stdin.lines() {} if condition {} while condition {} for init; condition; op {} What's the rationale of keeping the requirement that the condition of if/for/while must be wrapped with a parenthesis (other than keeping parser simple)? Modern languages have already dropped this requirement (i.e. Rust, Nim) and I don't see any reason not to do so.
Quick Refresher book?
Hello, I was wondering if there's any quick refresher resource to brush up on my D after a long time? Is there a short and quick language reference book like "A Tour of C++"?
Re: SmartRef: The Smart Pointer In D
On Friday, 13 January 2017 at 16:50:37 UTC, Dsby wrote: I write the ref count pointer and the scoped point in D. it just Like cpp's shared_ptr , waek_ptr and unique_ptr . Now, it is Developing. I will write more test before the frist release. And the docs is null. It on github: https://github.com/huntlabs/SmartRef Very nice. Do you have a dub package for this?
Re: DLS : an attempt at a language server
On Tuesday, 27 March 2018 at 18:08:14 UTC, Laurent Tréguier wrote: Hello, D community! I've been looking at D for a while now, but never got to really use it. And now that Microsoft initiated the Language Server Protocol, I thought about trying to make a language server using DCD, DFMT and D-Scanner. It only supports formatting with DFMT and basic autocompletion with DCD (for now). I've successfully got it working with both VSCode [1] and Atom [2], maybe I'll try to make extensions for some other editors as well. Also now that I've actually tried the language, I have to say I really like it :) [1]: https://marketplace.visualstudio.com/items?itemName=LaurentTreguier.vscode-dls [2]: https://atom.io/packages/ide-dlang I really can't thank you enough for `ide`dlang`. Thank you very much for your atom package. I hope you include Dscanner in near future.
C style array declaration.
I'm a big fan of betterC. In C, you can initialize an array without specifying the length like this int ia[ ] = {0, 2, 1}; What is the translation of this? Note that int[] is a different type than C's arrays. https://dlang.org/spec/interfaceToC.html#data_type_compat says there are no equivalent to this. What's the workaround? Also, is it possible to retrieve the pointer of the sequence of actual data from std.container.array? If all fails I'd like to use this container.
Re: -betterC is amazing, make (/keep making) it more sophisticated!
On Thursday, 22 March 2018 at 10:45:50 UTC, Atila Neves wrote: On Thursday, 22 March 2018 at 00:24:34 UTC, Seb wrote: On Wednesday, 21 March 2018 at 23:46:19 UTC, jmh530 wrote: [...] For reference, I think jmh530 was referring to this: https://github.com/atilaneves/include That's the one. It's nearly ready to announce (although even by then there will be a lt of work to do afterwards). Sneak peek, this works right now (yes, what's shown is, except for the #include directives, D code): #include "nanomsg/nn.h" #include "nanomsg/pubsub.h" void main() { const sock = nn_socket (AF_SP, NN_PUB); scope(exit) nn_close(sock); } As for the how/what/why/WTF/etc, stay tuned. Atila Just out of sheer curiosity, will I be able to #include or ?
-betterC is amazing, make (/keep making) it more sophisticated!
I've been playing with D for a while. I usually write/maintain/contribute to C and C++ applications for *nix. D is low key amazing, it has - C standard library in the standard - continually improving betterC idioms - built in version blocks, unit test and debug blocks - painless doc gen - modules and painless dependency handling - linter, formatting tool and suggestion tool independent of editors Now if D manages all of the following it's going to be even better: - complete porting the C99 compliant C compiler fornt end to the D compiler so you can seamlessly just import C headers (like C++) - Improve shared library support Don't know about other C programmers but if D grants me to write C with modules, doc gen and dep handling, I can switch any day! But I need to be able to use tons of C libraries without having to writing wrappers for them. Thank you.
Shouldn't invalid references like this fail at compile time?
I was asked in Reddit (https://www.reddit.com/r/learnprogramming/comments/7ru82l/i_was_thinking_of_using_d_haxe_or_another/) how would D handle the following similar D code. I'm surprised that both dmd and ldc provides no warnings even with -w argument passed. import std.stdio; void main() { string foo = "foo"; string* p1, p2; string*[] ls; ls ~= p1 = ls[0]; ls.destroy(); p2 = ls[0]; writeln(p2); }
Re: D easily overlooked?
On Saturday, 22 July 2017 at 14:20:24 UTC, Russel Winder wrote: On Sat, 2017-07-22 at 13:27 +, aedt via Digitalmars-d wrote: […] D without the GC isn't at all interesting, might as well use Go in that case. So D only gets traction if it keeps a GC. Go people are also trying to make their GC pretty fast afaik https://news.ycombinator.com/item?id=12821586
Re: D easily overlooked?
On Friday, 14 July 2017 at 08:57:17 UTC, Wulfklaue wrote: https://blog.sourced.tech/post/language_migrations/ A recent article where github programming languages popularity and migration got analysed was very interesting but it showed one noticeable thing: [...] Unless some miracle happens and makes the GC better by preventing stop-the-world, or gets rid of the GC, D will not get any more attention.
New Garbage Collector?
In the forum, I saw a thread about someone working on a new GC. Just wanted to know if there's any updates on that. And what issues is it going to fix.. Personally, I would be greatly delighted if it acknowledges the Stop-The-World problem[1]. Going around it is shown not to be impossible[2]. I do understand it's not trivial task but how is the community/core devs supporting this? [1] https://dlang.org/spec/garbage.html [2] https://hub.docker.com/r/nimlang/nim/