digitalmars.D.announce - The Expressive C++17 Coding Challenge in D
- Seb (6/6) Feb 13 2018 Someone revived the Expressive C++17 Coding Challenge thread
- =?UTF-8?Q?Ali_=c3=87ehreli?= (4/12) Feb 13 2018 This topic appeared on Learn a few months ago:
- psychoticRabbit (4/11) Feb 13 2018 What a great article!
- ketmar (6/12) Feb 13 2018 a typo:
- Seb (5/20) Feb 13 2018 Thanks!
- jmh530 (2/9) Feb 13 2018 Typo with "(~200 LoC)" and "> 300 LoCs"?
- Seb (2/13) Feb 13 2018 Fixed. Thanks!
- Arun Chandrasekaran (8/15) Feb 13 2018 It takes a lot of time and effort to write such quality content.
- Seb (23/30) Feb 13 2018 Thanks :)
- Nicholas Wilson (2/9) Feb 13 2018 Cool! The contrast of the code is very low (very on light brown?),
- Seb (3/15) Feb 13 2018 Thanks for the feedback. Fixed!
- Mike Franklin (6/18) Feb 14 2018 Nice work! I was recently asked by my employer "why D?". I
- Seb (3/21) Feb 14 2018 Good point. I tried to address this and changed the text to:
- Dukc (2/5) Feb 14 2018 Great!
- Simen =?UTF-8?B?S2rDpnLDpXM=?= (12/26) Feb 14 2018 Nice! Good overview of many of the good things in D.
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (5/12) Feb 14 2018 Sadly, he just picked the solution that used most C++17 features
- drug (3/18) Feb 14 2018 It's sadly that using most C++17 features fails to provide clean and
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (7/9) Feb 14 2018 I don't usually use iostream, but this "challenge" was a
- psychoticRabbit (4/23) Feb 14 2018 yeah.. even the more modern C++ code still makes me want to stay
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (30/33) Feb 14 2018 I get the same feeling from both languages, to be honest.
- psychoticRabbit (16/18) Feb 14 2018 Because it doesn't get enough criticism ;-)
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (17/28) Feb 14 2018 Yes, I would say so, unless they bring something new to the table
- Arredondo (8/15) Feb 14 2018 Down in the 'Other cool D features' you have:
- Russel Winder (12/21) Feb 14 2018 Seb,
- Seb (5/8) Feb 14 2018 Cool idea, but I'm not so familiar with these. What can/should I
- Russel Winder (17/27) Feb 14 2018 For the email list record, CVu and Overload are the ACCU journals.
- Martin Tschierschke (19/28) Feb 14 2018 Very nice read!!! Thank you!
- Dukc (18/22) Feb 14 2018 I first looked into C++ and Rust examples, just quickly without
- John Gabriele (25/32) Feb 14 2018 Great article! Thank you!
- Seb (9/34) Feb 14 2018 Thanks for the typos. Fixed them.
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (15/17) Feb 14 2018 Yes and no. The problem with all these exercises is that they
- Jacob Carlborg (5/9) Feb 14 2018 For a fair comparison Swift should only use libraries that are available...
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (12/15) Feb 14 2018 Are any projects using Swift outside of the Mac eco system?
- bachmeier (4/11) Feb 14 2018 Someone posted a comment in our subreddit that you may want to
- Seb (5/18) Feb 14 2018 Thanks a lot for the ping!
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (2/3) Feb 14 2018 It is getting shot down…
- bachmeier (4/7) Feb 14 2018 That's implied when someone says it's posted on Reddit.
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (7/8) Feb 14 2018 Programming languages and operating systems have a long history
- Walter Bright (2/10) Feb 14 2018 Very nice article, you write well!
- Steven Schveighoffer (32/40) Feb 15 2018 Nice article!
- Seb (10/23) Feb 15 2018 Thanks!
- Steven Schveighoffer (19/24) Feb 15 2018 eh...
- aberba (3/10) Feb 15 2018 Very well written. Nice read. I recommend you write more these
Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.
Feb 13 2018
On 02/13/2018 03:35 PM, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.This topic appeared on Learn a few months ago: https://forum.dlang.org/post/or0o85$tvc$1 digitalmars.com Ali
Feb 13 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.What a great article! I love the depth of explanation too, that really makes it worthwhile reading.
Feb 13 2018
Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.a typo: writefln!"%d"(foo"); it should be `"foo"`, i guess. ;-) great article. now i want to learn D again, it looks so beautiful and powerful! ;-)
Feb 13 2018
On Wednesday, 14 February 2018 at 02:57:28 UTC, ketmar wrote:Seb wrote:Fixed. Thanks!Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.a typo: writefln!"%d"(foo"); it should be `"foo"`, i guess. ;-)great article. now i want to learn D again, it looks so beautiful and powerful! ;-)Thanks! Well, you could upstream your fork and go back to "pure" D again ;-)
Feb 13 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Typo with "(~200 LoC)" and "> 300 LoCs"?
Feb 13 2018
On Wednesday, 14 February 2018 at 03:40:41 UTC, jmh530 wrote:On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Fixed. Thanks!Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Typo with "(~200 LoC)" and "> 300 LoCs"?
Feb 13 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.It takes a lot of time and effort to write such quality content. Thanks for detailed explanations. // import std.algorithm, std.exception, std.format, std.range, std.stdio; Do you think it is worth mentioning about std.experimental.scripting in section 2? Syntax highlighting is missing in some snippets.
Feb 13 2018
On Wednesday, 14 February 2018 at 06:42:23 UTC, Arun Chandrasekaran wrote:It takes a lot of time and effort to write such quality content. Thanks for detailed explanations.Thanks :) Now if we had a magic automaton that makes more of these ...// import std.algorithm, std.exception, std.format, std.range, std.stdio; Do you think it is worth mentioning about std.experimental.scripting in section 2?Well, it hasn't been released yet, but maybe I get around writing another article ;-) Also looking at the C++ "competitor", I think we aren't too bad off with a few modules for now: --- #include <algorithm> #include <experimental/filesystem> #include <fstream> #include <iostream> #include <optional> #include <string> #include <string_view> #include <sstream> #include <utility> #include <vector> using namespace std; namespace fs = std::experimental::filesystem; ---Syntax highlighting is missing in some snippets.Thanks for the pointer. Fixed!
Feb 13 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Cool! The contrast of the code is very low (very on light brown?),
Feb 13 2018
On Wednesday, 14 February 2018 at 07:11:08 UTC, Nicholas Wilson wrote:On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Thanks for the feedback. Fixed!Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Cool! The contrast of the code is very low (very on light brown?),
Feb 13 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Nice work! I was recently asked by my employer "why D?". I think I need to show them this.Aren’t you concered that Rust is faster in this benchmark?Not at all. The challenge was to write expressive code and if performance really matters I can always opt to optimize the hot path of the program and don’t need to pay a > 4x code duplication cost upfront.You've gotta address this, IMO. What's the performance/expressiveness tradeoff like in D? Mike
Feb 14 2018
On Wednesday, 14 February 2018 at 08:06:13 UTC, Mike Franklin wrote:Good point. I tried to address this and changed the text to:Aren’t you concered that Rust is faster in this benchmark?Not at all. The challenge was to write expressive code and if performance really matters I can always opt to optimize the hot path of the program and don’t need to pay a > 4x code duplication cost upfront.You've gotta address this, IMO. What's the performance/expressiveness tradeoff like in D? MikeNot at all. The challenge was to write expressive code. When performance really matters D provides the same tools as C or C++ and D even supports native interoperability with C and most of C++.In this example, however, I/O is the bottleneck and D provides a few convenience features like using locked file handles, s.t. accessing files is thread-safe by default, or supporting unicode input. However, it’s easy to opt out of such productivity features and for the interested readers I have attached a slightly optimized version at the end.
Feb 14 2018
On Wednesday, 14 February 2018 at 14:17:31 UTC, Seb wrote:changed the text to:Great!...and D even supports native interoperability with C and most of C++.
Feb 14 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Nice! Good overview of many of the good things in D. Nitpicks:I used the following rdmd script to generate a simple CSV file with 10 fields and 10m lines: rdmd --eval='10.iota.map!(a=> "field".text(a)).join(",") .repeat(10_00_000).joiner("\n").writeln' > input_big.csv10_00_000 should probably be 10_000_000.They are only view on the actual memory and you don’t copy the array, but just the view on (in D it’s called a slice).Missing some words here: "only *a* view". "but just the view on" seems to be missing the second half of the sentence. There's also a few typos: 'vauge' should be 'vague', 'it providers' should be 'it provides', 'shot yourself in the feet' should probably be 'shoot yourself in the foot' Thanks for writing all this - it's a great intro to the language. -- Sien
Feb 14 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Sadly, he just picked the solution that used most C++17 features and not one that was clean and compact... :-/ I guess the point was to create a C++17 tutorial, and not a coding contest as such.
Feb 14 2018
14.02.2018 11:45, Ola Fosheim Grøstad пишет:On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:It's sadly that using most C++17 features fails to provide clean and compact solution...Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Sadly, he just picked the solution that used most C++17 features and not one that was clean and compact... :-/ I guess the point was to create a C++17 tutorial, and not a coding contest as such.
Feb 14 2018
On Wednesday, 14 February 2018 at 08:53:31 UTC, drug wrote:It's sadly that using most C++17 features fails to provide clean and compact solution...I don't usually use iostream, but this "challenge" was a reasonable fit for it. If you look over the 4 submissions then the iostream one provides the best encapsulation of the problem: http://coliru.stacked-crooked.com/a/4675a74c8124750f C++ blogposts tend to choke on features... usually not good examples of maintainable code.
Feb 14 2018
On Wednesday, 14 February 2018 at 08:53:31 UTC, drug wrote:14.02.2018 11:45, Ola Fosheim Grøstad пишет:yeah.. even the more modern C++ code still makes me want to stay clear of it...(perhaps even more so). I just never get the same feeling when I look at D programs.On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:It's sadly that using most C++17 features fails to provide clean and compact solution...Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Sadly, he just picked the solution that used most C++17 features and not one that was clean and compact... :-/ I guess the point was to create a C++17 tutorial, and not a coding contest as such.
Feb 14 2018
On Wednesday, 14 February 2018 at 09:28:48 UTC, psychoticRabbit wrote:yeah.. even the more modern C++ code still makes me want to stay clear of it...(perhaps even more so). I just never get the same feeling when I look at D programs.I get the same feeling from both languages, to be honest. Average library code for both languages are harder to read than I think should be the norm (granted Python libs can also be somewhat hard to read, but still much easier on average). Both languages are easier to read when you spend time with them yourself, obviously. Both languages are easier to read when the programmer has been conservative in his/her use of features. This situation is what happens when you add features at a high rate in the early years and don't want to clean up because of backwards compatibility. C++ has been at it for longer and are adding more features at a higher rate than D... so C++ becomes harder and harder to master if you read other people's arbitrary code. That doesn't mean D shouldn't clean up... I'd say it is necessary to get ahead. For both languages you can always stick to your own idioms and write cleaner code than you see on github, and blog posts tend to be feature-show-offs (surprisingly often written by people who don't write a lot of code in the language they are posting about) so I don't think blogs are the right measure. Look at large code bases that are in widespread use to get an idea of what happens over time in terms of maintainability. Anyway, C++ at this point has slightly better lambdas than D and D will notice the competition if C++ ends up adding stackless coroutines (e.g. Python like generators). Not a big discrepancy in features at this point, but C++ is moving at a higher rate... and that should be a concern if C++ is viewed as a competitor. If C++ isn't viewed as a competitor, why bother with repetitive complaining about C++?
Feb 14 2018
On Wednesday, 14 February 2018 at 09:50:31 UTC, Ola Fosheim Grøstad wrote:If C++ isn't viewed as a competitor, why bother with repetitive complaining about C++?Because it doesn't get enough criticism ;-) I believe the programming langauges of the future, and the ones people should invest their time learning, are those that can be best understood in the least amount of time. This is because programs are getting larger and more complex, and to understand them at all, they have to be simple to understand. C++ is not simple. It never has been. The so called 'modernisation' of it is not helping me to change my mind about it ;-) And chances are, when you go to work in some C++ environment, you'll have to deal with lots of legacy style code - which you will be expected to understand as well. It's time to stop 'improving' C++ and redesign it from scratch - or move to D.
Feb 14 2018
On Wednesday, 14 February 2018 at 10:17:21 UTC, psychoticRabbit wrote:I believe the programming langauges of the future, and the ones people should invest their time learning, are those that can be best understood in the least amount of time.Yes, I would say so, unless they bring something new to the table like formal verification (proven correctness) or some kind of expert system geared towards a set of common domains (e.g. data flow).This is because programs are getting larger and more complex, and to understand them at all, they have to be simple to understand.Right, so which is an argument in favour of agent based systems. Kind of the direction that has happened on the server side with micro services.C++ is not simple. It never has been. The so called 'modernisation' of it is not helping me to change my mind about it ;-)Right, because, even though C was simple, it isn't simple to debug, so C++ has all that + a wide variety of overlapping features. So C++ cannot become simple.It's time to stop 'improving' C++ and redesign it from scratch - or move to D.Well, yes, but then D needs to make a case for itself and do a reset so that the disadvantages in switching is offset by the advantages. Either that or some other language will squeeze in, which is ok too. I don't care who does it, could even be Rust if they add some features, but it should happen. Right.
Feb 14 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Down in the 'Other cool D features' you have: * Inline documentation * Contracts ... * Built-in documentation * Contracts and invariants Nice read!
Feb 14 2018
Seb, I believe this blog post would make a great article for Overload or CVu. On Tue, 2018-02-13 at 23:35 +0000, Seb via Digitalmars-d-announce wrote:Someone revived the Expressive C++17 Coding Challenge thread=20 today and I thought this is an excellent opportunity to revive my=20 blog and finally write an article showing why I like D so much: =20 https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-i n-d =20 It's mostly targeted at beginners as I explain many basic D=20 features, but maybe it's helpful for beginners looking into D.--=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk
Feb 14 2018
On Wednesday, 14 February 2018 at 09:42:47 UTC, Russel Winder wrote:Seb, I believe this blog post would make a great article for Overload or CVu.Cool idea, but I'm not so familiar with these. What can/should I do to make this happen? We can also talk in private (seb [at] wilzba [dot] ch).
Feb 14 2018
On Wed, 2018-02-14 at 13:21 +0000, Seb via Digitalmars-d-announce wrote:On Wednesday, 14 February 2018 at 09:42:47 UTC, Russel Winder=20 wrote:For the email list record, CVu and Overload are the ACCU journals. Historically Overload has been a C++ language, tools, and techniques vehicle put is now adding detailed technical articles on other languages. CVu has anything else, including some technical stuff. https://accu.org/index.php/journal Seb and I have started a personal email exchange and I am getting the editors of said journals involved. =20 --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Road m: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.ukSeb, =20 I believe this blog post would make a great article for=20 Overload or CVu.=20 Cool idea, but I'm not so familiar with these. What can/should I=20 do to make this happen? We can also talk in private (seb [at] wilzba [dot] ch).
Feb 14 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Very nice read!!! Thank you! One "typo?" Chapter 8)same format function that would normally be called at compile-times/compile/run/ It would be good to say a little more about the '!' ct-parameter At fist when reading D code coming from ruby (after, php,...C++,C, Pascal...), I thought, that the ! is like in Ruby just an way to distinguish between a function modifying the contend or not (compare gsub to gsub!) it took sometime before this important bit came clear to me. So just something, like functions in D may have two parameter brackets: One for compile-time and one for run-time parameters: fun!(ctParam)(rtParam) ... short fun!(cParam)() ... fun!ctparam Other point: Showing some more alternative D solutions for the same problem, might be a little contest in this thread, just post your shorter and better solutions :-)
Feb 14 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so muchI first looked into C++ and Rust examples, just quickly without thinking them deeply. I thought that wow, the problem is probably more complicated than it looks. Seems to need many functions to solve eleganty. Then when I saw your example I, of course, concluded that the problem is as simple as it seems. I would really have excepted C++ or at least Rust to come close to D, perhaps even achieve the same LoC count with a bit of luck. Excellent article all-in-all, because it shown so many D features in a compact AND realistic way. I think a good D programmer might well write programs in that style for everyday use, not just for show. If someone asks "what would then be an unrealistic program then" it would be one that excessively uses introspection. One improvement proposal: in the "Other features" part, you mention full compatibility with c. I think you should add "and with most of c++" because it might be a killer feature for some potential users.
Feb 14 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Great article! Thank you! Typo: "and finally format bundles" --> "and finally std.format bundles". Another typo: "In the latter article I will also present a solution which only uses 12 lines, but it uses the built-in std.csv module and I think D doesn’t even need to cheat." should probably instead start "Later in this article I'll also present..." or "Further down I'll also present". But even then, I don't think you should discount or put off using std.csv as "cheating". I'm guessing std.csv handles things like quoted elements containing commas. I realize that maybe you're being pedagogic and wanting to show off D's File byLine and splitter, but I think the first thing a reader will think when they see you rolling your own csv reader by hand is that something must be wrong with D or it's ecosystem if you're resorting to this, and they'll run for the hills (especially in an intro article, *and* one in which you point out that the goal is *expressive* code). In fact, I'd go so far as to say that, when searching online for how to read in a csv file for a given language (see many examples at <http://rosettacode.org/wiki/CSV_data_manipulation>), if the example involves splitting on commas, I immediately assume it's either old/incorrect, the language is very low-level only, or else maybe the language's std lib must be impoverished.
Feb 14 2018
On Wednesday, 14 February 2018 at 17:13:28 UTC, John Gabriele wrote:On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Thanks for the typos. Fixed them.Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Great article! Thank you!But even then, I don't think you should discount or put off using std.csv as "cheating". I'm guessing std.csv handles things like quoted elements containing commas.Yes.I realize that maybe you're being pedagogic and wanting to show off D's File byLine and splitter,Yes.but I think the first thing a reader will think when they see you rolling your own csv reader by hand is that something must be wrong with D or it's ecosystem if you're resorting to this, and they'll run for the hills (especially in an intro article, *and* one in which you point out that the goal is *expressive* code).Understood. Fair point. I changed the motivation of why std.csv isn't used and added a warning that one shouldn't roll one's own CSV parser.I immediately assume it's either old/incorrect, the language is very low-level only, or else maybe the language's std lib must be impoverished.Haha. This could be Rust's or C++'s new slogan ;-)
Feb 14 2018
On Wednesday, 14 February 2018 at 17:13:28 UTC, John Gabriele wrote:But even then, I don't think you should discount or put off using std.csv as "cheating".Yes and no. The problem with all these exercises is that they say nothing about the language and a lot about some default library, which isn't particularly revealing. For instance, Swift drags in all of Os-X on the default platform, so writing an audio/video loader would be relatively short in comparison to other languages. Would that be fair or instructive? Of course not. The Os-X libraries are quite massive. Anyway, these kinds of exercises are only impressive for people looking for an alternative to scripting... For general system programming you need to show off the language and not the esoteric features of the standard library. Basically show off how it can deal with a task it has not been designed for. Which is the typical use scenario.
Feb 14 2018
On 2018-02-14 19:00, Ola Fosheim Grøstad wrote:For instance, Swift drags in all of Os-X on the default platform, so writing an audio/video loader would be relatively short in comparison to other languages. Would that be fair or instructive? Of course not. The Os-X libraries are quite massive.For a fair comparison Swift should only use libraries that are available both on macOS and Linux. -- /Jacob Carlborg
Feb 14 2018
On Wednesday, 14 February 2018 at 18:33:33 UTC, Jacob Carlborg wrote:On 2018-02-14 19:00, Ola Fosheim Grøstad wrote: For a fair comparison Swift should only use libraries that are available both on macOS and Linux.Are any projects using Swift outside of the Mac eco system? Would it be more fair if Swift was Mac only? (re Visual Basic) Would you include React when evaluating Javascript and Angular4 when evaluating TypeScript? Why should a standard library be evaluated differently from any other library? That's more the issue. If the standard library for one language ensure better interop between third party libraries, then it becomes significant, but if it is an independent feature then I see no difference between standard library and third party library.
Feb 14 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Someone posted a comment in our subreddit that you may want to check: https://www.reddit.com/r/d_language/comments/7xi9n3/the_expressive_c17_coding_challenge_in_d/
Feb 14 2018
On Wednesday, 14 February 2018 at 18:55:23 UTC, bachmeier wrote:On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Thanks a lot for the ping! Someone posted it also to /r/programming - it's on the second place as of now: https://www.reddit.com/r/programming/comments/7xih66/the_expressive_c17_coding_challenge_in_dSomeone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Someone posted a comment in our subreddit that you may want to check: https://www.reddit.com/r/d_language/comments/7xi9n3/the_expressive_c17_coding_challenge_in_d/
Feb 14 2018
On Wednesday, 14 February 2018 at 19:40:12 UTC, Seb wrote:https://www.reddit.com/r/programming/comments/7xih66/the_expressive_c17_coding_challenge_in_dIt is getting shot down…
Feb 14 2018
On Wednesday, 14 February 2018 at 20:14:41 UTC, Ola Fosheim Grøstad wrote:On Wednesday, 14 February 2018 at 19:40:12 UTC, Seb wrote:That's implied when someone says it's posted on Reddit. There's (almost) no such thing as bad publicity...https://www.reddit.com/r/programming/comments/7xih66/the_expressive_c17_coding_challenge_in_dIt is getting shot down…
Feb 14 2018
On Wednesday, 14 February 2018 at 20:37:24 UTC, bachmeier wrote:There's (almost) no such thing as bad publicity...Programming languages and operating systems have a long history of hot advocacy... not sure how it relates to adoption, but it affects perception. E.g. vocal mac users gave the mac a certain (not so great) reputation in tech circles. I don't think that perception changed till iOs and mac mini.
Feb 14 2018
On 2/13/2018 3:35 PM, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Very nice article, you write well!
Feb 14 2018
On 2/13/18 6:35 PM, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Nice article! Typos and Grammar: " How often how you encountered code like a + b" How often have --- "Yes, the D compiler does all the hard work for." for you --- "In short: the compiler does a few smart lowering for you" lowerings --- "Yes D is statically typed, but the compiler is pretty smart, so we can let him do all the hard for for us." hard work "auto is a filler word for the compiler that means “whatever the type of the assignment, use this as type of this variable”." the type --- "Okay to recap, we have taken the input of a file by line, splitted every line by commas" splitting --- This part is slightly incorrect: " Isn’t this done before the enforce is called? No, lazy is lazy and the string concatenation doesn’t happen at the caller site, but can be requested explicitly by the callee." Technically, the concatenation is done at compile-time, which can be seen via AST: https://run.dlang.io/is/OVKxee But normally, if the concatenation involved runtime strings, it would be done lazily. -Steve
Feb 15 2018
On Thursday, 15 February 2018 at 16:22:17 UTC, Steven Schveighoffer wrote:On 2/13/18 6:35 PM, Seb wrote:Thanks!Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Nice article!Typos and Grammar:Thanks a lot! Yeah I shouldn't have published it directly after writing it...This part is slightly incorrect:Good point! Thanks. I reworded the entire paragraph and it now shows the AST: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d/#4-whats-up-with-this-enforce My idea was that we have this subtextual message: "look, D isn't complicated and we can always look behind the scenes".
Feb 15 2018
On 2/15/18 2:11 PM, Seb wrote:I reworded the entire paragraph and it now shows the AST: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d/#4-whats- p-with-this-enforceeh... "string which is an alias for an array of const(char) elements" It's not actually, it's an array of immutable(char) elements. But I think the reason we see const(char)[] delegate and not immutable(char)[] delegate, is that enforce's actual signature is: T enforce(E : Throwable = Exception, T)(T value, lazy const(char)[] msg = null, string file = __FILE__, size_t line = __LINE__) Not lazy string as you originally said. https://dlang.org/phobos/std_exception.html#.enforce In fact, you can see "string" output by the AST generator in other places (e.g. void main(string[] args) ), so even that whole explanation that it has "resolved" string already is misleading ;) BTW, I have to click on the AST button on run.dlang.io (at least on my browser) to see the generated AST, it's not done automatically.My idea was that we have this subtextual message: "look, D isn't complicated and we can always look behind the scenes".I like the message, a lot! I think it's a very nice way to show some well-written D code while explaining each part so they make sense to outsiders. -Steve
Feb 15 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much: https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.Very well written. Nice read. I recommend you write more these days.
Feb 15 2018