digitalmars.D.announce - Idioms for the D programming language
- Walter Bright (5/5) Feb 11 2021 Now #5 on the front page of https://news.ycombinator.com/news
- H. S. Teoh (45/47) Feb 11 2021 Not bad, but it seems to be missing some of the newer idioms.
- Guillaume Piolat (4/8) Feb 12 2021 It's because I lack the time to update it. It was always a page
- Imperatorn (5/14) Feb 12 2021 For someone coming to D today, would you say most of the content
- Guillaume Piolat (3/19) Feb 12 2021 It's mostly valid, but it lacks about fifty new articles that
- Guillaume Piolat (6/8) Feb 12 2021 Also keep in mind it's not a structured learning resource, it was
- TheGag96 (5/14) Feb 12 2021 I'd love if you'd pick up again. Years ago, when it was a bit
- James Lu (14/15) Feb 11 2021 I've gotten Dlang to the frontpage of HN 3 other times:
- Walter Bright (3/19) Feb 12 2021 Yes, having the author do an AMA is very productive.
- Guillaume Piolat (2/3) Feb 12 2021 I'm literally busy writing D!
- James Lu (5/26) Feb 13 2021 I once resubmitted with an AMA-style comment, which was the
- Walter Bright (9/12) Feb 14 2021 Yup.
- James Lu (9/15) Feb 13 2021 I wanted to add: What I do is I take a post that could be
- Imperatorn (3/8) Feb 11 2021 đ
- James Lu (10/15) Feb 13 2021 A question for you: What is the most interesting (shows the
- Imperatorn (8/27) Feb 13 2021 "readable by a beginner" && "interesting and substantial
- James Lu (2/9) Feb 14 2021 Frontend, to show the language.
- Bruce Carneal (8/18) Feb 14 2021 If you are looking for high level understanding of a D front end
https://news.ycombinator.com/news The page being discussed: https://p0nce.github.io/d-idioms/ and on reddit: https://www.reddit.com/r/programming/comments/lhssjp/idioms_for_the_d_programming_language/
Feb 11 2021
On Thu, Feb 11, 2021 at 12:12:36PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...]https://p0nce.github.io/d-idioms/Not bad, but it seems to be missing some of the newer idioms. Like the templated static this trick for transparently encoding compile-time information at runtime. For example: import std.regex; void main(string[] args) { foreach (arg; args) { if (arg.match(Re!`some.*regex(pattern)+`)) { ... // do something } } } template Re(string reStr) { Regex!char re; static struct Impl { static this() { re = regex(reStr); } } string Re() { return re; } } The Re template captures the regex string at compile-time and injects it into Impl's static this(), which compiles the regex at program startup at runtime, then the eponymous function Re() simply returns the precompiled value. The result: - Regexes are automatically picked up at compile-time; - But expensive compile-time generation of the regex (which consumes lots of compiler memory and slows down compilation) is skipped; - Compilation of the regex happens only once upon program startup and cached, and thereafter is a simple global variable lookup. - Multiple occurrences of the Re template with the same regex is automatically merged (because it's the same instantiation of the template). D features used: - compile-time string parameters - static this() - eponymous templates - reuse of template instantiations that have the same arguments [...]https://www.reddit.com/r/programming/comments/lhssjp/idioms_for_the_d_programming_language/There doesn't appear to be any discussion happening here. T -- If it breaks, you get to keep both pieces. -- Software disclaimer notice
Feb 11 2021
On Friday, 12 February 2021 at 00:26:09 UTC, H. S. Teoh wrote:On Thu, Feb 11, 2021 at 12:12:36PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...]It's because I lack the time to update it. It was always a page to let _me_ understand the language better, and then I got to a point where I wasn't following the D development enough.https://p0nce.github.io/d-idioms/Not bad, but it seems to be missing some of the newer idioms.
Feb 12 2021
On Friday, 12 February 2021 at 11:19:26 UTC, Guillaume Piolat wrote:On Friday, 12 February 2021 at 00:26:09 UTC, H. S. Teoh wrote:For someone coming to D today, would you say most of the content there is still valid? ThanksOn Thu, Feb 11, 2021 at 12:12:36PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...]It's because I lack the time to update it. It was always a page to let _me_ understand the language better, and then I got to a point where I wasn't following the D development enough.https://p0nce.github.io/d-idioms/Not bad, but it seems to be missing some of the newer idioms.
Feb 12 2021
On Friday, 12 February 2021 at 11:44:31 UTC, Imperatorn wrote:On Friday, 12 February 2021 at 11:19:26 UTC, Guillaume Piolat wrote:It's mostly valid, but it lacks about fifty new articles that would need to be added.On Friday, 12 February 2021 at 00:26:09 UTC, H. S. Teoh wrote:For someone coming to D today, would you say most of the content there is still valid? ThanksOn Thu, Feb 11, 2021 at 12:12:36PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...]It's because I lack the time to update it. It was always a page to let _me_ understand the language better, and then I got to a point where I wasn't following the D development enough.https://p0nce.github.io/d-idioms/Not bad, but it seems to be missing some of the newer idioms.
Feb 12 2021
On Friday, 12 February 2021 at 12:25:32 UTC, Guillaume Piolat wrote:It's mostly valid, but it lacks about fifty new articles that would need to be added.Also keep in mind it's not a structured learning resource, it was all about emphasizing this or that particular and rarely needed aspect of D and edge cases. Which I think a few of us have been fond of at one point.
Feb 12 2021
On Friday, 12 February 2021 at 11:19:26 UTC, Guillaume Piolat wrote:On Friday, 12 February 2021 at 00:26:09 UTC, H. S. Teoh wrote:I'd love if you'd pick up again. Years ago, when it was a bit more active, I'd check it all the time. I've learned a lot from the page. Thanks for all your work on it!On Thu, Feb 11, 2021 at 12:12:36PM -0800, Walter Bright via Digitalmars-d-announce wrote: [...]It's because I lack the time to update it. It was always a page to let _me_ understand the language better, and then I got to a point where I wasn't following the D development enough.https://p0nce.github.io/d-idioms/Not bad, but it seems to be missing some of the newer idioms.
Feb 12 2021
On Thursday, 11 February 2021 at 20:12:36 UTC, Walter Bright wrote:https://news.ycombinator.com/newsI've gotten Dlang to the frontpage of HN 3 other times: Specification for the D Programming Language https://news.ycombinator.com/item?id=21993208 D 2.0.93.0 https://news.ycombinator.com/item?id=23859448 Ask HN: Why do you use Rust, when D is available? https://news.ycombinator.com/item?id=23494490 If you have any particularly interesting and specific pages on D, feel free to send them to me, so I can post them to HN at the optimal time. (Furthermore, if you authored it, you should a comment that explains why you made it and offering to answer questionsâ I have found this can turn a regular post into a frontpage post.)
Feb 11 2021
On 2/11/2021 5:53 PM, James Lu wrote:On Thursday, 11 February 2021 at 20:12:36 UTC, Walter Bright wrote:Thank you!https://news.ycombinator.com/newsI've gotten Dlang to the frontpage of HN 3 other times: Specification for the D Programming Language https://news.ycombinator.com/item?id=21993208 D 2.0.93.0 https://news.ycombinator.com/item?id=23859448 Ask HN: Why do you use Rust, when D is available? https://news.ycombinator.com/item?id=23494490If you have any particularly interesting and specific pages on D, feel free to send them to me, so I can post them to HN at the optimal time. (Furthermore, if you authored it, you should a comment that explains why you made it and offering to answer questionsâ I have found this can turn a regular post into a frontpage post.)Yes, having the author do an AMA is very productive.
Feb 12 2021
On Friday, 12 February 2021 at 08:31:13 UTC, Walter Bright wrote:Yes, having the author do an AMA is very productive.I'm literally busy writing D!
Feb 12 2021
On Friday, 12 February 2021 at 08:31:13 UTC, Walter Bright wrote:On 2/11/2021 5:53 PM, James Lu wrote:Thanks for the kind words :)On Thursday, 11 February 2021 at 20:12:36 UTC, Walter Bright wrote:Thank you!https://news.ycombinator.com/newsI've gotten Dlang to the frontpage of HN 3 other times: Specification for the D Programming Language https://news.ycombinator.com/item?id=21993208 D 2.0.93.0 https://news.ycombinator.com/item?id=23859448 Ask HN: Why do you use Rust, when D is available? https://news.ycombinator.com/item?id=23494490I once resubmitted with an AMA-style comment, which was the difference between getting 12 points and not getting on the frontpage, and getting on the frontpage with 158 points.If you have any particularly interesting and specific pages on D, feel free to send them to me, so I can post them to HN at the optimal time. (Furthermore, if you authored it, you should a comment that explains why you made it and offering to answer questionsâ I have found this can turn a regular post into a frontpage post.)Yes, having the author do an AMA is very productive.
Feb 13 2021
On 2/13/2021 7:57 AM, James Lu wrote:I once resubmitted with an AMA-style comment, which was the difference between getting 12 points and not getting on the frontpage, and getting on the frontpage with 158 points.Yup. Another critical thing is to make the first post. The first post has a strong tendency to set the tone for the entire topic. The first post should be a brief synopsis of what the article is about, said in a positive manner. Leaving this to chance has led too many times to having a topic essentially sabotaged by someone making a first post that is strongly negative. The topic never recovers. Always always when submitting a link, make the first post.
Feb 14 2021
On Friday, 12 February 2021 at 01:53:25 UTC, James Lu wrote:If you have any particularly interesting and specific pages on D, feel free to send them to me, so I can post them to HN at the optimal time. (Furthermore, if you authored it, you should a comment that explains why you made it and offering to answer questionsâ I have found this can turn a regular post into a frontpage post.)I wanted to add: What I do is I take a post that could be submitted to Hacker News, then I am an "optimizing compiler" for it. I post at 3pm on Monday through Thursday, add comments, tune the submission title, and various small HN-specific optimizationsâ my submissions have been on its frontpage 20 times, I know what I'm doing.
Feb 13 2021
On Thursday, 11 February 2021 at 20:12:36 UTC, Walter Bright wrote:https://news.ycombinator.com/news The page being discussed: https://p0nce.github.io/d-idioms/ and on reddit: https://www.reddit.com/r/programming/comments/lhssjp/idioms_for_the_d_programming_language/đ
Feb 11 2021
On Thursday, 11 February 2021 at 20:12:36 UTC, Walter Bright wrote:https://news.ycombinator.com/news The page being discussed: https://p0nce.github.io/d-idioms/ and on reddit: https://www.reddit.com/r/programming/comments/lhssjp/idioms_for_the_d_programming_language/A question for you: What is the most interesting (shows the language) and beginner-friendly source code file of DMD? I want to link to the compiler source to do that. It needs to be readable by a beginner, yet also provide interesting and substantial information on how D or compilers work. * Demonstrate DMD is open-source * Get DLang more attention * Demonstrate how good DMDFE is
Feb 13 2021
On Saturday, 13 February 2021 at 16:06:31 UTC, James Lu wrote:On Thursday, 11 February 2021 at 20:12:36 UTC, Walter Bright wrote:"readable by a beginner" && "interesting and substantial information" might be hard to find. Did you mean front- or backend? If you want to show compiler u might look at https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d for example. But I think it might be better to begin with some kind of overview so you understand what you're looking at đ˘https://news.ycombinator.com/news The page being discussed: https://p0nce.github.io/d-idioms/ and on reddit: https://www.reddit.com/r/programming/comments/lhssjp/idioms_for_the_d_programming_language/A question for you: What is the most interesting (shows the language) and beginner-friendly source code file of DMD? I want to link to the compiler source to do that. It needs to be readable by a beginner, yet also provide interesting and substantial information on how D or compilers work. * Demonstrate DMD is open-source * Get DLang more attention * Demonstrate how good DMDFE is
Feb 13 2021
On Saturday, 13 February 2021 at 16:39:12 UTC, Imperatorn wrote:On Saturday, 13 February 2021 at 16:06:31 UTC, James Lu wrote:Frontend, to show the language.[...]"readable by a beginner" && "interesting and substantial information" might be hard to find. Did you mean front- or backend? If you want to show compiler u might look at https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d for example.
Feb 14 2021
On Sunday, 14 February 2021 at 17:56:00 UTC, James Lu wrote:On Saturday, 13 February 2021 at 16:39:12 UTC, Imperatorn wrote:If you are looking for high level understanding of a D front end https://github.com/SDC-Developers/SDC might help, either standalone or as a supplement to your DMD readings. On the minus side, SDC is a hibernating prototype. On the plus side, SDC employs a strong architecture that factors out many of the dependency issues facing DMD. What remains is very readable.On Saturday, 13 February 2021 at 16:06:31 UTC, James Lu wrote:Frontend, to show the language.[...]"readable by a beginner" && "interesting and substantial information" might be hard to find. Did you mean front- or backend? If you want to show compiler u might look at https://github.com/dlang/dmd/blob/master/src/dmd/compiler.d for example.
Feb 14 2021