[your code here]
Thought this code ended up really concise and readable: https://gist.github.com/lionello/60cd2f1524c664d4d8454c01a05ac2c8 Suitable for dlang.org? L.
Re: Hong Kong dlang Meetup
Let's occupy codeaholics: https://www.meetup.com/Codeaholics/events/242640432/ On 6/9/2017 00:26, Lionello Lunesu wrote: +1! Let me know the dates and I'll blast it to the channels I'm on (Codeaholics, Dim Sum Labs hacker space.) L. On 5/9/2017 03:25, Jonathan M Davis via Digitalmars-d-announce wrote: Several of us from the D community will be in Hong Kong on a business trip next week (me, John Colvin, Atila Neves, and Ilya Yaroshenko), and our client, Symmetry Investments[1], has offered to sponsor a dlang meetup. We haven't decided when exactly to meet up yet, but we're looking to meet up sometime during the week of the 11th - 15th (probably on Thursday or Friday evening) and figured that we should see if anyone here was interested in showing up and would thus have some stake in when during the week it happened. The current plan is that the meetup will take place at Symmetry's main office in Chater House in Central Hong Kong. - Jonathan M Davis [1] http://symmetryinvestments.com/about-us/ Some open source dlang stuff whose developement was paid for by Symmetry: https://github.com/kaleidicassociates Of note is https://github.com/kaleidicassociates/excel-d which Atila talked about at dconf this year.
Re: Hong Kong dlang Meetup
+1! Let me know the dates and I'll blast it to the channels I'm on (Codeaholics, Dim Sum Labs hacker space.) L. On 5/9/2017 03:25, Jonathan M Davis via Digitalmars-d-announce wrote: Several of us from the D community will be in Hong Kong on a business trip next week (me, John Colvin, Atila Neves, and Ilya Yaroshenko), and our client, Symmetry Investments[1], has offered to sponsor a dlang meetup. We haven't decided when exactly to meet up yet, but we're looking to meet up sometime during the week of the 11th - 15th (probably on Thursday or Friday evening) and figured that we should see if anyone here was interested in showing up and would thus have some stake in when during the week it happened. The current plan is that the meetup will take place at Symmetry's main office in Chater House in Central Hong Kong. - Jonathan M Davis [1] http://symmetryinvestments.com/about-us/ Some open source dlang stuff whose developement was paid for by Symmetry: https://github.com/kaleidicassociates Of note is https://github.com/kaleidicassociates/excel-d which Atila talked about at dconf this year.
Re: Need a Faster Compressor
On 22/5/2016 05:51, Stefan Koch wrote: On Saturday, 21 May 2016 at 21:12:15 UTC, Walter Bright wrote: The current one is effective, but slow: https://github.com/dlang/dmd/blob/master/src/backend/compress.c Anyone want to make a stab at making it faster? Changing the format is fair game, as well as down and dirty assembler if that's what it takes. So really, how good are you at fast code? Is LZ4 acceptable ? If so the current C implementation is hard to beat. And maybe it's best to just copy it in. Agree. I've had the best results with LZ4. We can either link to the C code, or port it to D. It's very trivial. L.
Re: Killing the comma operator
On 13/5/2016 20:44, Nick Treleaven wrote: On Thursday, 12 May 2016 at 02:51:33 UTC, Lionello Lunesu wrote: I'm trying to think of a case where changing a single value into a tuple with 2 (or more) values would silently change the behavior, but I can't think of any. Seems to me it would always cause an error, iff the result of the comma operator gets used. int x,y; auto f() {return (x=4,y);} ... auto z = f(); static if (!is(typeof(z) == int) voteForTrump(); ;-) In practice, this is more plausible with function overloading - i.e. z.overload() calling a different function. If the comma operator returns void, the `auto z` line and f().overload() both fail. Good point. Thanks.
Re: CRLF in wysiwyg string literals?
On 12/5/2016 16:38, Kagamin wrote: For HTTP you can't use anything but escape sequences. AFAIK, they apply only to protocol headers, the content can be anything. Not just HTTP, MIME multipart/mixed content also requires CRLF, as does application/http content.
Re: Killing the comma operator
On 11/5/2016 21:13, deadalnix wrote: On Wednesday, 11 May 2016 at 10:50:47 UTC, Lionello Lunesu wrote: On 10/5/2016 22:16, deadalnix wrote: On Tuesday, 10 May 2016 at 10:09:40 UTC, Andrei Alexandrescu wrote: On 5/10/16 12:52 PM, Mathias Lang wrote: So, following DConf2016, I raised a P.R. to deprecate usage of the comma expressions, except within `for` loops increment [5]. The agreed-upon ideea was to allow uses that don't use the result (including for loops). No? -- Andrei Let's just make it of void type, there was plan to recycle the syntax maybe, but whatever we do in the future, this is the sensible first step. Acutally, we can do two-birds-one-stone: instead of making it void, make it a value tuple! No. You can't change semantic to something that'll still work under the feet of the user. If this syntax is to be recycled to tuple, the value needs to be void for a while as to shake out uses. It is safe to go from void to something else, it isn't not to go from something to something else. I agree with you when the 1st something and 2nd something are somehow compatible. void is also a something, but it'd work because it'd never silently change the meaning of code. I'm trying to think of a case where changing a single value into a tuple with 2 (or more) values would silently change the behavior, but I can't think of any. Seems to me it would always cause an error, iff the result of the comma operator gets used.
CRLF in wysiwyg string literals?
Writing a lot of server side D code lately, and bummed the usual `string literals` (or r"string literals") will only use '\n' as the End of line character, while HTTP (and others too) use CRLF for EOL. One way is to create a CTFE function that replaces all \n with \r\n, and call this on all string literals. Another idea I just had was to reserve the rn prefix for such strings, ie. rn"This string uses CRLF new lines." The rn prefix would reflect the usual \r\n CRLF pairs. (Perhaps confusing, since the r doesn't actual mean CR, and there's no n prefix either.) Just a thought. How have others solved this? Short of using \r\n\r\n, that is. L.
Re: Killing the comma operator
On 10/5/2016 22:16, deadalnix wrote: On Tuesday, 10 May 2016 at 10:09:40 UTC, Andrei Alexandrescu wrote: On 5/10/16 12:52 PM, Mathias Lang wrote: So, following DConf2016, I raised a P.R. to deprecate usage of the comma expressions, except within `for` loops increment [5]. The agreed-upon ideea was to allow uses that don't use the result (including for loops). No? -- Andrei Let's just make it of void type, there was plan to recycle the syntax maybe, but whatever we do in the future, this is the sensible first step. Acutally, we can do two-birds-one-stone: instead of making it void, make it a value tuple! If the result of the comma operator gets used in a bug prone matter it would cause a compile error! How is that for "Yeah, sorry, we broke your code, but look what you got in return!" Win-win!
Re: dmd not building with dmd
On 10/5/2016 14:39, Jacob Carlborg wrote: On 2016-05-10 06:49, Lionello Lunesu wrote: Well, it's either wrong phobos or wrong dmd. I assumed phobos was mismatched, but perhaps DMD was mismatched? Installing with brew suggest it's installing 2.071.0, but DMD appears to be 2.070: The issue Steven is having is that the symbol doesn't exist in the default C++ runtime. This has been fixed in master. He installed DMD using DVM so it's not a Brew packaging problem. Rolling back to 2.70.0 can be used as a workaround. Yeah, I see now. I thought it was because of the version "mismatch". Didn't know it was an actual bug. I had build my own and it worked. I guess I had gotten the fix. Thanks for correcting me.
Re: dmd not building with dmd
On 10/5/2016 16:24, John Colvin wrote: On Tuesday, 10 May 2016 at 04:49:33 UTC, Lionello Lunesu wrote: Well, it's either wrong phobos or wrong dmd. I assumed phobos was mismatched, but perhaps DMD was mismatched? Installing with brew suggest it's installing 2.071.0, but DMD appears to be 2.070: $ brew install dmd ==> Downloading https://homebrew.bintray.com/bottles/dmd-2.071.0.el_capitan.bottle.tar.gz Already downloaded: /Library/Caches/Homebrew/dmd-2.071.0.el_capitan.bottle.tar.gz ==> Pouring dmd-2.071.0.el_capitan.bottle.tar.gz /usr/local/Cellar/dmd/2.071.0: 561 files, 65.0M $ /usr/local/bin/dmd --version DMD64 D Compiler v2.070 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright That's because for some reason the VERSION file is wrong in the dmd github release. Should be fixed by https://github.com/Homebrew/homebrew-core/pull/1040 Ah, I see. Thanks!
Re: dmd not building with dmd
On 9/5/2016 20:19, John Colvin wrote: On Monday, 9 May 2016 at 07:57:33 UTC, Lionello Lunesu wrote: On 8/5/2016 14:43, Steven Schveighoffer wrote: [...] I ran into this as well. It's a bug in the package from brew: it shipped with the wrong phobos. You can build your own DMD: $ make -f posix.mak AUTO_BOOTSTRAP=1 In what way do you mean "shipped with the wrong phobos"? Well, it's either wrong phobos or wrong dmd. I assumed phobos was mismatched, but perhaps DMD was mismatched? Installing with brew suggest it's installing 2.071.0, but DMD appears to be 2.070: $ brew install dmd ==> Downloading https://homebrew.bintray.com/bottles/dmd-2.071.0.el_capitan.bottle.tar.gz Already downloaded: /Library/Caches/Homebrew/dmd-2.071.0.el_capitan.bottle.tar.gz ==> Pouring dmd-2.071.0.el_capitan.bottle.tar.gz /usr/local/Cellar/dmd/2.071.0: 561 files, 65.0M $ /usr/local/bin/dmd --version DMD64 D Compiler v2.070 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
Re: Compiler benchmarks for an alternative to std.uni.asLowerCase.
On 9/5/2016 12:01, Jon D wrote: On Monday, 9 May 2016 at 00:15:03 UTC, Peter Häggman wrote: On Sunday, 8 May 2016 at 23:38:31 UTC, Jon D wrote: I did a performance study on speeding up case conversion in std.uni.asLowerCase. Specifics for asLowerCase have been added to issue https://issues.dlang.org/show_bug.cgi?id=11229. Publishing here as some of the more general observations may be of wider interest. [...] Nice, it seems that you would have enough material to advocate a pull request in phobos then ;) Thanks! I haven't yet taken the time to go through the 'becoming a contributor' steps, when I have the time I'll do that. In this case, I'd want to start by validating with the library designers that the approach makes sense. It by-passes what appears to a basic primitive, std.uni.toCaser. There may be reasons this is not desirable. Less code, and faster, and using existing building blocks. Win, win, win, if you ask me! +1
Re: dmd not building with dmd
On 8/5/2016 14:43, Steven Schveighoffer wrote: I went to create a PR, and did a git pull on all my repositories. After make clean on OSX, dmd would not build: /Applications/Xcode.app/Contents/Developer/usr/bin/make -C src -f posix.mak no cpu specified, assuming X86 CC=c++ dmd idgen.d Undefined symbols for architecture x86_64: "__Unwind_GetIPInfo", referenced from: ___dmd_personality_v0 in libphobos2.a(dwarfeh_5c8_811.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) I had to revert to dmd 2.070 as the build tool to get it to build. My question is: is this expected behavior, or should I file a bug? -Steve I ran into this as well. It's a bug in the package from brew: it shipped with the wrong phobos. You can build your own DMD: $ make -f posix.mak AUTO_BOOTSTRAP=1
For the Weka guys: this fixes your casts
I just saw Shachar's lightning talk and wanted to point them to this feature that I had done for enhancing Value Range Propagation. By adding "const" to the index variable, the compiler will actually enforce the value-range for a foreach iterator. But, this still requires the range to known, so only works for static arrays: void main() { immutable ubyte PARITIES_START = 10; ubyte[4] parities = [1, 2, 4, 5]; foreach(const ubyte i, ref parity; parities) { ubyte diskId = PARITIES_START + i; // look ma, no cast } } This has been in D for over year now. Try it. L.
Re: How are you enjoying DConf? And where to go next?
On 6/5/2016 22:13, Andrei Alexandrescu wrote: The atmosphere here is great, and I'm curious how it feels for those who are watching remotely. Is the experience good? What can we do better? Also: we're talking about the DConf 2017 location. Please share any initial thoughts! Thanks, Andrei I enjoyed watching remotely, some live, some from the archives. Live stream had some hickups, so when I started hampering I'd go do something else and rewatch the talk on the archive. As for location: I attended CodeConf Hong Kong last November, hosted at Hong Kong University of Science and Technology. It was a great venue and they're very open to hosting similar events! Show Asia some love! I'll chase down the responsible people. L.
Re: The end of curl (in phobos)
On 6/5/2016 20:17, qznc wrote: On Friday, 6 May 2016 at 09:21:43 UTC, Andrei Alexandrescu wrote: On 5/6/16 10:32 AM, Robert burner Schadek wrote: As discussed yesterday at DConf, curl in phobos must go. The plan is as follows. 1. undocument everything curl related in may 2016 2. deprecate everything curl related in may 2017 3. delete everything curl related in may 2018 3.1 move curl stuff to undead PR: https://github.com/dlang/phobos/pull/4283 0. Write curl replacement Could we simply move it into a dub package? Or does that clash symbols or anything somehow? Just tried this, works fine! Try it yourself: $ sed -i '' 's/curl //' phobos/posix.mak $ make -C phobos -f posix.mak clean $ make -C phobos -f posix.mak $ dub init undead-curl $ echo 'targetType "sourceLibrary"' >> undead-curl/dub.sdl $ mkdir -p undead-curl/source/etc/c undead-curl/source/std/net/ $ mv phobos/etc/c/curl.d undead-curl/source/etc/c/ $ mv phobos/std/net/curl.d undead-curl/source/std/net/ $ dub add-local undead-curl Tested with an app I had made not long ago (guess what it does!) $ cd sciamspider $ echo 'dependency "undead-curl" version="~master"' >> dub.sdl $ dub Ran without any changes!
Can't go to DConf :( Who wants my ticket?
I'm finishing up a big project and can't leave this week. :( Hope to tune in remotely though! Let me know if you're interested or know somebody who is. Or bring that skeptical colleague of yours! Lio.
Re: Implement the "unum" representation in D ?
On 17/11/15 07:52, Nick_B wrote: On Sunday, 15 November 2015 at 04:19:21 UTC, Lionello Lunesu wrote: On 09/11/15 04:38, Richard Davies wrote: Yeah, I got curious too. I spend some time on it yesterday and had a stab at writing it in D. Hi. I send a email to John Gustafson yesterday, re this thread. He replied as follows: "There are efforts underway worldwide to support unums in C, Python, Julia, Java, and now D. And the book has only been out for nine months!" Nick Ha, and I think we can do a better job than the others! Surely in terms of performance! Funny, I was indeed looking at the Julia and Python (and John's Matematica code) to learn how some of the operations on Unums work. Still a lot to do though. I've basically only declared the type, still needs all the calculations. L.
Re: Persistent list
On 16/11/15 22:45, Andrei Alexandrescu wrote: On 11/16/2015 08:51 AM, Marc Schütz wrote: On Monday, 16 November 2015 at 02:26:29 UTC, Andrei Alexandrescu wrote: Yah, I agree with that argument. Probably @mutable is a more principled way to go about things. Glad to here that. I think the current transitive const system is really good and shouldn't be watered down beyond necessity. And a @mutable keyword, too, shouldn't just mean "immutability or const-ness end here", thus allowing any kind of mutation. What we actually need for immutable/const refcounting etc. is _non-observable mutation_, i.e. physical mutability, but without observable effects outside of the type's implementation (better yet, restricted to very short parts of it, just like @trusted). The challenge is proving that a mutation is not observable. Got an attack on that? -- Andrei Forgive me, I haven't followed the RC discussions closely, so I miss a lot of context. Feel free to point me to existing threads/articles. If it's RC we want, then @mutable is an axe when what we need is a scalpel. The non-observability comes from the fact the refcount is changed when the caller has lost its (const) reference and constness is a moot point. Changing refcount is fine now, provided the object is not immutable. As far as other outstanding const references go, these already expect changes to happen. This is what makes refcount special and provably safe to mutate. As long as we can ensure the object is not immutable, the object is allowed to change its own refcount. But refcount needs to be special cased, somehow, or else we'll end up with some C++ like `mutable`. Perhaps const-but-not-pure is the solution here. The object must be able to store (and have stored) a mutable reference, so it can use that reference to change the refcount. (This could be optimized to be a flag, since the mutable and const reference would refer to the same instance.) It means keeping track of const-but-mutable vs const-and-immutable references, and somehow telling the compiler that refcount is special. L.
Re: Bitfield bug
On 16/11/15 18:05, deadalnix wrote: https://issues.dlang.org/show_bug.cgi?id=15305 Any taker ? I don't think this is that hard to fix, and this is really bad. https://github.com/D-Programming-Language/phobos/pull/3815
Re: Implement the "unum" representation in D ?
On 09/11/15 04:38, Richard Davies wrote: On Friday, 18 September 2015 at 03:19:26 UTC, Nick B wrote: On Thursday, 17 September 2015 at 23:53:30 UTC, Anthony Di Franco wrote: I read the whole book and did not regret it at all, but I was already looking for good interval arithmetic implementations. I found that the techniques are not too different (though improved in important ways) from what is mainstream in verified computing. Hi, I haven't finished the book but have read over half of it and browsed the rest. I wanted to add that an implementation of unums would have advantages beyond verifiable computing. Some examples that spring to mind are: Using low precision (8-bit) unums to determine if an answer exists before using a higher precision representation to do the calculation (example briefly discussed in the book is ray tracing). More generally, unums can self-tune their precision which may be generally useful in getting high precision answers efficiently. It is possible for the programmer to specify the level of accuracy so that unums don't waste time calculating bits that have no meaning. Parallelisation - floating point ops are not associative but unum ops are. Tighter bounds on results than interval arithmetic or significance arithmetic. These are just a few areas where a software implementation could be useful. If you've ever had any issues with floating point, I'd recommend reading the book, not just because of the approach it proposes to solve these but also because it's very clearly written and quite entertaining (given the subject matter). Richard Yeah, I got curious too. I spend some time on it yesterday and had a stab at writing it in D. I was playing with the idea of using native floating point types to store Unums. This would not have the full benefit of the dynamically sized Unums, but would allow for the accuracy benefits. Still need to implement the basic arithmetic (interval) stuff: https://github.com/lionello/unumd L.
Tonight: Introduction to D at Codeaholics (HK)
Sorry for the short notice, but I'll be giving an introduction to D at this month's Codeaholics meetup. Drop by if you happen to be in Hong Kong! More info here (no need for RSVP): http://www.meetup.com/Codeaholics/events/226177740/ 7pm - 9pm CoCoon 3/F, Citicorp Centre, 18 Whitfield Road, TinHau, Hong Kong
Re: Tonight: Introduction to D at Codeaholics (HK)
On 11/11/15 23:34, Walter Bright wrote: On 11/11/2015 3:03 AM, Lionello Lunesu wrote: Will share how it's received in an hour ;) This is great! How did it go? Actually went much better than expected! Very engaging crowd, with good questions. I think the way I positioned D was being "just another cool tool in a programmer's toolbox" really resonated with them. It certainly prevented the usual Go vs D vs Rust kind of competitiveness. Few of the questions I got were * Why doesn't D explicitly specify the exceptions that can be thrown? (To which I answered that I never saw the point in Java and only found it tedious. This did not convince the person.) * Can I use D to build for ARM? (I said that the usual ARM code generators of GDC and LDC could be used, and that the runtime had less and less [if any] x86 dependencies left.) * Why the difference between byte[] and char[]? (I explained it as being a semantic difference, with no difference in memory layout. One can be indexed meaningfully, the other can't.) * Can I create an array of shared ints (as opposed to a shared array of ints)? I said that one could by using shared(int)[], although I have yet to try this myself. * Does D use SIMD? (Yes, and it's leveraged automatically when you do operations on arrays.) * How do the libraries available to D compare to the others like Go and Python? (I replied by introducing C/C++ compat and code.dlang.org) * What if a global function with argument A has the same name as a member of A? (I talked about function hijacking and how D prevents it.) I might remember more tomorrow. Will share if I do. L.
Re: Tonight: Introduction to D at Codeaholics (HK)
On 11/11/15 18:30, Ali Çehreli wrote: On 11/11/2015 01:19 AM, Lionello Lunesu wrote: an introduction to D at this month's Codeaholics meetup Can you share your slides please... within the next 12 hours or so... before some of us give a similar talk... :) Ali Sure thing: https://onedrive.live.com/redir?resid=DC1E6665A482DC20%21690440 It's going to be a fairly low-level talk for a mostly python/ruby crowd, focusing on some of the key advantages of D over the others. Will share how it's received in an hour ;) L.
Re: Please vote for the DConf logo
On 04/11/15 17:30, Andrei Alexandrescu wrote: Reply to this with 1.1, 1.2, 2, or 3: 1) by ponce: Variant 1: https://github.com/p0nce/dconf.org/blob/master/2016/images/logo-sample.png Variant 2: https://raw.githubusercontent.com/p0nce/dconf.org/4f0f2b5be8ec2b06e3feb01d6472ec13a7be4e7c/2016/images/logo2-sample.png 2) by Jonas Drewsen: https://dl.dropboxusercontent.com/u/188292/g4421.png 3) by anonymous: PNG: http://imgur.com/GX0HUFI SVG: https://gist.github.com/anonymous/4ef7282dfec9ab327084 Thanks, Andrei 3.
Re: Walter and I talk about D in Romania
On 02/10/15 19:25, Andrei Alexandrescu wrote: Walter and I will travel to Brasov, Romania to hold an evening-long event on the D language. There's been strong interest in the event with over 300 registrants so far. http://curiousminds.ro Scott Meyers will guest star in a panel following the talks. We're all looking forward to it! Andrei Misto
Re: Simple tutorial on deploying Vibe.d to Azure Web App
On 26/09/15 12:50, Jeremy wrote: http://www.codestrokes.com/2015/09/deploying-d-to-azure-webapp/ Thanks for this! Really useful!
Re: Possible issue with isInputRange
On 24/09/15 07:10, Maor Ben Dayan wrote: static assert(is(typeof((inout int = 0) { R r = R.init; h = r.front; }))); /* B fails */ What is `h`?
Re: This Week in D: Dconf Thursday summaries
On 16/06/15 01:12, Adam D. Ruppe wrote: http://arsdnet.net/this-week-in-d/jun-14.html I didn't finish Friday yet, so that will be next week, but here's all of Thursday's stuff! Also std.database update in there, lots of community announcements, and a bug list cleanup. Great writeup. Reading it I get to relive the conference :) By the way, Lightning Talk #3 was me.
Re: Scoped in a foreach loop.
On 05/06/15 05:07, Yuxuan Shui wrote: I tried something like this: foreach(e; scoped!SomeRangeType(args)) { } And my program segment faults. But this works: { auto x = scoped!SomeRangeType(args); foreach(e; x) { } } Shouldn't the range be alive until the end of the loop? Looks like a bug. I can repro it as well. Filed as https://issues.dlang.org/show_bug.cgi?id=14653 L.
Re: Martin Nowak's talk cancelled
On 26/05/15 15:25, Andrei Alexandrescu wrote: Sad news - Martin missed his flight and found no viable alternative to make it to DConf. For his slot at 10:00 AM on Thursday, we'll look into teleconferencing options for him. Alternatively, we're now taking applications from the other speakers and attendees to fill his slot. Please email your proposals to Walter and myself if interested. Andrei Daniel suggested to turn it into a round of lightning talks. These are more spontaneous and don't need preparation. Might get people to talk that wouldn't fill a 1-hour talk. L.
Re: Martin Nowak's talk cancelled
On 27/05/15 13:01, Andrei Alexandrescu wrote: On 5/27/15 12:13 PM, Lionello Lunesu wrote: Daniel suggested to turn it into a round of lightning talks. These are more spontaneous and don't need preparation. Might get people to talk that wouldn't fill a 1-hour talk. Good. So you go first? -- Andrei Sure :)
Re: Now official: we are livestreaming DConf 2015
On 27/05/15 13:23, Kai Nacke wrote: On Wednesday, 27 May 2015 at 19:01:00 UTC, Andrei Alexandrescu wrote: Thanks to John Colvin! He rigged his webcam centrally so we can livestream DConf 2015 in passable quality to youtube. Link: https://www.youtube.com/watch?v=-OCl-jWyT9E It's live now (30 minutes of break still ongoing so not a lot going on at the moment). Schedule at: http://dconf.org/2015/schedule/index.html Times are in MDT (GMT-0600). Andrei Hi! Any chance to change the YouTube settings? Here in Germany I get only the message: Live streaming is not available in your country due to rights issues. Regards, Kai Kai, send me a PM by mail (my first name @ my last name . com) and I'll send you US VPN creds. Anybody else who needs US VPN: send me a mail! Lio.
Re: [dconf] Share a ride SLC-hotel?
On 25/05/15 10:39, Andrei Alexandrescu wrote: I'm arriving in SLC on Tue at 11:39 pm. Anyone up for sharing a ride? I'm thinking http://www.expressshuttleutah.com/. -- Andrei I took the Green TRAX (light rail) from airport to downtown for $2.50. From there you can apparently take the train or front runner down to Orem Central Station, but I haven't checked those details yet. I plan to do some sightseeing downtown before heading South tonight. L.
Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function
On 09/10/14 17:32, francesco cattoglio wrote: On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote: Kenji just proposed a slightly controversial pull request so I want to reach out for more people to discuss it's tradeoffs. It's about deprecating function qualifiers on the left hand side of a function. I'm all for it Then at some future point we could apply the left hand side qualifiers to the return type, e.g. `const int foo();` == `const(int) foo();` I know it's not happening anytime soon, but I'm against this second idea. This will be an extra annoyance when porting old D code to a new version. Just removing the currently ambiguous attribute on the left should be plenty. No need to try to mimic C in this regard. +1
Re: C++ interop - class vs struct
On 11/09/14 14:32, Daniel Murphy wrote: pragma(cpp_mangle_as_struct) class Foo { } and/or? pragma(cpp_mangle_as_class) struct Bar { }
Re: Mago Debugger changes hands
On 10/08/14 11:33, Aldo Nunez wrote: Greetings to all Mago Debugger, Visual D, and interested D users. After 5 years, I can no longer continue development of Mago Debugger. The project requires too much attention for me to keep working on it while keeping my family happy. I learned a ton, and feel satisfied to have contributed to the D Programming Language. I'm handing off the project to Rainer Schuetze. He has forked it at github (https://github.com/rainers/mago). If you're interested in contributing to it, please contact him. Thanks for your hard work, man! It's my favorite D debugger :) Lio.
Re: Coloring terminal output.
On 13/07/14 22:11, yamadapc wrote: Hello all :) I've made a simple port of ruby's colorize library for D. I'd greatly appreciate any feedback. Windows isn't supported, yet. Links: http://code.dlang.org/packages/colorize https://github.com/yamadapc/d-colorize https://github.com/fazibear/colorize Good timing. I just added coloring support to DMD: https://github.com/D-Programming-Language/dmd/blob/master/src/color.c You can clearly see the difference between Windows and *nix. L.
Re: DMD v2.066.0-b4
On 16/07/14 08:49, ketmar via Digitalmars-d-announce wrote: On Wed, 16 Jul 2014 06:39:56 + uri via Digitalmars-d-announce digitalmars-d-announce@puremagic.com wrote: You spent the effort implementing a fix, the time talking about your fix but cannot be buggered submitting a PR for the fix? one fix at a time, not more. the first one is still sitting in bugtracker, collecting dust. maybe after it will be reviewed i'll find some motivation to fill another ticket... in a month... or two... or six... anyway, sorry for the noise. i'm really annoyed and just wanted to tell the world about it. sorry again. Then paste the fix here and allow somebody else to do the boring PR stuff for you. Just saying I've got a fix but not sharing sounds childish.
Re: DMD v2.066.0-b4
On 16/07/14 00:40, Andrew Edwards wrote: Binaries are located here: ... None of these links appear to work for me. (And this time I can't blame the Chinese firewall.) L.
Re: DMD v2.066.0-b4
On 16/07/14 14:34, ketmar via Digitalmars-d-announce wrote: standalone module copypasted in comments. my fault, i'm really sorry. It's fine, I can create the PR for you, but I haven't ventured into the backend before, so your fix would be appreciated. You'll get the credit as well, of course.
Re: Worrying attitudes to the branding of the D language
On 03/07/14 02:08, Gary Willoughby wrote: Here is one of my all time favourite talks from Steve Yegge (Senior Engineer at Google) at OSCON 2007 entitled How to Ignore Marketing and Become Irrelevant in Two Easy Steps. This is sage advice: http://tvuol.uol.com.br/video/oscon--how-to-ignore-marketing--0402D0C90386/ Great share. Thanks.
Re: Few recent dmd pull requests
On 30/06/14 15:27, bearophile wrote: Lionello Lunesu: I've closed the valueRange PR because I now think it's not a good idea, since the values it returns are not stable and any code using it can break in the future as VRP gets smarter. The obvious cases (valueRange of ubyte returning 0 and 255 resp.) can already be tested by using implicit integer casts, as @yebblies has mentioned in that PR. OK. But the other idea (value range for if/then, and for pre/post conditions) is still useful. Bye, bearophile I'm actively developing that in my if-else-range branch. It's also part of the PR for issue 259, https://github.com/D-Programming-Language/dmd/pull/1913 It needs to get smarter still if I expect Walter to accept my fix to issue 259. L.
Re: RFC: Value range propagation for if-else
Latest [1] now also supports CTFE: const i = foo ? -1 : 33; if (i) static assert(__traits(intrange, i) == Tuple!(-1, 33)); else { static assert(i == 0); // Works now! static assert(__traits(intrange, i) == Tuple!(0, 0)); } if (i == 33) { static assert(i == 33); // Works now! static assert(__traits(intrange, i) == Tuple!(33, 33)); } else static assert(__traits(intrange, i) == Tuple!(-1, 32)); Next up: support for immutable/const members and if (i) static assert(i) L. [1] https://github.com/lionello/dmd/tree/if-else-range
Re: Few recent dmd pull requests
On 26/06/14 18:38, bearophile wrote: https://github.com/D-Programming-Language/dmd/pull/3679 This introduces __traits(valueRange, expr), and I think it introduces range values to the ?: expressions too. The __traits(valueRange, expr) is meant to be useful for debugging range values, that is meant to be improved in future. Currently this patch seems stalled because Lionello seems to not provide few small things Walter has asked. I feel I did address his points, but more importantly there was not much feedback (from anyone) whether this is desirable in the first place. As others have noted, success rate of PRs is not that high, so it's defensible that the boilerplate tasks (such as updating the documentation) are left until last. I've closed the valueRange PR because I now think it's not a good idea, since the values it returns are not stable and any code using it can break in the future as VRP gets smarter. The obvious cases (valueRange of ubyte returning 0 and 255 resp.) can already be tested by using implicit integer casts, as @yebblies has mentioned in that PR. L.
Re: RFC: Value range propagation for if-else
On 23/06/14 04:51, Nordlöw wrote: That will only work now if you use an else. So you mean something like if(xbyte.min || xbyte.max) throw new InvalidArgumentException(... else {} ? That seems like a strange restriction. Why is that? I meant, else return x; Because it's easy to see what the value of x is within the if and else body. It's not trivial to find out that the if body never exits (because of the throw) and therefor the code after the if is in essence the else body. L.
Re: Can't debug dmd binary
On 20/06/14 11:00, Jerry wrote: Hi folks, I'm unable to debug binaries built with dmd 2.065. The platform is x86-64 Ubuntu 14.04. This is gdb 7.7. If I have a simple program: nodebug.d: void main() { int i; i = 3; } dmd -g nodebug.d jlquinn@wyvern:~/d$ gdb nodebug GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as x86_64-linux-gnu. Type show configuration for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type help. Type apropos word to search for commands related to word... Reading symbols from nodebug...done. (gdb) b main Breakpoint 1 at 0x416ecc (gdb) run Starting program: /home/jlquinn/d/nodebug [Thread debugging using libthread_db enabled] Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1. Breakpoint 1, 0x00416ecc in main () (gdb) l 1 dl-debug.c: No such file or directory. (gdb) Using dmd -gc doesn't help at all. Any suggestions? Thanks Jerry $gdb nodebug (gdb) b _Dmain (gdb) r
Re: RFC: Value range propagation for if-else
On 20/06/14 15:53, Don wrote: On Wednesday, 18 June 2014 at 06:40:21 UTC, Lionello Lunesu wrote: Hi, https://github.com/lionello/dmd/compare/if-else-range There, I've also added a __traits(intrange, expression) which returns a tuple with the min and max for the given expression. Destroy? The compiler uses value range propagation in this {min, max} form, but I think that's an implementation detail. It's well suited for arithmetic operations, but less suitable for logical operations. For example, this code can't overflow, but {min, max} range propagation thinks it can. ubyte foo ( uint a) { return (a 0x8081) 0x0FFF; } For these types of expressions, {known_one_bits, known_zero_bits} works better. Now, you can track both types of range propagation simultaneously, and I think we probably should improve our implementation in that way. It would improve the accuracy in many cases. Question: If we had implemented that already, would you still want the interface you're proposing here? You could have different __traits in that case: __traits(valueRange,...) // for min/max __traits(bitRange,...) // mask You example seems rather artificial though. IRL you'd get a compiler warning/error and could fix it by changing the code to 0xFF. I personally have not yet had the need for these bit-masks. L.
Re: RFC: Value range propagation for if-else
On 19/06/14 15:59, Timon Gehr wrote: On 06/18/2014 09:54 PM, Meta wrote: ... This could be a bad thing. It makes it pretty enticing to use contracts as input verification instead of logic verification. The following is doable as well with a standard range analysis: byte foo(immutable int x){ if(xbyte.min || xbyte.max) throw new InvalidArgumentException(...); return x; // ok } That will only work now if you use an else.
RFC: Value range propagation for if-else
Hi, I got this thing working and I think it's about time I get some comments on it. I've been wanting to extend Value Rang Propagation (VRE) for some time now. Mostly because of the fix to the troublesome signed-unsigned comparisons issue. Enabling VRE for if-else and will fix many of the false-positive warnings given out by the fix to bug 259 by allowing code like this: if (signed 0 signed unsigned) { .. } Have a look at the branch: https://github.com/lionello/dmd/compare/if-else-range There, I've also added a __traits(intrange, expression) which returns a tuple with the min and max for the given expression. It's used in the test case as follows: const i = foo ? -1 : 33; if (i) static assert(__traits(intrange, i) == Tuple!(-1, 33)); else { //static assert(i == 0); TODO static assert(__traits(intrange, i) == Tuple!(0, 0)); } if (i == 33) { //static assert(i == 33); TODO static assert(__traits(intrange, i) == Tuple!(33, 33)); } else static assert(__traits(intrange, i) == Tuple!(-1, 32)); if (10 = i) static assert(__traits(intrange, i) == Tuple!(10, 33)); else static assert(__traits(intrange, i) == Tuple!(-1, 9)); It would be nice if this can be used by CTFE as well. Destroy? L.
Re: RFC: Value range propagation for if-else
On 18/06/14 15:53, bearophile wrote: I've also added a __traits(intrange, expression) which returns a tuple with the min and max for the given expression. I'd like a name like integral_range, and perhaps it's better for it to return a T[2] (fixed size array) instead of a tuple. Most other traits return tuples, so it seemed like a good fit. I presume your proposal allows this code to compile: int x = 100; void main() { if (x = 0 x = ubyte.max) { ubyte y = x; } } Yes, provided 'x' is immutable or const. It can be extended for mutable values as well, but then mutations/gotos must be tracked. If your proposal is extended to contracts, you can also write: ubyte foo(immutable int x) in { assert(x = 0 x = ubyte.max); } body { return x; } Yeah, I wanted to support assert as well, but it doesn't create a scope so it'll be a bit trickier to implement. L.
Re: RFC: Value range propagation for if-else
On 18/06/14 20:46, Nordlöw wrote: Very cool. With your new trait I can simplify and, in turn, reduce compilation time for usages of Actually, if I'm not mistaken, with this trait, we can inhibit range value range checking in run-time when and get all the benefits Ada range types currently delivers. Yet another sales point for D! I submitted a pull request with the trait, without the if-else stuff! This should be faster to make it in. https://github.com/D-Programming-Language/dmd/pull/3679 L.
Re: Adding the ?. null verification
On 18/06/14 23:42, Etienne wrote: I find myself often repeating this boilerplate: if (obj.member !is null) { if (obj.member.nested !is null) { if (obj.member.nested.val !is null) { writeln(obj.member.nested.val); } } } I have to admit it's a little frustrating when you see swift's ?. syntax notation, it would be a little more practical to be able to write writeln(obj.member?.nested?.val); Based on http://appventure.me/2014/06/13/swift-optionals-made-simple/ Any thoughts? I want non-null in the type system! To put a nullable reference into a non-null variable you need to check first, but from then on the compiler can ensure it's never null!
Re: RFC: Value range propagation for if-else
On 18/06/14 16:28, bearophile wrote: Lionello Lunesu: ubyte foo(immutable int x) in { assert(x = 0 x = ubyte.max); } body { return x; } Yeah, I wanted to support assert as well, but it doesn't create a scope so it'll be a bit trickier to implement. If you have an assert in a pre-condition and the argument is const, then the body{} is the scope you look for. Bye, bearophile That's a good point! I checked the DMD code and it seems doable. I can reuse the ConditionVisitor that I wrote for if-else. Will play with it.
Re: RFC: Value range propagation for if-else
On 18/06/14 16:42, Sönke Ludwig wrote: Or even better, valueRange, to be consistent with the general naming convention. That's what I ended up calling it.
Re: Adding the ?. null verification
On 19/06/14 00:17, Etienne wrote: I want non-null in the type system! To put a nullable reference into a non-null variable you need to check first, but from then on the compiler can ensure it's never null! That would be great but useless for my situation involving some complex AST's class AEntity { Module head; string ident; Type type; AEntity typeInfo; AEntity[] members; // for definitions AEntity[] parameters; // if parameterized ... } It's very useful to descend through parts of a complex tree without adding plenty of bool checks foreach (AEntity member; entity.members) { if (member.typeInfo !is null) { AEntity curr = member; member.ident ~= member.typeInfo.ident; curr = member.typeInfo; while (curr.typeInfo !is null) { member.ident ~= . ~ curr.typeInfo.ident; curr = curr.typeInfo; } } } And all of those references can be null at any time? Non-null would force you to initialize some/all of those values to a non-null reference, with the compiler ensuring that that is really the case.
Re: [OT] DConf - How to survive without a car?
On 18/05/14 08:46, Dragos Carp wrote: On Tuesday, 6 May 2014 at 02:20:46 UTC, Lionello Lunesu wrote: Hi all, After last year's incident with my tires getting slashed, I'm really hoping I can do without a car during this year's DConf. How feasible is this? I'll be staying at Aloft. Would be great if there's someone I can share a ride with. I've also seen there's a public bus going more or less to FB and back, so I should be good there. (Right?) But how about getting to SFO or down town? Am I causing myself a whole lot of pain (albeit of a different kind) by not renting a car? To be clear, I'm not looking for an economical option, just peace of mind. Lio. Hi all, I will also stay at Aloft and have a car (at least 3 seats available). Also if somebody arrives on Tuesday, May 20th around 5:00 pm at San Francisco International Airport and needs to get to Aloft, please leave me a message. Dragos I'll arrive at 6:40pm, no check-in luggage, no customs. But don't wait on my account, I'll try to catch one of them shuttles I heard so much about. L.
Re: [OT] DConf - How to survive without a car?
On 20/05/14 09:27, Iain Buclaw via Digitalmars-d wrote: FYI I was stuck at border control for 2 hours - incase anyone else is an alien. I just passed customs in Chicago. Never entered the US so easily. Interestingly, it was much easier this time (leisure) than when I used to fly to US for business when working for Microsoft(!). L.
Re: [OT] DConf - How to survive without a car?
On 18/05/14 08:46, Dragos Carp wrote: On Tuesday, 6 May 2014 at 02:20:46 UTC, Lionello Lunesu wrote: Hi all, After last year's incident with my tires getting slashed, I'm really hoping I can do without a car during this year's DConf. How feasible is this? I'll be staying at Aloft. Would be great if there's someone I can share a ride with. I've also seen there's a public bus going more or less to FB and back, so I should be good there. (Right?) But how about getting to SFO or down town? Am I causing myself a whole lot of pain (albeit of a different kind) by not renting a car? To be clear, I'm not looking for an economical option, just peace of mind. Lio. Hi all, I will also stay at Aloft and have a car (at least 3 seats available). Also if somebody arrives on Tuesday, May 20th around 5:00 pm at San Francisco International Airport and needs to get to Aloft, please leave me a message. Dragos I'll arrive at 6:24 PM (not 6:40) from Chicago.
Re: [OT] DConf - How to survive without a car?
On 07/05/14 06:11, Mike wrote: On Tuesday, 6 May 2014 at 02:20:46 UTC, Lionello Lunesu wrote: Hi all, After last year's incident with my tires getting slashed, I'm really hoping I can do without a car during this year's DConf. How feasible is this? I'll be staying at Aloft. Would be great if there's someone I can share a ride with. I've also seen there's a public bus going more or less to FB and back, so I should be good there. (Right?) But how about getting to SFO or down town? Am I causing myself a whole lot of pain (albeit of a different kind) by not renting a car? To be clear, I'm not looking for an economical option, just peace of mind. Lio. I'm wondering about this myself. My current plan to get from SFO to the Aloft is via BART (SFO - Balboa Park - Bay Fair - Freemont) and then take a bus or a taxi from Freemont to the hotel. It looks like one could take bus 200 from the Aloft to the Ardenwood Park-and-ride, transfer to bus DB, and cross the bridge to Facebook. But, thinking about it a little more, a car is starting to look pretty good. Mike The GM from Aloft replied to my inquiry about transportation: There are shuttles at the airport and you can always arrange for one to take you back from the hotel as well. Public transportation options would be the BART which is our local subway system. This can take you from SFO to the Union City Bart Station which has cabs posted outside and it is then just a 10-15 cab ride to the hotel. Have inquired further how to recognize the shuttles at SFO. L.
Re: [OT] DConf - How to survive without a car?
On 19/05/14 15:37, Lionello Lunesu wrote: Have inquired further how to recognize the shuttles at SFO. FYI: http://www.flysfo.com/to-from/ebs/shared-ride-vans
Re: [OT] DConf - How to survive without a car?
On 20/05/14 07:21, Iain Buclaw via Digitalmars-d wrote: On 19 May 2014 23:07, Lionello Lunesu via Digitalmars-d digitalmars-d@puremagic.com mailto:digitalmars-d@puremagic.com wrote: On 19/05/14 15:37, Lionello Lunesu wrote: Have inquired further how to recognize the shuttles at SFO. FYI: http://www.flysfo.com/to-from/__ebs/shared-ride-vans http://www.flysfo.com/to-from/ebs/shared-ride-vans Yeah, shuttles is how Manu got to Aloft last year. IIRC it's useful only if you are shared with people going in the same direction. FYI: BART is $11, and taxi from Union - Aloft is $20. Yeah, it's cheap if you are part of 1 party, then it's $10 for any additional person. I'll arrive at SFO on May 20, 6:24 PM. I can stick around SFO for an hour or so if there's others in that time frame that want to share a shuttle to Aloft. Email me lio@lunesu, or wechat 'lionello'. L.
[OT] DConf - How to survive without a car?
Hi all, After last year's incident with my tires getting slashed, I'm really hoping I can do without a car during this year's DConf. How feasible is this? I'll be staying at Aloft. Would be great if there's someone I can share a ride with. I've also seen there's a public bus going more or less to FB and back, so I should be good there. (Right?) But how about getting to SFO or down town? Am I causing myself a whole lot of pain (albeit of a different kind) by not renting a car? To be clear, I'm not looking for an economical option, just peace of mind. Lio.