digitalmars.D - Compare boost::hana to D
- =?UTF-8?Q?Ali_=c3=87ehreli?= (12/12) Apr 19 2017 I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]....
- Nicholas Wilson (5/20) Apr 19 2017 Even if it offers comparable features I would show the code it
- Sebastiaan Koppe (6/12) Apr 19 2017 Haven't used C++ for a while actually. And seeing it after some
- Kagamin (51/53) Apr 19 2017 _STD_BEGIN
- Nicholas Wilson (5/12) Apr 19 2017 Ah yes C++ standard implementations. It took me a good 30s to
- Laeeth Isharc (48/63) Apr 19 2017 Hi Ali.
- Joakim (8/17) Apr 19 2017 This is a point that keeps coming up, but it is hard to market
- =?UTF-8?Q?Ali_=c3=87ehreli?= (25/38) Apr 19 2017 I'm doing very well. Hoping to see you at DConf. :)
- Walter Bright (19/23) Apr 21 2017 It's a really hard idea to get across.
- Adrian Matoga (10/25) Apr 19 2017 I was at C++ Meeting 2016 in Berlin, where Louis Dionne talked
- Sebastiaan Koppe (2/3) Apr 19 2017 Great article!
- Adrian Matoga (5/9) Apr 19 2017 Thanks! I should mention I've also got somewhat positive feedback
- David Gileadi (6/16) Apr 19 2017 Minor nit in the article--in the following paragraph "runtime" should
- Adrian Matoga (4/16) Apr 19 2017 Fixed, thanks a lot!
- =?UTF-8?Q?Ali_=c3=87ehreli?= (9/24) Apr 19 2017 (I saw that too. :) And one more.)
- Adrian Matoga (4/9) Apr 19 2017 Uhh, that underscore isn't the only problem in this line. ;)
- Mike Parker (3/7) Apr 20 2017 I'll post it, but not today. It will get more attention if I wait
- Mike Parker (2/10) Apr 21 2017 https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_...
- Mike Parker (4/17) Apr 21 2017 And I should add (for anyone paying attention), this is exactly
- Adrian Matoga (7/25) Apr 21 2017 This, and the generally positive feedback on r and HN are quite
- Nicholas Wilson (5/16) Apr 22 2017 I'm a native speaker, but I hate writing with a passion, but I
- Joakim (6/19) Apr 21 2017 Nice work, already made the top 20 upvoted proggit links this
- Adrian Matoga (12/25) Apr 21 2017 Thanks!
- Joakim (8/18) Apr 19 2017 Interesting exchange.
- Adam D. Ruppe (17/18) Apr 21 2017 BTW in your D foreach, you could also have done `switch`
- Adrian Matoga (3/22) Apr 21 2017 Thanks, I completely forgot about it. I should update the article
- Jesse Phillips (3/22) Apr 22 2017 Doesn't the latest compiler complain with a depreciation that i/e
- Steven Schveighoffer (11/35) Apr 23 2017 Yep, but it's just a warning. A really annoying warning.
- Johannes Pfau (11/44) Apr 22 2017 ml =20
- Nicholas Wilson (4/16) Apr 22 2017 I don't know about events, but dcd uses things like token!"+="
- Adrian Matoga (4/11) Apr 24 2017 I agree. Personally, I'd probably also start with something like
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (9/15) Apr 20 2017 I've looked at it and concluded that it didn't really offer
- =?UTF-8?Q?Ali_=c3=87ehreli?= (11/26) Apr 20 2017 To their credit, according to their documentation, boost::hana is a
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (9/17) Apr 20 2017 Good point. People going to C++ conferences are probably more
I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]. boost::hana is an impressive library that overlaps with many D features: http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html Have you used boost::hana? What are your thoughts on it? And please share your ideas for the presentation. There has been threads here about C++ closing the gap. Does D still bring competitive advantage or is it becoming irrelevant? (Obviously, some think its irrelevant already.) I'm trying to collect opinions... :) Thank you, Ali [1] http://cppnow.org/2017-conference/announcements/2017/04/09/d-keynote.html
Apr 19 2017
On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]. boost::hana is an impressive library that overlaps with many D features: http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html Have you used boost::hana? What are your thoughts on it? And please share your ideas for the presentation. There has been threads here about C++ closing the gap. Does D still bring competitive advantage or is it becoming irrelevant? (Obviously, some think its irrelevant already.) I'm trying to collect opinions... :) Thank you, Ali [1] http://cppnow.org/2017-conference/announcements/2017/04/09/d-keynote.htmlEven if it offers comparable features I would show the code it takes to do something (probably slightly non-trivial), the error message you get if you do something wrong and the compile time taken, which I suspect D should win significantly in.
Apr 19 2017
On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:Have you used boost::hana? What are your thoughts on it? And please share your ideas for the presentation. There has been threads here about C++ closing the gap. Does D still bring competitive advantage or is it becoming irrelevant? (Obviously, some think its irrelevant already.) I'm trying to collect opinions... :)Haven't used C++ for a while actually. And seeing it after some time, makes me tremble convulsively. While hana is indeed an awesome library it adds another set of things to learn, and it just doesn't compare favourably to D where most is buildin and a lot less ugly.
Apr 19 2017
On Wednesday, 19 April 2017 at 09:01:25 UTC, Sebastiaan Koppe wrote:Haven't used C++ for a while actually. And seeing it after some time, makes me tremble convulsively._STD_BEGIN // basic_string INSERTERS AND EXTRACTORS template<class _Elem, class _Traits, class _Alloc> inline basic_istream<_Elem, _Traits>& operator>>( basic_istream<_Elem, _Traits>&& _Istr, basic_string<_Elem, _Traits, _Alloc>& _Str) { // extract a string typedef ctype<_Elem> _Ctype; typedef basic_istream<_Elem, _Traits> _Myis; typedef basic_string<_Elem, _Traits, _Alloc> _Mystr; typedef typename _Mystr::size_type _Mysizt; ios_base::iostate _State = ios_base::goodbit; bool _Changed = false; const typename _Myis::sentry _Ok(_Istr); if (_Ok) { // state okay, extract characters const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype); _Str.erase(); _TRY_IO_BEGIN _Mysizt _Size = 0 < _Istr.width() && (_Mysizt)_Istr.width() < _Str.max_size() ? (_Mysizt)_Istr.width() : _Str.max_size(); typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc(); for (; 0 < _Size; --_Size, _Meta = _Istr.rdbuf()->snextc()) if(_Traits::eq_int_type(_Traits::eof(), _Meta)) { // end of file, quit _State |= ios_base::eofbit; break; } else if (_Ctype_fac.is(_Ctype::space, _Traits::to_char_type(_Meta))) break; // whitespace, quit else { // add character to string _Str.append(1, _Traits::to_char_type(_Meta)); _Changed = true; } _CATCH_IO_(_Istr) } _Istr.width(0); if (!_Changed) _State |= ios_base::failbit; _Istr.setstate(_State); return (_Istr); } :)
Apr 19 2017
On Wednesday, 19 April 2017 at 11:58:07 UTC, Kagamin wrote:On Wednesday, 19 April 2017 at 09:01:25 UTC, Sebastiaan Koppe wrote:Ah yes C++ standard implementations. It took me a good 30s to find what function was being declared (operator >>). Used to have nightmares of those flying past at high speed when getting template errors.Haven't used C++ for a while actually. And seeing it after some time, makes me tremble convulsively.// basic_string INSERTERS AND EXTRACTORS [...] :)
Apr 19 2017
On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]. boost::hana is an impressive library that overlaps with many D features: http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html Have you used boost::hana? What are your thoughts on it? And please share your ideas for the presentation. There has been threads here about C++ closing the gap. Does D still bring competitive advantage or is it becoming irrelevant? (Obviously, some think its irrelevant already.) I'm trying to collect opinions... :) Thank you, Ali [1] http://cppnow.org/2017-conference/announcements/2017/04/09/d-keynote.htmlHi Ali. Hope you're well. I think not enough has been written on D's plasticity - Andrei and Walter talk about it in passing a couple of times. But I have the impression that it's maybe quite important for merits of D's real world commercial value. Compare using refactoring tools with not really needing them to same extent. Something related to that. I can go back and read my D code from early 2014 when I was learning D and it's all perfectly clear to me. My python code not so much. And two of the people working with me on D side have no professional experience in finance, but it didn't take long for them to get up to speed on my project which is maybe 120k SLOC plus some wrapping code. I didn't have time or bandwidth to write comments or tests yet it was quite feasible to understand code without them. On the other hand I was reading some object oriented C++ code of 20k lines split between 200 files. I just about read C++ so ceteris non paribus. But the fragmentation and artificial abstraction makes it much harder to see what's going on and it's scarier to change it. Plus template errors in C++! And that 20k lines is maybe 6k lines in 10 files in D. I haven't always been super happy about using dub on Windows and like Manu said there is an energy gap introducing Windows isn't worse than cmake - porting some windows C++ code to build on linux. The keynote by the embedded device guy at last years c++ conf was spot on - if you're arguing you're losing. Why should I use D? Well probably you shouldn't if you don't want to. In fact in these cases you definitely shouldn't, whether you want to or not. However some people find its brought them some benefits and here are some if the commonalities. Some concrete examples that are true and essentially real might be a nice counterpart to the "quicksort in two lines" language evangelism that Andrei rightly complains about. Maybe you have some from Weka. Please ask Atila Neves if some finance examples might be helpful. (Eg excel-d, which I started and Stefan and Atila finished). One last thing. D is a pretty good language for getting stuff done quickly in for a prototype that can be cleaned up quickly. That's a point Andy Smith made, and that Liran made in his talk also. I am having to deal with that increasingly now. I would certainly much rather turn a D prototype written by a trader into production than a python one - lets not speak of Matlab! This aspect is mentioned on website but should be hammered home - it's a practical language for getting started stuff done fast without leaving a mess.
Apr 19 2017
On Wednesday, 19 April 2017 at 10:58:06 UTC, Laeeth Isharc wrote:One last thing. D is a pretty good language for getting stuff done quickly in for a prototype that can be cleaned up quickly. That's a point Andy Smith made, and that Liran made in his talk also. I am having to deal with that increasingly now. I would certainly much rather turn a D prototype written by a trader into production than a python one - lets not speak of Matlab! This aspect is mentioned on website but should be hammered home - it's a practical language for getting started stuff done fast without leaving a mess.This is a point that keeps coming up, but it is hard to market without people either trying the language or user testimonials. Would you be able to write up a blog post about this, perhaps along with your D collaborators to fish out some concrete examples from your collective experience, maybe for the D blog? We tend to focus more on the technical side for the D blog, would be nice to have a post from this development perspective.
Apr 19 2017
On 04/19/2017 03:58 AM, Laeeth Isharc wrote:Hope you're well.I'm doing very well. Hoping to see you at DConf. :) Here's another reminder to all: The registration deadline is this Sunday!On the other hand I was reading some object oriented C++ code of 20k lines split between 200 files. I just about read C++ so ceteris non paribus. But the fragmentation and artificial abstraction makes it much harder to see what's going on and it's scarier to change it.That's a good point that comes up regularly. I wonder why C++ code seems to use OOP more than e.g. D does? Is it the reverberation of that old "everything is an object" style? Otherwise, it's quite possible to do compile-time polymorphism in C++ as well.However dub isn't worse than cmakeOT: I've used CMake in an unrelated project. I had failed to learn how to write a custom rule in it. It was super easy to make comman targets like an executable or library, but not custom stuff that we had needed. Anyway... There are smarter people who can use it. :)Some concrete examples that are true and essentially real might be a nice counterpart to the "quicksort in two lines" language evangelism that Andrei rightly complains about.OT: Is there something new in Haskell that makes Sieve of Eratosthenes easier than the following entertaining paper shows? https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdfMaybe you have some from Weka.Yes, Weka is a great user of D. They take full advantage of the compile-time features of D for profit. :) OT: Unfortunately, I'm not with Weka anymore. :/ Now I know that it takes way more focus to work through the 10 hour and the 1 day differences. Their weekends are Friday and Saturday, so by the time I started my Thursday morning, Israel was already off to their weekends.D is a pretty good language for getting stuff done quickly in for a prototype that can be cleaned up quickly. That's a point Andy Smith made, and that Liran made in his talk also.Joakim is right when saying "it is hard to market without people either trying the language or user testimonials". I'm dealing with the same issue at my current job: Despite my attempts, there may be separate non-D languages for prototyping and actual implementation. Ali
Apr 19 2017
On 4/19/2017 3:58 AM, Laeeth Isharc wrote:I think not enough has been written on D's plasticity - Andrei and Walter talk about it in passing a couple of times. But I have the impression that it's maybe quite important for merits of D's real world commercial value. Compare using refactoring tools with not really needing them to same extent.It's a really hard idea to get across. Back when I wrote in C and C++, usually the first algorithm and data structure I picked persisted through to the end of life of the program. I'd optimize the hell out of it, but I didn't change it. But with D, I find I redo the algorithms and data structures, trying to find one that works better. The Warp project is a particular example of that. In C/C++, changing the algorithm/data structure meant rewriting the program. D makes it easy to change that without major rewrites, so it's much more likely that I'll be willing to change it. Other explanations for this are: 1. I'm better at encapsulating algorithms and data structures 2. D's unit test feature makes me much more confident in making changes. I can't help but think it is more than that. In D my programs just go together faster, and have fewer bugs. The code tends to look more like a solution to the problem rather than a mass of ->::<> and other syntax. But these things are hard to get across in a presentation, so instead I talk about features, and the audience goes "well I can do that in C++/Rust/Go" even if it is awkward or requires a 3rd party tool or whatever.
Apr 21 2017
On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]. boost::hana is an impressive library that overlaps with many D features: http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html Have you used boost::hana? What are your thoughts on it? And please share your ideas for the presentation. There has been threads here about C++ closing the gap. Does D still bring competitive advantage or is it becoming irrelevant? (Obviously, some think its irrelevant already.) I'm trying to collect opinions... :) Thank you, Ali [1] http://cppnow.org/2017-conference/announcements/2017/04/09/d-keynote.htmlI was at C++ Meeting 2016 in Berlin, where Louis Dionne talked about hana in his keynote [1]. I've summarized my feelings in a blog post [2]. In short, you can do the same tricks in D, but frequently there's an idiomatic way to express the same thing just as concisely without them. And of course, feel free to use any part of my post in your talk. :) [1] https://www.youtube.com/watch?v=X_p9X5RzBJE [2] https://epi.github.io/2017/03/18/less_fun.html
Apr 19 2017
On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:[2] https://epi.github.io/2017/03/18/less_fun.htmlGreat article!
Apr 19 2017
On Wednesday, 19 April 2017 at 18:26:20 UTC, Sebastiaan Koppe wrote:On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:Thanks! I should mention I've also got somewhat positive feedback from Louis [1]. [1] https://twitter.com/LouisDionne/status/843227582803849216[2] https://epi.github.io/2017/03/18/less_fun.htmlGreat article!
Apr 19 2017
On 4/19/17 11:30 AM, Adrian Matoga wrote:On Wednesday, 19 April 2017 at 18:26:20 UTC, Sebastiaan Koppe wrote:Minor nit in the article--in the following paragraph "runtime" should probably be replaced with "compile time": "Note the enum in place where C++ version used auto. The type is also inferred automatically, but using enum forces index to be computed at runtime and only then it can be used in static assert."On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:Thanks! I should mention I've also got somewhat positive feedback from Louis [1]. [1] https://twitter.com/LouisDionne/status/843227582803849216[2] https://epi.github.io/2017/03/18/less_fun.htmlGreat article!
Apr 19 2017
On Wednesday, 19 April 2017 at 18:57:19 UTC, David Gileadi wrote:On 4/19/17 11:30 AM, Adrian Matoga wrote:On Wednesday, 19 April 2017 at 18:26:20 UTC, Sebastiaan Koppe wrote:On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:[2] https://epi.github.io/2017/03/18/less_fun.htmlMinor nit in the article--in the following paragraph "runtime" should probably be replaced with "compile time": "Note the enum in place where C++ version used auto. The type is also inferred automatically, but using enum forces index to be computed at runtime and only then it can be used in static assert."Fixed, thanks a lot! It seems impossible to spot all mistakes without someone else's eyes even if I read it a thousand times... :|
Apr 19 2017
On 04/19/2017 12:12 PM, Adrian Matoga wrote:On Wednesday, 19 April 2017 at 18:57:19 UTC, David Gileadi wrote:(I saw that too. :) And one more.) Thank you. Has this been on Reddit yet? Two typos: 1) A missing underscore made me believe C++ gained a new keyword (make). :) auto events = make event_system("foo"_s, "bar"_s, "baz"_s}); 2) Replace runtime with compile-time? "but using enum forces index to be computed at runtime" AliOn 4/19/17 11:30 AM, Adrian Matoga wrote:On Wednesday, 19 April 2017 at 18:26:20 UTC, Sebastiaan Koppe wrote:On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:[2] https://epi.github.io/2017/03/18/less_fun.htmlMinor nit in the article--in the following paragraph "runtime" should probably be replaced with "compile time": "Note the enum in place where C++ version used auto. The type is also inferred automatically, but using enum forces index to be computed at runtime and only then it can be used in static assert."Fixed, thanks a lot! It seems impossible to spot all mistakes without someone else's eyes even if I read it a thousand times... :|
Apr 19 2017
On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:Thank you. Has this been on Reddit yet?I haven't posted it there, I don't have an account.Two typos: 1) A missing underscore made me believe C++ gained a new keyword (make). :) auto events = make event_system("foo"_s, "bar"_s, "baz"_s});Uhh, that underscore isn't the only problem in this line. ;) Fixed both, thank you!
Apr 19 2017
On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.Thank you. Has this been on Reddit yet?I haven't posted it there, I don't have an account.
Apr 20 2017
On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.Thank you. Has this been on Reddit yet?I haven't posted it there, I don't have an account.
Apr 21 2017
On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:And I should add (for anyone paying attention), this is exactly the sort of thing I'm looking for more of on the D Blog. Submissions welcome :-)On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.Thank you. Has this been on Reddit yet?I haven't posted it there, I don't have an account.
Apr 21 2017
On Friday, 21 April 2017 at 12:37:03 UTC, Mike Parker wrote:On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:This, and the generally positive feedback on r and HN are quite motivating. :) I have some ideas for more articles but being a non-native English speaker I need a lot of time to make the text look at least understandable, so I usually give up quickly and move on to play with code instead. :)On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:And I should add (for anyone paying attention), this is exactly the sort of thing I'm looking for more of on the D Blog. Submissions welcome :-)On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.Thank you. Has this been on Reddit yet?I haven't posted it there, I don't have an account.
Apr 21 2017
On Friday, 21 April 2017 at 19:48:53 UTC, Adrian Matoga wrote:On Friday, 21 April 2017 at 12:37:03 UTC, Mike Parker wrote:I'm a native speaker, but I hate writing with a passion, but I found the D community are very forthcoming with suggestions and improvements w.r.t both code and language typos and structure issues.And I should add (for anyone paying attention), this is exactly the sort of thing I'm looking for more of on the D Blog. Submissions welcome :-)This, and the generally positive feedback on r and HN are quite motivating. :) I have some ideas for more articles but being a non-native English speaker I need a lot of time to make the text look at least understandable, so I usually give up quickly and move on to play with code instead. :)
Apr 22 2017
On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:Nice work, already made the top 20 upvoted proggit links this week: https://www.reddit.com/r/programming/top/?time=week Active discussion going on, liked this Q&A: https://www.reddit.com/r/programming/comments/66ovil/comment/dgkjnh6On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.Thank you. Has this been on Reddit yet?I haven't posted it there, I don't have an account.
Apr 21 2017
On Friday, 21 April 2017 at 12:34:53 UTC, Mike Parker wrote:On Thursday, 20 April 2017 at 07:37:17 UTC, Mike Parker wrote:Thanks! Maaan, reddit takes ages to load on mobile and doesn't let me read anything until I close all these annoying popups. Yet the comments are mostly in the same tone I saw a few times in the past when links were posted here ("D sucks" and so on) and made me think of reddit as a complete waste of time. It looks like it's all the time the same topic – bad, bad GC, D1 vs. D2, oh, and Rust and Go are better. OTOH, I saw it posted also on HN (https://news.ycombinator.com/item?id=14165198) and there, the discussion seems to be slightly more interesting.On Thursday, 20 April 2017 at 05:01:17 UTC, Adrian Matoga wrote:https://www.reddit.com/r/programming/comments/66ovil/metaprogramming_is_less_fun_in_d/On Wednesday, 19 April 2017 at 19:22:11 UTC, Ali Çehreli wrote:I'll post it, but not today. It will get more attention if I wait until Friday afternoon GMT.Thank you. Has this been on Reddit yet?I haven't posted it there, I don't have an account.
Apr 21 2017
On Wednesday, 19 April 2017 at 18:30:49 UTC, Adrian Matoga wrote:On Wednesday, 19 April 2017 at 18:26:20 UTC, Sebastiaan Koppe wrote:Interesting exchange. Your tweet announcing that post (https://twitter.com/C012294/status/843216981566349312) doesn't show up for me in twitter's hashtag search: https://twitter.com/hashtag/dlang Can't say I'm surprised that they're incompetent at searching their own tweets though.On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:Thanks! I should mention I've also got somewhat positive feedback from Louis [1]. [1] https://twitter.com/LouisDionne/status/843227582803849216[2] https://epi.github.io/2017/03/18/less_fun.htmlGreat article!
Apr 19 2017
On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:[2] https://epi.github.io/2017/03/18/less_fun.htmlBTW in your D foreach, you could also have done `switch` void trigger(string event) { switch(event) { foreach (i, e; events) { case e: foreach (c; callbacks_[i]) c(); return; } default: assert(false, "trying to trigger an unknown event: " ~ event); } } And the compiler+runtime can optimize that into a binary search when it gets larger automatically.
Apr 21 2017
On Friday, 21 April 2017 at 13:10:43 UTC, Adam D. Ruppe wrote:On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:Thanks, I completely forgot about it. I should update the article soon.[2] https://epi.github.io/2017/03/18/less_fun.htmlBTW in your D foreach, you could also have done `switch` void trigger(string event) { switch(event) { foreach (i, e; events) { case e: foreach (c; callbacks_[i]) c(); return; } default: assert(false, "trying to trigger an unknown event: " ~ event); } } And the compiler+runtime can optimize that into a binary search when it gets larger automatically.
Apr 21 2017
On Friday, 21 April 2017 at 13:10:43 UTC, Adam D. Ruppe wrote:On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:Doesn't the latest compiler complain with a depreciation that i/e initialization is being skipped?[2] https://epi.github.io/2017/03/18/less_fun.htmlBTW in your D foreach, you could also have done `switch` void trigger(string event) { switch(event) { foreach (i, e; events) { case e: foreach (c; callbacks_[i]) c(); return; } default: assert(false, "trying to trigger an unknown event: " ~ event); } } And the compiler+runtime can optimize that into a binary search when it gets larger automatically.
Apr 22 2017
On 4/23/17 12:22 AM, Jesse Phillips wrote:On Friday, 21 April 2017 at 13:10:43 UTC, Adam D. Ruppe wrote:Yep, but it's just a warning. A really annoying warning. https://issues.dlang.org/show_bug.cgi?id=16521 has more details. static foreach + switch can be bad if you ref the elements of the tuple. The "correct" thing to do is: foreach(i, _unused; someTuple) { // use someTuple[i] instead of _unused } You will still get the warning though. -SteveOn Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga wrote:Doesn't the latest compiler complain with a depreciation that i/e initialization is being skipped?[2] https://epi.github.io/2017/03/18/less_fun.htmlBTW in your D foreach, you could also have done `switch` void trigger(string event) { switch(event) { foreach (i, e; events) { case e: foreach (c; callbacks_[i]) c(); return; } default: assert(false, "trying to trigger an unknown event: " ~ event); } } And the compiler+runtime can optimize that into a binary search when it gets larger automatically.
Apr 23 2017
Am Wed, 19 Apr 2017 18:02:46 +0000 schrieb Adrian Matoga <dlang.spam matoga.info>:On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali =C3=87ehreli wrote:ml =20I'm brushing up on my C++ to prepare for my C++Now 2017=20 presentation[1]. boost::hana is an impressive library that=20 overlaps with many D features: =20 http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html Have you used boost::hana? What are your thoughts on it? And please share your ideas for the presentation. There has=20 been threads here about C++ closing the gap. Does D still bring=20 competitive advantage or is it becoming irrelevant? (Obviously,=20 some think its irrelevant already.) I'm trying to collect=20 opinions... :) Thank you, Ali [1]=20 http://cppnow.org/2017-conference/announcements/2017/04/09/d-keynote.ht==20 I was at C++ Meeting 2016 in Berlin, where Louis Dionne talked=20 about hana in his keynote [1]. I've summarized my feelings in a=20 blog post [2]. In short, you can do the same tricks in D, but=20 frequently there's an idiomatic way to express the same thing=20 just as concisely without them. And of course, feel free to use any part of my post in your talk.=20 :) =20 [1] https://www.youtube.com/watch?v=3DX_p9X5RzBJE [2] https://epi.github.io/2017/03/18/less_fun.html =20OT but is there any benefit to identify events with strings? As long as you use compile time only events I'd prefer a syntax as in https://github.com/WebFreak001/EventSystem (one benefit is that it's 100% IDE autocomplete compatible) I guess if you want runtime registration of events identifying by name is useful. But then you also somehow have to encode the parameter types to make the whole thing safe... -- Johannes
Apr 22 2017
On Saturday, 22 April 2017 at 07:53:49 UTC, Johannes Pfau wrote:I don't know about events, but dcd uses things like token!"+=" instead of giving it a name, I think it is very readable, waaaaay better than php's T_pajamajama or whatever it is/was.[1] https://www.youtube.com/watch?v=X_p9X5RzBJE [2] https://epi.github.io/2017/03/18/less_fun.htmlOT but is there any benefit to identify events with strings? As long as you use compile time only events I'd prefer a syntax as in https://github.com/WebFreak001/EventSystem (one benefit is that it's 100% IDE autocomplete compatible) I guess if you want runtime registration of events identifying by name is useful. But then you also somehow have to encode the parameter types to make the whole thing safe... -- Johannes
Apr 22 2017
On Saturday, 22 April 2017 at 07:53:49 UTC, Johannes Pfau wrote:OT but is there any benefit to identify events with strings? As long as you use compile time only events I'd prefer a syntax as in https://github.com/WebFreak001/EventSystem (one benefit is that it's 100% IDE autocomplete compatible) I guess if you want runtime registration of events identifying by name is useful. But then you also somehow have to encode the parameter types to make the whole thing safe...I agree. Personally, I'd probably also start with something like WebFreak001's ES and only think about how to add run-time dispatch later if I absolutely need it.
Apr 24 2017
On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]. boost::hana is an impressive library that overlaps with many D features: http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html Have you used boost::hana? What are your thoughts on it?I've looked at it and concluded that it didn't really offer anything substantial for me over what I can do with C++17 and my own minor extensions to the C++ standard lib. But I'm not really keen on pulling in boost in general as the best parts of it ends up in the C++ standard anyway when it is mature... What specifically are you finding in boost::hana that justifies adding it as a dependency?
Apr 20 2017
On 04/20/2017 02:06 AM, Ola Fosheim Grøstad wrote:On Wednesday, 19 April 2017 at 08:19:52 UTC, Ali Çehreli wrote:To their credit, according to their documentation, boost::hana is a header-only library.I'm brushing up on my C++ to prepare for my C++Now 2017 presentation[1]. boost::hana is an impressive library that overlaps with many D features: http://www.boost.org/doc/libs/1_64_0_b2/libs/hana/doc/html/index.html Have you used boost::hana? What are your thoughts on it?I've looked at it and concluded that it didn't really offer anything substantial for me over what I can do with C++17 and my own minor extensions to the C++ standard lib. But I'm not really keen on pulling in boost in general as the best parts of it ends up in the C++ standard anyway when it is mature...What specifically are you finding in boost::hana that justifies adding it as a dependency?My motivation is learning enough about modern C++ to not make a fool of myself in front of an expert C++ crowd. :) If I hadn't known about boost::hana, I could have easily stressed D's compile-time features as if C++ did not have them. Now I see that although as-always-less-readable, C++ has lots of compile-time features through boost::hana. For example, boost::hana has the equivalent of AliasSeq, and it's not too inconvenient. Ali
Apr 20 2017
On Thursday, 20 April 2017 at 09:32:02 UTC, Ali Çehreli wrote:My motivation is learning enough about modern C++ to not make a fool of myself in front of an expert C++ crowd. :) If I hadn't known about boost::hana, I could have easily stressed D's compile-time features as if C++ did not have them.Good point. People going to C++ conferences are probably more likely to use (or play with) such libraries than the I-just-want-stuff-done-C++ programmers. Besides if hana has it then several C++ programmers either use hana or have their own equivalent of it.Now I see that although as-always-less-readable, C++ has lots of compile-time features through boost::hana. For example, boost::hana has the equivalent of AliasSeq, and it's not too inconvenient.I have seen that boost::hana has received praise in the reddit.com/r/cpp group. You might ask there for examples of open source projects that use it in production?
Apr 20 2017