Re: Lang.NEXT panel on native languages
Le 11/04/2012 03:20, Andrei Alexandrescu a écrit : On 4/10/12 3:39 PM, Andrej Mitrovic wrote: On 4/10/12, deadalnixdeadal...@gmail.com wrote: Le 10/04/2012 07:46, Andrei Alexandrescu a écrit : http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Panel-Native-Languages?format=html5 We want D talks ! 2 of them, but 0 online :'( That native panel wasn't all that interesting (or rather the questions asked weren't too interesting).. waiting anxiously for the D videos. Well you might be disappointed if you hope for a lot. Walter and I believe that that day was big for D in terms of getting more attention for it, but the kind of things we discussed was all news to the regulars of the community. Andrei Indeed, I was the slides. What I'm most interested in is question of the public, and how it was received.
Jonas Drewsen is a GSoC mentor!
To many in this community Jonas needs no introduction. Jonas stepped up following our call to arms. Thanks, Jonas! Andrei
Jens Mueller is a GSoC mentor!
Jens Mueller also responded to our request for mentors. He's a graduate student who also works as a Teaching Assistant, so he knows how to deal with them pesky students :o). Welcome aboard! Andrei
Russel Winder is a GSoC mentor!
And last but not least... Russel Winder is now a GSoC mentor! Russel is an author, consultant, trainer, and sought-after speaker of tremendous expertise. We're very happy Russel has caught an interest in D, and even happier that he decided to ramp up his involvement by becoming a mentor. Thanks, Russel! Andrei
Re: I'll be in Seattle at Lang.NEXT
On Saturday, 7 April 2012 at 06:33:03 UTC, Andrei Alexandrescu wrote: Slides are online: http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Three-Unlikely-Successful-Features-of-D In C# you rethrow using throw; statement: throw e; loses stack trace.
Re: I'll be in Seattle at Lang.NEXT
On Saturday, 7 April 2012 at 06:33:03 UTC, Andrei Alexandrescu wrote: Slides are online: http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Three-Unlikely-Successful-Features-of-D rollback1 seems to be missing on slide 15. You probably need 3 of them there.
Re: I'll be in Seattle at Lang.NEXT
And you probably need to check if error==nil instead of error!=nil... Sorry, if I say nonsense, I don't know Go.
Video: Generic Programming Galore using D @ Strange Loop 2011
http://www.infoq.com/presentations/Generic-Programming-Galore-Using-D Andrei
Re: Lang.NEXT panel on native languages
On 4/11/12, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 4/10/12 3:39 PM, Andrej Mitrovic wrote: On 4/10/12, deadalnixdeadal...@gmail.com wrote: Le 10/04/2012 07:46, Andrei Alexandrescu a écrit : http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Panel-Native-Languages?format=html5 We want D talks ! 2 of them, but 0 online :'( That native panel wasn't all that interesting (or rather the questions asked weren't too interesting).. waiting anxiously for the D videos. Well you might be disappointed if you hope for a lot. Walter and I believe that that day was big for D in terms of getting more attention for it, but the kind of things we discussed was all news to the regulars of the community. No, I am interested in D talks even if it's old news, but the native panel didn't talk much about D. :)
Re: Video: Generic Programming Galore using D @ Strange Loop 2011
On 4/11/12, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: http://www.infoq.com/presentations/Generic-Programming-Galore-Using-D Andrei Cool talk! And it just occurred to me that you can actually use a static assert on a return type in D, e.g.: import std.traits; import std.algorithm; auto min(T1, T2)(T1 t1, T2 t2) { return t1; // e.g. implementation bug static assert(is(typeof(return) == CommonType!(T1, T2))); } void main() { auto x = min(1, 1.0); } I didn't know this until now. It might help in cases where the return type is a very complicated template instance and you want to enforce the return expression to be of that type while simultaneously using auto as the return type in the function declaration. It does however do this check *after* any implicit conversions to the return type. So, while my first sample correctly won't compile, the following will compile: import std.traits; import std.algorithm; CommonType!(T1, T2) min(T1, T2)(T1 t1, T2 t2) { return t1; static assert(is(typeof(return) == CommonType!(T1, T2))); } void main() { auto x = min(1, 1.0); } It's interesting to think about.
Re: Video: Generic Programming Galore using D @ Strange Loop 2011
On 4/11/12 11:23 AM, Andrei Alexandrescu wrote: http://www.infoq.com/presentations/Generic-Programming-Galore-Using-D Destroy on reddit: http://www.reddit.com/r/programming/comments/s4qul/infoq_generic_programming_galore_using_d_video/ Andrei
Re: Video: Generic Programming Galore using D @ Strange Loop 2011
On Wed, 11 Apr 2012 21:34:11 +0200, Olivier Pisano olivier.pis...@laposte.net wrote: Le 11/04/2012 18:23, Andrei Alexandrescu a écrit : http://www.infoq.com/presentations/Generic-Programming-Galore-Using-D Andrei Great talk ! I am going to start to feel at ease with those is(typeof(...)) constructs ! :) Olivier Don't speak too hastily :) I promise you'll be amazed at the complexities of the is expression many more times
Re: Lang.NEXT panel on native languages
On 4/11/12 11:28 AM, Andrej Mitrovic wrote: On 4/11/12, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote: On 4/10/12 3:39 PM, Andrej Mitrovic wrote: On 4/10/12, deadalnixdeadal...@gmail.com wrote: Le 10/04/2012 07:46, Andrei Alexandrescu a écrit : http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Panel-Native-Languages?format=html5 We want D talks ! 2 of them, but 0 online :'( That native panel wasn't all that interesting (or rather the questions asked weren't too interesting).. waiting anxiously for the D videos. Well you might be disappointed if you hope for a lot. Walter and I believe that that day was big for D in terms of getting more attention for it, but the kind of things we discussed was all news to the regulars of the community. No, I am interested in D talks even if it's old news, but the native panel didn't talk much about D. :) Walter's video is now online. http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/The-D-Programming-Language Please reddit. Thanks, Andrei
Re: Revamp of CandyDOC
On 4/12/12, Eldar Insafutdinov e.insafutdi...@gmail.com wrote: There is still a scope for improvements Also: Not jumping to the Outline pane every time a different package is selected (OR it should memorize the position of the scrollbar). This is especially annoying in e.g. gtkd: http://gtkd.mikewey.eu/src/cairo/Surface.html Whenever I click on another package it jumps to the outline view, and if I go back I can't figure out where I was because the scrollbar resets. Othe than that your improvements look very nice!
Re: Lang.NEXT panel on native languages
On 4/11/12 5:04 PM, Andrei Alexandrescu wrote: Walter's video is now online. http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/The-D-Programming-Language Please reddit. Destroy! http://www.reddit.com/r/programming/comments/s5492/the_d_programming_language_walter_bright_langnext/ Andrei
Re: Video: Generic Programming Galore using D @ Strange Loop 2011
On Wednesday, 11 April 2012 at 16:23:48 UTC, Andrei Alexandrescu wrote: http://www.infoq.com/presentations/Generic-Programming-Galore-Using-D Andrei Also on HN: http://news.ycombinator.com/item?id=3829871
Video: Walter Bright D at Lang.NEXT 2012
http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/The-D-Programming-Language and on Reddit: http://www.reddit.com/r/programming/comments/s5492/the_d_programming_language_walter_bright_langnext/
Re: Revamp of CandyDOC
Al 12/04/12 00:17, En/na Eldar Insafutdinov ha escrit: CandyDOC has not been updated for about 6 years, and despite its usefulness its current state was rather sad. Overall look was awful; colours, font sizes, everything just was not right. D allows some very beautiful code, but the look and feel of documentation is not on par. Anyway, I gave it a bit of a refresh (which was in fact a major refactoring) and here is an example http://eldar.me/candydoc/algorithm.html . Among new features is also instant filtering. You can grab the sources at https://github.com/eldar/candydoc . There is still a scope for improvements: adding links to the subsections and ideally producing links to the source code. For that ddoc needs to output line numbers of declarations which I am not sure it does, but that can be added. Cheers Eldar Another important thing is to allow multiple directories. Lars T. Kyllingstad has a corrected version of candydoc at https://github.com/kyllingstad/scid that allow this. In Your project, simply replacing path[i] by path.join(_) on explorer.js(236), and naming html files like path_to_file.html Best regards, -- Jordi Sayol
Re: Video: Generic Programming Galore using D @ Strange Loop 2011
Andrej Mitrovic: it just occurred to me that you can actually use a static assert on a return type in D, e.g.: import std.traits; import std.algorithm; auto min(T1, T2)(T1 t1, T2 t2) { return t1; // e.g. implementation bug static assert(is(typeof(return) == CommonType!(T1, T2))); } void main() { auto x = min(1, 1.0); } I didn't know this until now. I'd like to verify the type of what a range yields inside the post-condition of the function, but I can't use code like this, because currently functions with out{} can't use auto as return type: import std.stdio, std.algorithm, std.traits; auto foo(int x) in { assert(x = 0); } out(result) { static assert(is(ForeachType!(typeof(result)) == int)); } body { return map!(a = a * 2)([1, 2, 3]); } void main() { writeln(foo(1)); } And you have to keep in mind that inside the out{} 'result' is const, and const ranges aren't that useful, you can't even iterate them... Bye, bearophile
Re: Video: Generic Programming Galore using D @ Strange Loop 2011
Andrei Alexandrescu: http://www.infoq.com/presentations/Generic-Programming-Galore-Using-D It was a quite good talk. Slide 13: very good, I am asking for min([1, 3, 5)) for a lot of time :-) (http://d.puremagic.com/issues/show_bug.cgi?id=4705 ). I hope to see those new min/max/argMin/argMax functions in Phobos. I'd also like the mins()/maxs() functions, as explained in Issue 4705, their need is common. I have added some use cases there. (But your code doesn't work with opApply, so it doesn't work with everything as the slide says). -- Slide 15: auto m = argmin!((x) { return x.length;})(s); As deadalnix notes, that was a good place to show the new D lambda template syntax and UCFS: auto m = s.argmin!(x = x.length)(); But it also shows why Python (unlike Ruby) uses a free function for length (that calls a __len__ standard method on objects and built-ins), it allows you to write that code with no need of lambdas (it also shows why Python named arguments are nice): m = min(s, key=len) So in D to avoid defining a lambda I sometimes use walkLength as free function (but I have to keep in mind it gives different results on narrow strings!): auto m = s.argmin!walkLength(); And maybe argMin name is more fitting in D than argmin. [Attention, uncooked ideas ahead] Creating a good min() is not so easy. When I did create the dlibs1 in D1 I didn't know this, so I thought of myself as a not so good enough programmer for finding it not so easy to create the min/max functions :-) At about 40.00 of your talk there was an interesting question and answer. D sees 255 on default as an integer literal: auto x = 255; static assert(is(typeof(x) == int)); But D also accepts this, because D knows this is a valid ubyte literal too, it fits in the ubyte interval: ubyte x = 255; The D compiler even accepts this with no errros or warnings, requiring no cast to assign z: void main(string[] args) { uint x; ubyte y = cast(ubyte)args.length; ubyte z = x % y; } (A bug on this: http://d.puremagic.com/issues/show_bug.cgi?id=7834 ). So another possible desiderata for a 'dream' min() function is this to compile, with no need of a cast in the user code: void main(string[] args) { ubyte u = min(args.length, 255); } To allow this I think D needs some more static introspection/skills. The template of the min() function needs to be informed not just that the second argument is of type int, but also that it's a literal (or value known at compile time witn no need of running compile-time code to compute it, this is a requirement of the way D CTFE works), and it also fits in an ubyte range. The result of that min() is of type size_t, so this is true (so the min of an unsigned short and an unsigned int is an unsigned int type still. Types and their ranges are orthogonal things): auto u = min(args.length, 255); static assert(is(typeof(u) == size_t)); But this also compiles because the compiler knows that despite the result of that min() call is a size_t the compile-time range of that size_t value fits inside a ubyte range too (just like for the built-in literal 255 that the compiler knows has a range that fits in an ubyte too): ubyte u = min(args.length, 255); So I think this kind of code needs a way to tell statically: - The actual statically known range of a compile-time known integral value. - It also needs the ability to _assign_ a statically known range to an integer value. To make things simpler the compiler is not required to prove that this is a correct assignment, it accepts it with an act of faith. Opionally I'd also like a way to tell, from inside the template: - If a template argument is a literal (or it's a value known statically with no need to run compile-time code); - If the result of the function is assigned to a variable or not (if this information is used, then the template instantiates itself again in two variants, according to the boolean result of this query)). I think a first step is to have something like this, to call from user code the interval analysis engine inside the D compiler. I think this just is just a way to expose to user code stuff already existing inside the compiler, so I think this requires only a small amount of compiler code to be added (I it's better for the result to be an interval closed on the right, unlike most other intervals in D): uint x = ...; __traits(interval, x ubyte.max) === TypeTuple!(0, 255) That alone is not enough to implement that dream min. Because if you do this: void foo(T)(T x) { writeln([__traits(interval, x)]); } void main() { foo(255); } I think it prints this, because the result of interval analysis gets lot when the expression ends or at function call point: [-2147483648, 2147483647] Bye, bearophile
We got 3 GSoC projects
Hello, I am pleased to announce that the GSoC program granted three slots to our organization, same as last year. This is a good allocation and a testament of the good results of last year. However, unfortunately it also means we need to decline at least two excellent candidates; we've had very good proposals this year. I'll try to negotiate for more slots on the after-allocation market but the chances are very slim. We'll announce the chosen projects soon. We have enough mentors for three projects, but I'll be glad to add anyone willing to help to the respective projects mailing lists. Cheers, Andrei
Re: Video: Generic Programming Galore using D @ Strange Loop 2011
Question on slide #6: Should work at efficiency comparable to hand-written code A version of min() that used 'ref' would probably be faster on large structs. Is that a problem? How do you make the decision to exclude 'ref'? Do [generic] algorithms always go with value semantics? On Wed, Apr 11, 2012 at 11:23 AM, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: http://www.infoq.com/presentations/Generic-Programming-Galore-Using-D Andrei
XSort - Sorting algorithms (including Timsort!)
I just wanted to share this. I started a project a few weeks ago on Github to implement several sorting algorithms in D. In total, there are 8 modules at the moment, each implementing a sorting algorithm or combination thereof. https://github.com/Xinok/XSort I just finished Timsort today. It's working, it's stable, but I need to spend a little more time better optimizing it.
Re: XSort - Sorting algorithms (including Timsort!)
On Thursday, 12 April 2012 at 03:04:49 UTC, Xinok wrote: I just wanted to share this. I started a project a few weeks ago on Github to implement several sorting algorithms in D. In total, there are 8 modules at the moment, each implementing a sorting algorithm or combination thereof. https://github.com/Xinok/XSort I just finished Timsort today. It's working, it's stable, but I need to spend a little more time better optimizing it. Cool! To make it a bit more generic, may I suggest making all the inputs only have to be isInputRange, and have it converted to an array. NMS