digitalmars.D - Marketing of D - article topic ideas?
- Walter Bright (11/11) Jun 03 2010 D is an extremely powerful language, but when I read complaints and sigh...
- Robert Clipsham (6/17) Jun 03 2010 Given some ideas I'm happy to write an article or two. I guess the best
- Brad Roberts (8/31) Jun 03 2010 Rewording that a little: How D solved a problem particularly well for y...
- Lutger (3/25) Jun 04 2010 I would be interested in contract programming. Taking a small example ap...
- Adam Ruppe (45/46) Jun 04 2010 When I write my thing up, I'll have something to say about contracts
- bearophile (4/7) Jun 04 2010 There's lot of space for improvements here. But those inferences take ti...
- Adam Ruppe (2/3) Jun 04 2010 Aye, though let's not forget that what D has is already quite nice!
- retard (13/27) Jun 03 2010 Well, I for one, like to know when the D2 will be officially published. ...
- superdan (3/30) Jun 03 2010 http://www.youtube.com/watch?v=8r1CZTLk-Gk
- Bane (2/34) Jun 04 2010 yup. too many people take D for granted and only bitch about things it l...
- bearophile (27/29) Jun 03 2010 Here are 7 possible articles:
- Adam Ruppe (18/18) Jun 03 2010 I recently rewrote a huge PHP application in D2. It isn't a completely
- Nick Sabalausky (3/15) Jun 03 2010 Comparing D to PHP is like comparing a 747 to the Hindenburg. :)
- Andrei Alexandrescu (23/41) Jun 03 2010 I think this is the best way to approach writing, and I strongly
- Walter Bright (3/41) Jun 03 2010 This is exactly what I'm talking about.
- Walter Bright (5/6) Jun 03 2010 The most popular blog entry I wrote for DDJ, was the one on converting a...
- Lutger (5/13) Jun 04 2010 A post-mortem style article or blog is nice, reading about the whole exp...
- BCS (4/11) Jun 04 2010 BTW: how does that go?
- Walter Bright (2/8) Jun 04 2010 veeeeeerrrrrreeeee sssssslllllllooooooollllllllyyyyyyy
- BCS (4/14) Jun 04 2010 if(progress > 0) Ok();
- Eric Poggel (10/28) Jun 04 2010 I've spent years in both D and PHP, and most of my php code is a little
- Adam Ruppe (12/14) Jun 04 2010 What kind of stuff would you need? I admit I did spend several
- Eric Poggel (4/18) Jun 04 2010 It would be nice to have a web library for D, but my web development has...
- Nick Sabalausky (28/48) Jun 04 2010 A lot of clients I know wouldn't know the difference anyway, and thus
- retard (4/14) Jun 05 2010 News at eleven! A rewrite of a shitty old version is better than the
- Adam Ruppe (6/8) Jun 05 2010 The really interesting thing is how D on plain old CGI also performed
- Jeff Nowakowski (8/13) Jun 05 2010 Why is this interesting? D is a static, compiled, "system" language
- Adam Ruppe (10/16) Jun 05 2010 The reason I did the benchmarks was because I was talking to someone
- Robert Clipsham (7/23) Jun 05 2010 It isn't anyway, at least not with fastcgi - take mod_php vs php in
- Adam Ruppe (7/9) Jun 05 2010 My numbers are all plain old vanilla CGI; fcgi would probably be better ...
- Nick Sabalausky (51/54) Jun 05 2010 Easily debatable? Not without an existing brain injury ;)
- Robert Clipsham (44/100) Jun 06 2010 Or worse, security issues - heck, the examples on php.net are so easy
- Nick Sabalausky (14/24) Jun 06 2010 Heh heh. "good reliable code in PHP" *is* a contradiction of terms, afte...
- Robert Clipsham (11/23) Jun 06 2010
- Nick Sabalausky (13/40) Jun 06 2010 I was thinking the same thing!
- Ellery Newcomer (2/2) Jun 06 2010 You just made me feel much less guilty that PHP's syntax turned me off
- Nick Sabalausky (11/18) Jun 05 2010 Yea, justified or not, it's a very prevailant belief in the web dev worl...
- Nick Sabalausky (5/16) Jun 03 2010 More of a long term-thing, but D needs a couple of "killer libs" (for
- JMRyan (8/12) Jun 03 2010 I think I've said this before, but D needs a two killer apps plus one
- Trass3r (4/10) Jun 03 2010 What about a followup article about more sophisticated CTFE, maybe in
- Alex Makhotin (20/23) Jun 04 2010 Yes, I think the relevant themes are:
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (11/25) Jun 04 2010 I will write a blog article how I used D to write an extension DLL for
- Bane (1/1) Jun 04 2010 Might be unimportant and off topic, but I think cool website might be ni...
- Justin Johansson (4/18) Jun 04 2010 Great idea .. an article in Linux Journal about how D is the ideal
- Graham Fawcett (5/24) Jun 04 2010 +1, that is a killer feature.
- Long Chang (11/21) Jun 04 2010 how to generate a header file in the source files dir? when i wan't get ...
- sybrandy (19/30) Jun 04 2010 One thing that I think will really make people really notice D is
- ArnoldSSchwartz (10/15) Jun 05 2010 Like OxyClean! (?)
- BCS (2/2) Jun 06 2010 ArnoldSSchwartz wrote,
- ArnoldSSchwartz (12/23) Jun 05 2010 I think you have and have had good intent (that is not necessarily a
- eles (16/42) Jun 06 2010 I think Walter has been doing a great job with D. I do not like all
- ArnoldSSchwartz (7/11) Jun 06 2010 Why?
- dennis luehring (5/16) Jun 06 2010 what about writing an "connect" example of D featureset usage in an C,
- Alex Makhotin (12/15) Jun 06 2010 I experienced a runtime access violation on Windows when interoperating
- dennis luehring (8/19) Jun 06 2010 perfekt scenario! can you provide us with some "small" example of
- dennis luehring (13/36) Jun 06 2010 what about a large (splitted into smaller ones) article about
- dsimcha (33/43) Jun 06 2010 This probably won't be replied to because I'm starting a new sub-thread ...
- Justin Spahr-Summers (7/57) Jun 06 2010 Seems like that example could be done fairly easily with Objective-C.
- Nick Sabalausky (11/36) Jun 06 2010 I clearly haven't been following D2 closely enough. Or maybe I'm just mo...
- Philippe Sigaud (20/41) Jun 06 2010 T is a typetuple, with ranges as elements (types). These ranges may have
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (10/13) Jun 07 2010 Yes, in Java, everything is an object except where that bothered
- Nick Sabalausky (12/20) Jun 07 2010 Yea, that's a good example of why I've grown a distaste towards
- Walter Bright (13/21) Jun 07 2010 D has design principles, but those principles are often contradictory. I...
- Nick Sabalausky (6/27) Jun 07 2010 Great example.
- Leandro Lucarella (11/40) Jun 07 2010 Please, document this!
- Walter Bright (2/5) Jun 07 2010 Done.
- Leandro Lucarella (10/16) Jun 07 2010 Thanks =)
- Justin Johansson (4/17) Jun 13 2010 Me feels that many readers of this ng would enjoy a recap of just
- retard (7/26) Jun 07 2010 Part of the "religious" feel of Java comes from the fact that it runs on...
- Justin Johansson (4/31) Jun 13 2010 Hear, hear. The idea that "everything is a Object" is definitely
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (23/69) Jun 07 2010 D.
- Andrei Alexandrescu (3/52) Jun 07 2010 I very much doubt that.
- Nick Sabalausky (21/87) Jun 07 2010 It might be faster than using nested loops in Python. But yea, seems
- Nick Sabalausky (3/10) Jun 07 2010 ElementType!T max(T range) // Corrected
- Nick Sabalausky (5/18) Jun 07 2010 Or:
- BCS (25/47) Jun 07 2010 so we have:
- retard (3/27) Jun 08 2010 max = reduce >
- KennyTM~ (3/30) Jun 08 2010 If there's any language allowing defining a max like this, it has
- retard (3/37) Jun 08 2010 Right, I should not have used the symbol >, but last post was right afte...
- Justin Johansson (2/38) Jun 09 2010 Hey retard, you are a legend.
- Andrei Alexandrescu (12/33) Jun 08 2010 This is kind of funny. This works because reduce is defined as follows:
- Nick Sabalausky (5/40) Jun 08 2010 Template currying ;) Maybe not as flexible as typical currying, but stil...
- Philippe Sigaud (15/17) Jun 08 2010 I recenly achieved getting partially there. At least, given
- Philippe Sigaud (11/21) Jun 08 2010 Currying in general is always handy to have. The possibility to say
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (10/20) Jun 07 2010 ionally
- Andrei Alexandrescu (8/21) Jun 07 2010 That it has reasonable performance. Then, there are a number of things
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (13/38) Jun 08 2010 Please define "reasonable performance"...
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (10/40) Jun 08 2010 ou
- Andrei Alexandrescu (3/5) Jun 08 2010 Hope I didn't do that.
- Andrei Alexandrescu (3/27) Jun 08 2010 Within 15% of hand-optimized code specialized for the types at hand.
- Walter Bright (6/10) Jun 08 2010 I would have said O(n) or O(log n), as opposed to, say, O(n*n).
- Andrei Alexandrescu (3/13) Jun 08 2010 max of n elements is O(n).
- Simen kjaeraas (12/13) Jun 08 2010 T max( T )( T[] values ) {
- Simen kjaeraas (13/24) Jun 08 2010 Better:
- Andrei Alexandrescu (3/27) Jun 08 2010 I'm not sure I understand the point. Could you please elaborate?
- Nick Sabalausky (5/36) Jun 08 2010 He's being a smart-ass and making implementations of max() that are wors...
- Simen kjaeraas (4/6) Jun 09 2010 Well, I tried. Second try I was apparently too drunk to write bad code.
- Nick Sabalausky (3/4) Jun 09 2010 That's officially my favorite sentence of the day :)
- retard (5/23) Jun 08 2010 This probably means that D 2 won't be very efficient on multicore until
- Nick Sabalausky (3/26) Jun 08 2010 You used to have meaningful things to say. Now you're just trolling.
- retard (3/32) Jun 08 2010 Max of n unordered elements can be solved in O(log log n) time assuming
- Nick Sabalausky (3/20) Jun 08 2010 Yes, actually :)
- dsimcha (5/37) Jun 09 2010 Technically true, but when's the last time you needed to find the max of...
- Andrei Alexandrescu (43/75) Jun 09 2010 When calculating the complexity of an operation you don't consider cores...
- retard (13/40) Jun 11 2010 With this logic, all parallel algorithms have the same time complexity a...
- Andrei Alexandrescu (4/11) Jun 11 2010 What is the correct algorithm for the second stage? Do you have a
- retard (4/17) Jun 11 2010 Unfortunately I can't remember. It was probably explained in Jaja's book...
- Andrei Alexandrescu (7/25) Jun 12 2010 That's right. I'm now glad I followed this through; I learned a couple
- Yao G. (9/32) Jun 08 2010 :D Wow. This troll is getting increasingly desperate. Now it resorts t...
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (7/15) Jun 09 2010 Well, then my python function is Ok (O(n)) ;)
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (13/42) Jun 09 2010 ,
D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_func ion_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.
Jun 03 2010
On 04/06/10 00:58, Walter Bright wrote:D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Given some ideas I'm happy to write an article or two. I guess the best thing to write articles on are the problems D solves which other languages have, or how D makes something easier to do - we'd need to pick out some specific areas though. Robert
Jun 03 2010
On 6/3/2010 5:15 PM, Robert Clipsham wrote:On 04/06/10 00:58, Walter Bright wrote:Rewording that a little: How D solved a problem particularly well for you. Demonstrations are FAR more effective than statements. Also, not responding to you but rather the general topic, getting the word out in other venues would help too. There's been many posts that hit reddit. That venue isn't bad, but also has already built up a set of automatic detractors. Later, BradD is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Given some ideas I'm happy to write an article or two. I guess the best thing to write articles on are the problems D solves which other languages have, or how D makes something easier to do - we'd need to pick out some specific areas though. Robert
Jun 03 2010
Robert Clipsham wrote:On 04/06/10 00:58, Walter Bright wrote:I would be interested in contract programming. Taking a small example app and illustrating how to add pre- and postconditions, invariants, contract inheritance and perhaps notrow and pure. Or start with the contracts as advocated by the Eiffel method. Perhaps do the same with .NET 4.0 contracts and compare the results.D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Given some ideas I'm happy to write an article or two. I guess the best thing to write articles on are the problems D solves which other languages have, or how D makes something easier to do - we'd need to pick out some specific areas though. Robert
Jun 04 2010
On 6/4/10, Lutger <lutger.blijdestijn gmail.com> wrote:I would be interested in contract programming.When I write my thing up, I'll have something to say about contracts too. My HTML DOM code (on which I own the copyright! -- http://arsdnet.net/dcode/dom.d ) was originally written as just a list of functions, like I've done for a long time. But, then, a null pointer got into tree somehow, and it annoyed the hell out of me. To help track it down, I added the class invariant and piles of in/out contracts. There's almost more assert lines than actual code! Take a look at this function: Element appendChild(Element e) in { assert(e !is null); assert(e.parentNode is null); assert(!selfClosed); } out (ret) { assert(e.parentNode is this); assert(e is ret); } body { e.parentNode = this; children ~= e; return e; } Lots of those are pretty obvious, and it is a trivial function, so it isn't hard to eyeball it, but putting this stuff in those contracts make it explicit as to what is expected: it takes ownership a node without a parent and returns it. But now, if I edit this function, or subclass it and screw something up, it is caught very quickly, and right on location. This experience has made me understand the people asking for non-null types, but it has more benefit aside from that too. For example, yesterday, I wrote this: auto e = document.createElement("div"); auto list = document.createElement("ul"); // snip e.appendChild(e); // BUG, should be appending the list The compiler didn't catch this one, and I wrote this long after forgetting about the dom implementation code. But the in contract caught this as soon as I ran it. There's a few little things that could be improved here, but it is still very nice to know stuff gets caught sooner rather than later (and I'd love if it the compiler could catch some of those asserts at compile time if it can prove it! I'm thinking that perhaps some extensions to value range propagation could to the trick.)
Jun 04 2010
Adam Ruppe:(and I'd love if it the compiler could catch some of those asserts at compile time if it can prove it! I'm thinking that perhaps some extensions to value range propagation could to the trick.)There's lot of space for improvements here. But those inferences take time, while the compiler must be fast enough. To solve this it can be useful a progressive compilation (partial compilation while you type the code, as some IDEs do). Bye, bearophile
Jun 04 2010
On 6/4/10, bearophile <bearophileHUGS lycos.com> wrote:There's lot of space for improvements here.Aye, though let's not forget that what D has is already quite nice!
Jun 04 2010
Thu, 03 Jun 2010 16:58:03 -0700, Walter Bright wrote:D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Well, I for one, like to know when the D2 will be officially published. I thought there was a bugfix week and the TDPL was written because D2 is almost ready and there was supposed to be a big kaboom. The version number is already at 2.046 but there are maybe 100 bugs waiting in the bugzilla with patches and the compiler & spec are seriously broken. When will it be usable? What will be the version number of the first usable D2 dmd? There was a "huge" D1 release party, but I'm not sure when it's a good time to move to D2. It's not enough that the examples from the book work, D needs to be ready for commercial quality applications. What's the library status? Where are the official milestones? Future plans? What's happening here?
Jun 03 2010
== Quote from retard (re tard.com.invalid)'s articleThu, 03 Jun 2010 16:58:03 -0700, Walter Bright wrote:http://www.youtube.com/watch?v=8r1CZTLk-Gk thanx fer yer self entitlement asshole.D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Well, I for one, like to know when the D2 will be officially published. I thought there was a bugfix week and the TDPL was written because D2 is almost ready and there was supposed to be a big kaboom. The version number is already at 2.046 but there are maybe 100 bugs waiting in the bugzilla with patches and the compiler & spec are seriously broken. When will it be usable? What will be the version number of the first usable D2 dmd? There was a "huge" D1 release party, but I'm not sure when it's a good time to move to D2. It's not enough that the examples from the book work, D needs to be ready for commercial quality applications. What's the library status? Where are the official milestones? Future plans? What's happening here?
Jun 03 2010
superdan Wrote:== Quote from retard (re tard.com.invalid)'s articleyup. too many people take D for granted and only bitch about things it lacks and never see lot of great features it already has. it is usable and it is fucking better than c and c++!Thu, 03 Jun 2010 16:58:03 -0700, Walter Bright wrote:http://www.youtube.com/watch?v=8r1CZTLk-Gk thanx fer yer self entitlement asshole.D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Well, I for one, like to know when the D2 will be officially published. I thought there was a bugfix week and the TDPL was written because D2 is almost ready and there was supposed to be a big kaboom. The version number is already at 2.046 but there are maybe 100 bugs waiting in the bugzilla with patches and the compiler & spec are seriously broken. When will it be usable? What will be the version number of the first usable D2 dmd? There was a "huge" D1 release party, but I'm not sure when it's a good time to move to D2. It's not enough that the examples from the book work, D needs to be ready for commercial quality applications. What's the library status? Where are the official milestones? Future plans? What's happening here?
Jun 04 2010
Walter Bright:Anyone have good ideas on topics for D articles?Here are 7 possible articles: 1) We can write some cool larghish library/program and then show the results of the program, something like a small 2D or 3D game, a numerical plotting lib, etc. Graphics is very good because it catches the eye even if it's something simple. For example I'd like to translate a small CPS (Constraint Problem Solver) like this into a single D2 module: http://labix.org/python-constraint Once written such module can be the basis for a "cool" article about one D2 usage (and then I can use the CPS module in various ways). I have other ideas for useful/nice single modules for D2, there are plenty of ideas to copy from in repositories of modules/programs written in Python, Perl, Ruby, Clojure, etc. 2) Another possibility is to appeal to the C++ crowd, for example translating this C++ to D2: http://accu.org/index.php/journals/1422 A literal translation of the C++ code of this article to D2 is possible, but at the end of the D2 article it can show that there is a better solution in D2, like using variable-argument templated structs to implement n-way trees of types, as I have discussed a bit with Downs (keeping in mind that C++0x too has variable-argument templates. If you want to compare D2 with C++ to show D2 then you *must* use C++0x otherwise people will say you are cheating). 3) This is another awesome small C++ program that must be translated to D2 (but I am not certain this is the most updated version of this program), it's just a single C++ file about 24 KB of code and heavely templated, and in my opinion no other language beside C++ and D (and maybe Lisp) can be used to write a program so fast and so short to solve this: http://www.codeguru.com/cpp/misc/samples/games/article.php/c13607/ It's textual and console-based code, so almost no libs are required. Once translated, this can be the basis for a good article that explains the D2 code, templates, etc. 4) Another quite interesting article can show how to implement Expression templates in D2, like the ones used in Blitz++ and successive libs: http://en.wikipedia.org/wiki/Expression_templates (If this article uncovers problems in D2 language then it's better to find them now than later :-) ). 5) You have noticed that I write a lot in this newsgroup. My recent "Huffman coding comparison" post can be seen as an article that shows D2 and Phobos2 because the D2 code I've shown there is nice looking. 6) You can find C++0x variadic templates articles that can be translated to D2: http://www.jot.fm/issues/issue_2008_02/article2/ http://mlangc.wordpress.com/2010/04/18/using-c0x-variadic-templates-to-pretty-print-types/ 7) This is one of the changes in G++ 4.5: http://gcc.gnu.org/gcc-4.5/changes.htmlCompilation time for code that uses templates should now scale linearly with the number of instantiations rather than quadratically, as template instantiations are now looked up using hash tables.<So an article about D2 can show how DMD template performance is compared to the template performance of G++ 4.5. See also: http://cpptruths.blogspot.com/2010/03/faster-meta-programs-using-gcc-45-and.html Bye, bearophile
Jun 03 2010
I recently rewrote a huge PHP application in D2. It isn't a completely fair comparison, since the PHP was written by, well to be polite, PHP "programmers", but the results were pretty astounding. 90% reduction in lines of code [!], 200% improvement in speed under heavy load (only 50% improvement under light load, still good, but not as good), and the code is actually maintainable! Also, the original took about a year for the first team to write. My D rewrite took 6 weeks. Oh yeah, and the PHP is riddled with security holes. Not so much with the D. The best part about the speed is that it is just running as plain old CGI and my code does a lot of inefficient looping through XML. I could probably double the speed again by improving that. I might be able to write this into an article, but what I've done so far is just showed it off to other coders in some private messages on forums. A complication in publically showing it off is it is closed source though. The speed advantage isn't apparent until the code actually does something; PHP is much faster for hello world, but gets spanked when it comes to the actual work.
Jun 03 2010
"Adam Ruppe" <destructionator gmail.com> wrote in message news:mailman.103.1275615255.24349.digitalmars-d puremagic.com...I recently rewrote a huge PHP application in D2. It isn't a completely fair comparison, since the PHP was written by, well to be polite, PHP "programmers", but the results were pretty astounding. 90% reduction in lines of code [!], 200% improvement in speed under heavy load (only 50% improvement under light load, still good, but not as good), and the code is actually maintainable! Also, the original took about a year for the first team to write. My D rewrite took 6 weeks. Oh yeah, and the PHP is riddled with security holes. Not so much with the D. The best part about the speed is that it is just running as plain old CGI and my code does a lot of inefficient looping through XML. I could probably double the speed again by improving that.Comparing D to PHP is like comparing a 747 to the Hindenburg. :)
Jun 03 2010
On 06/03/2010 08:34 PM, Adam Ruppe wrote:I recently rewrote a huge PHP application in D2. It isn't a completely fair comparison, since the PHP was written by, well to be polite, PHP "programmers", but the results were pretty astounding. 90% reduction in lines of code [!], 200% improvement in speed under heavy load (only 50% improvement under light load, still good, but not as good), and the code is actually maintainable! Also, the original took about a year for the first team to write. My D rewrite took 6 weeks. Oh yeah, and the PHP is riddled with security holes. Not so much with the D. The best part about the speed is that it is just running as plain old CGI and my code does a lot of inefficient looping through XML. I could probably double the speed again by improving that. I might be able to write this into an article, but what I've done so far is just showed it off to other coders in some private messages on forums. A complication in publically showing it off is it is closed source though. The speed advantage isn't apparent until the code actually does something; PHP is much faster for hello world, but gets spanked when it comes to the actual work.I think this is the best way to approach writing, and I strongly encourage you to just plow through whatever IP issues there are and go for it. (In my experience, nobody will come after you for writing an article that doesn't outright give the code away.) I'm repeating myself, but writing a good piece should at best start with a desire to share something you genuinely believe is interesting (as opposed to starting with a desire for developing an article and consequently looking for a topic idea). You seem to be right on the money. In related news... For what it's worth, I plan to write about memory-isolated containers (those that can use malloc/free for their allocation strategy without being unsafe). I believe there are a number of fine points to be made and that such containers solve an important class of problems. InformIT.com considers the idea interesting and commissioned me to write that article. I've also read again today this piece by Oleg Kiselyov: http://okmij.org/ftp/papers/LL3-collections-enumerators.txt Oleg is pretty awesome and makes great points, but I think also missed a few. The abstract is a bit difficult to get into (and I haven't understood his enumerator inversion trick without using continuations). I have a pretty good retort in my mind, but that would take quite a long time to write. Andrei
Jun 03 2010
Andrei Alexandrescu wrote:On 06/03/2010 08:34 PM, Adam Ruppe wrote:I agree with Andrei - write the article!I recently rewrote a huge PHP application in D2. It isn't a completely fair comparison, since the PHP was written by, well to be polite, PHP "programmers", but the results were pretty astounding. 90% reduction in lines of code [!], 200% improvement in speed under heavy load (only 50% improvement under light load, still good, but not as good), and the code is actually maintainable! Also, the original took about a year for the first team to write. My D rewrite took 6 weeks. Oh yeah, and the PHP is riddled with security holes. Not so much with the D. The best part about the speed is that it is just running as plain old CGI and my code does a lot of inefficient looping through XML. I could probably double the speed again by improving that. I might be able to write this into an article, but what I've done so far is just showed it off to other coders in some private messages on forums. A complication in publically showing it off is it is closed source though. The speed advantage isn't apparent until the code actually does something; PHP is much faster for hello world, but gets spanked when it comes to the actual work.I think this is the best way to approach writing, and I strongly encourage you to just plow through whatever IP issues there are and go for it. (In my experience, nobody will come after you for writing an article that doesn't outright give the code away.) I'm repeating myself, but writing a good piece should at best start with a desire to share something you genuinely believe is interesting (as opposed to starting with a desire for developing an article and consequently looking for a topic idea). You seem to be right on the money.In related news... For what it's worth, I plan to write about memory-isolated containers (those that can use malloc/free for their allocation strategy without being unsafe). I believe there are a number of fine points to be made and that such containers solve an important class of problems. InformIT.com considers the idea interesting and commissioned me to write that article.This is exactly what I'm talking about.
Jun 03 2010
Walter Bright wrote:I agree with Andrei - write the article!The most popular blog entry I wrote for DDJ, was the one on converting assembler code to C, based on my ongoing trenchwork actually doing it with optlink. People like articles about real world meat & potatoes language work. So I think your PHP => D experience would make for most interesting reading.
Jun 03 2010
Walter Bright wrote:Walter Bright wrote:A post-mortem style article or blog is nice, reading about the whole experience of the development process is often interesting. I remember one such an article at gamedev.net about D which was highly appreciated, while normally gamedev.net has a very critical crowd. Showing off cool features generally only works on people already convinced or in the know, for critics it usually evokes a 'so what' response. More questions and answers on stackoverflow might help too. I will try to make more use of that myself.I agree with Andrei - write the article!The most popular blog entry I wrote for DDJ, was the one on converting assembler code to C, based on my ongoing trenchwork actually doing it with optlink. People like articles about real world meat & potatoes language work. So I think your PHP => D experience would make for most interesting reading.
Jun 04 2010
Hello Walter,Walter Bright wrote:BTW: how does that go? -- ... <IXOYE><I agree with Andrei - write the article!The most popular blog entry I wrote for DDJ, was the one on converting assembler code to C, based on my ongoing trenchwork actually doing it with optlink.
Jun 04 2010
BCS wrote:veeeeeerrrrrreeeee sssssslllllllooooooollllllllyyyyyyyThe most popular blog entry I wrote for DDJ, was the one on converting assembler code to C, based on my ongoing trenchwork actually doing it with optlink.BTW: how does that go?
Jun 04 2010
Hello Walter,BCS wrote:if(progress > 0) Ok(); -- ... <IXOYE><veeeeeerrrrrreeeee sssssslllllllooooooollllllllyyyyyyyThe most popular blog entry I wrote for DDJ, was the one on converting assembler code to C, based on my ongoing trenchwork actually doing it with optlink.BTW: how does that go?
Jun 04 2010
On 6/3/2010 9:34 PM, Adam Ruppe wrote:I recently rewrote a huge PHP application in D2. It isn't a completely fair comparison, since the PHP was written by, well to be polite, PHP "programmers", but the results were pretty astounding. 90% reduction in lines of code [!], 200% improvement in speed under heavy load (only 50% improvement under light load, still good, but not as good), and the code is actually maintainable! Also, the original took about a year for the first team to write. My D rewrite took 6 weeks. Oh yeah, and the PHP is riddled with security holes. Not so much with the D. The best part about the speed is that it is just running as plain old CGI and my code does a lot of inefficient looping through XML. I could probably double the speed again by improving that. I might be able to write this into an article, but what I've done so far is just showed it off to other coders in some private messages on forums. A complication in publically showing it off is it is closed source though. The speed advantage isn't apparent until the code actually does something; PHP is much faster for hello world, but gets spanked when it comes to the actual work.I've spent years in both D and PHP, and most of my php code is a little shorter than what the equivalent would be in D, mostly due to an enormous standard library. Now D is much better designed and much faster, but most php programs are trash because the language attracts so many noobs. I've spent a lot of time rewriting PHP apps in PHP that ended up being 10% of the length of the original. I prefer D to PHP, but writing a web app in D would take me much longer due to the lack of web-oriented libraries. However, the speedup you got with D is a good angle to push.
Jun 04 2010
On 6/4/10, Eric Poggel <dnewsgroup yage3d.net> wrote:I prefer D to PHP, but writing a web app in D would take me much longer due to the lack of web-oriented libraries.What kind of stuff would you need? I admit I did spend several weekends doing prep work on libraries before proposing it to the client - had to write mysql, cgi, http get and post, my xml code, and some helper functions to extend std.json before I was confident enough in having the libraries to propose it, but now I have that, and can share if it sounds useful. The only place where library lacking has hit me so far is interfacing with Facebook. For that part of the app, I still use PHP. I'd like to port it eventually, implementing oauth and such in a nice, generic way, but I haven't gotten around to it yet... still, the vast majority of what I need I can do now in plain D.
Jun 04 2010
On 6/4/2010 11:13 AM, Adam Ruppe wrote:On 6/4/10, Eric Poggel<dnewsgroup yage3d.net> wrote:It would be nice to have a web library for D, but my web development has been almost exclusively for shared hosting environments. Also, most web developers know PHP while zero know D. Clients would see that as lock-in.I prefer D to PHP, but writing a web app in D would take me much longer due to the lack of web-oriented libraries.What kind of stuff would you need? I admit I did spend several weekends doing prep work on libraries before proposing it to the client - had to write mysql, cgi, http get and post, my xml code, and some helper functions to extend std.json before I was confident enough in having the libraries to propose it, but now I have that, and can share if it sounds useful. The only place where library lacking has hit me so far is interfacing with Facebook. For that part of the app, I still use PHP. I'd like to port it eventually, implementing oauth and such in a nice, generic way, but I haven't gotten around to it yet... still, the vast majority of what I need I can do now in plain D.
Jun 04 2010
"Eric Poggel" <dnewsgroup yage3d.net> wrote in message news:huck02$1rel$1 digitalmars.com...On 6/4/2010 11:13 AM, Adam Ruppe wrote:A lot of clients I know wouldn't know the difference anyway, and thus wouldn't misinterpret it as lock-in. (Guess I've been lucky in that regard :) ) Although, if a client is really savvy (not that that's common), they'd know that 1. While PHP developers are abundant, *good* PHP developers are about as rare as any non-mainstream language and 2. When you know how to code in a language, transferring those skills to a similar language (for example, imperative-to-imperative) is fairly easy (That's a fact that, unfortunately, seems to be completely unknown by non-programmers, especially HR people...which is one of the reasons I consider HR people to be nothing but worthless morons that collect a paycheck without contributing anything worthwhile to society, and in fact, only serve to drag society down. It *should* be their job to know such things, but they don't, and those societal leeches get paid anyway...I even talked to one headhunter (they're like HR people but even worse) who was actually stupid enough to blurt out "I don't know anything about programming, but I can identify people who are good at it"...riiiight, like that's even conceivably possible outside her hometown of looneyville...but I'm veering waaay offtopic...). Regarding support for custom cgi on shared hosts: I looked into that recently on the shared hosts I typically deal with, and it turned out to be more widely supported than I thought. Maybe I've just been lucky on that too, but it could be you're underestimating the support for it like I was. Also, even if support for a language among shared hosts is small, the only way that's ever going to change is if a lot of developers want it. And the only way that's ever going to happen (these days) is if there's a good web library for the language. (Not that that'll guarantee success, but it would be a necessary step.)On 6/4/10, Eric Poggel<dnewsgroup yage3d.net> wrote:It would be nice to have a web library for D, but my web development has been almost exclusively for shared hosting environments. Also, most web developers know PHP while zero know D. Clients would see that as lock-in.I prefer D to PHP, but writing a web app in D would take me much longer due to the lack of web-oriented libraries.What kind of stuff would you need? I admit I did spend several weekends doing prep work on libraries before proposing it to the client - had to write mysql, cgi, http get and post, my xml code, and some helper functions to extend std.json before I was confident enough in having the libraries to propose it, but now I have that, and can share if it sounds useful. The only place where library lacking has hit me so far is interfacing with Facebook. For that part of the app, I still use PHP. I'd like to port it eventually, implementing oauth and such in a nice, generic way, but I haven't gotten around to it yet... still, the vast majority of what I need I can do now in plain D.
Jun 04 2010
Thu, 03 Jun 2010 21:34:05 -0400, Adam Ruppe wrote:I recently rewrote a huge PHP application in D2. It isn't a completely fair comparison, since the PHP was written by, well to be polite, PHP "programmers", but the results were pretty astounding. 90% reduction in lines of code [!], 200% improvement in speed under heavy load (only 50% improvement under light load, still good, but not as good), and the code is actually maintainable! Also, the original took about a year for the first team to write. My D rewrite took 6 weeks. Oh yeah, and the PHP is riddled with security holes. Not so much with the D.News at eleven! A rewrite of a shitty old version is better than the original. Now this proves that especially D2 should be used for rewriting everything! How surprising.
Jun 05 2010
On 6/5/10, retard <re tard.com.invalid> wrote:A rewrite of a shitty old version is better than the original.The really interesting thing is how D on plain old CGI also performed better than fairly popular PHP applications as well, like phpBB3, WordPress and MediaWiki (determined by comparing individual pages that did basically the same thing. Not exactly though, so not a fully fair comparison)
Jun 05 2010
On 06/05/2010 09:10 AM, Adam Ruppe wrote:The really interesting thing is how D on plain old CGI also performed better than fairly popular PHP applications as well, like phpBB3, WordPress and MediaWiki (determined by comparing individual pages that did basically the same thing. Not exactly though, so not a fully fair comparison)Why is this interesting? D is a static, compiled, "system" language designed to be near the speed of C. PHP is a scripting language, similar to Perl, but built to make web coding easier. And I agree with "retard" that if you rewrite something crappy (or even not so crappy), the new version will be better than the original. If you want your article to be taken seriously, you'll have to show code written in idiomatic PHP that benefits from being written in idiomatic D.
Jun 05 2010
On 6/5/10, Jeff Nowakowski <jeff dilacero.org> wrote:Why is this interesting? D is a static, compiled, "system" language designed to be near the speed of C. PHP is a scripting language, similar to Perl, but built to make web coding easier.The reason I did the benchmarks was because I was talking to someone about it, and he said "yeah, php sucks, but isn't CGI really slow?" It isn't, not with D. If you don't address request speed and scalability, nobody's going to listen to the other benefits. Opening with a statement like "200% faster" keeps their attention. The biggest benefit, however, isn't running speed, but instead code maintainability.If you want your article to be taken seriously, you'll have to show code written in idiomatic PHP that benefits from being written in idiomatic D.That's the plan. I'm hoping to write this up next weekend.
Jun 05 2010
On 06/06/10 00:06, Adam Ruppe wrote:On 6/5/10, Jeff Nowakowski<jeff dilacero.org> wrote:It isn't anyway, at least not with fastcgi - take mod_php vs php in fcgi, fcgi is far *far* faster.Why is this interesting? D is a static, compiled, "system" language designed to be near the speed of C. PHP is a scripting language, similar to Perl, but built to make web coding easier.The reason I did the benchmarks was because I was talking to someone about it, and he said "yeah, php sucks, but isn't CGI really slow?" It isn't, not with D.If you don't address request speed and scalability, nobody's going to listen to the other benefits. Opening with a statement like "200% faster" keeps their attention.That is a huge speed improvement, always a good opening statement!The biggest benefit, however, isn't running speed, but instead code maintainability.Being the only two languages I'd call myself fluent in, I'd definitely call D easier to maintain than PHP... I guess this is easily debatable though.If you want your article to be taken seriously, you'll have to show code written in idiomatic PHP that benefits from being written in idiomatic D.That's the plan. I'm hoping to write this up next weekend.
Jun 05 2010
On 6/5/10, Robert Clipsham <robert octarineparrot.com> wrote:It isn't anyway, at least not with fastcgi - take mod_php vs php in fcgi, fcgi is far *far* faster.My numbers are all plain old vanilla CGI; fcgi would probably be better yet. My hypothesis is that CGI gets its reputation because it has a relatively high start up cost, so it gets horrible numbers for hello world benchmarks. But, start up is a small percentage of a real world program's actual running time, so for most non-trivial programs, having faster code quickly erases CGI's initial deficit.
Jun 05 2010
"Robert Clipsham" <robert octarineparrot.com> wrote in message news:huembk$2660$1 digitalmars.com...Being the only two languages I'd call myself fluent in, I'd definitely call D easier to maintain than PHP... I guess this is easily debatable though.Easily debatable? Not without an existing brain injury ;) I've used a lot of different languages. PHP's maintainability is one of the worst I've ever seen. The whole design of it *begs* for bugs. Hell, PHP is the only (*cough*) modern (*cough*) language I can think of where bugs can actually be introduced without any programmer involvement and without even touching a single line of code. The sysadmin just needs to change any one of certain PHP server settings (or move the code to another server that isn't configured exactly the same), and suddenly random parts of the code are silently broken and the programmer is screwed. An old example is magic quotes - your code will magically (and silently) break if the setting is changed without adjusting the code to compensate. Yea, I know they're deprecated in PHP5 and removed in PHP6, but it's just one off-the-top-of-my-head example of a bigger theme: It's standard practice by PHP's creators to toss in language-changing server settings, and without even having predictable defaults (the *defaults* can be configured. Seriously, WTF?). These settings often either can't be adjusted in the code itself (ex: magic quotes) or can only *sometimes* be adjusted in the code depending on how the server settings are configured (I think some session-management stuff falls into this category...and speaking of PHP's session-management...well, better *not* to speak of it). So not only does stuff change from one PHP version to another, but even within a *single exact* version of PHP you *still* have 2^^n number of what are essentially different languages, and no realistic way to work around it. So to write good reliable code in PHP: First, you have to have a deep understanding of every fucking setting offered by every version of PHP that you use. Of course, many of the important gotchas are completely undocumented and you have to go by hearsay and anecdotal advice. So good luck with that. Then you have to identify which of those settings might cause problems depending on how they're set and make sure to set them properly at the start of every single page (not always easy when your "package" system is one step away from the C preprocessor). Then, for the ones you can't change (because of either your sysadmin or PHP itself), you have to find the common "safe" subset and not venture beyond it (Ex: goodbye '<%%>' and '<??>', it's '<?php ?>' or nothing). When there isn't a safe common subset you can rely on (ex: magic quotes) you have to detect the active setting (if possible) and adapt. Of course, even doing that isn't always possible. Then when the server's PHP is upgraded, you have to check everything all over again (or just pray). Oh, and did I mention sometimes the OS and OS-configuration abstractions leek? Needless to say, writing good reliable code in PHP is realistically impossible (frankly, I don't even bother to try anymore). And if you want to make a re-usable library...hah! Ha ha ha!! Ah ha ha ha ha ha!!! So, PHP maintainability? Welcome to hell. PHP is evilness itself, given form as a programming language. Given a choice, I would seriously consider writing classic-ASP in VBScript on a WinME workstation running Microsoft Bob with an IDE that included Clippy if the only alternative was to do a big project in hand-written PHP.
Jun 05 2010
On 06/06/10 03:02, Nick Sabalausky wrote:"Robert Clipsham"<robert octarineparrot.com> wrote in message news:huembk$2660$1 digitalmars.com...Or worse, security issues - heck, the examples on php.net are so easy for someone new to the language to use to introduce a large number of security issues with it's unbelievable. It doesn't take much to find a number of SQL injections in the code most PHP devs write - it's so easy to do! If only there were a language that made safe operations easy to do and harder more bug prone things harder to do :3Being the only two languages I'd call myself fluent in, I'd definitely call D easier to maintain than PHP... I guess this is easily debatable though.Easily debatable? Not without an existing brain injury ;) I've used a lot of different languages. PHP's maintainability is one of the worst I've ever seen. The whole design of it *begs* for bugs.Hell, PHP is the only (*cough*) modern (*cough*) language I can think of where bugs can actually be introduced without any programmer involvement and without even touching a single line of code. The sysadmin just needs to change any one of certain PHP server settings (or move the code to another server that isn't configured exactly the same), and suddenly random parts of the code are silently broken and the programmer is screwed. An old example is magic quotes - your code will magically (and silently) break if the setting is changed without adjusting the code to compensate. Yea, I know they're deprecated in PHP5 and removed in PHP6, but it's just one off-the-top-of-my-head example of a bigger theme:My favourite is register_globals - not only does it introduce bugs, it allows for remote code execution! Gotta love that ;)It's standard practice by PHP's creators to toss in language-changing server settings, and without even having predictable defaults (the *defaults* can be configured. Seriously, WTF?). These settings often either can't be adjusted in the code itself (ex: magic quotes) or can only *sometimes* be adjusted in the code depending on how the server settings are configured (I think some session-management stuff falls into this category...and speaking of PHP's session-management...well, better *not* to speak of it). So not only does stuff change from one PHP version to another, but even within a *single exact* version of PHP you *still* have 2^^n number of what are essentially different languages, and no realistic way to work around it.Fortunately you can detect what's disabled/how it's configured etc in the script, it means you have to write 1000LoC of checks etc before every php app you write if you want it to be supported by a selection of hosts. Refusing anything less than PHP 5.2 helps here, there's still loads of checks you've gotta do though. I generally find the best way to avoid bugs due to different configs/PHP versions is to use error_reporting( E_ALL | E_STRICT | E_DEPRECATED ); at the start of all my code, even that has to check the PHP version though thanks to E_DEPRECATED... and there'll still be some bugs that manage to slip through :3So to write good reliable code in PHP:I was gonna make a witty remark here, I found it turning into a rant so I removed it though :3First, you have to have a deep understanding of every fucking setting offered by every version of PHP that you use. Of course, many of the important gotchas are completely undocumented and you have to go by hearsay and anecdotal advice. So good luck with that.This is completely true. Using some kind of PHP framework usually solves this problem for you as they do all the checks etc generally, it's still not perfect though, and the developer still has to be aware of what the framework actually checks for.Then you have to identify which of those settings might cause problems depending on how they're set and make sure to set them properly at the start of every single page (not always easy when your "package" system is one step away from the C preprocessor).If you can set them properly that is :3 Gotta hate safe mode/the ability of clueless admins to disable functions which don't pose any security vulnerability to the server but they're adamant they do.Then, for the ones you can't change (because of either your sysadmin or PHP itself), you have to find the common "safe" subset and not venture beyond it (Ex: goodbye '<%%>' and'<??>', it's'<?php ?>' or nothing). When there isn't a safe common subset you can rely on (ex: magic quotes) you have to detect the active setting (if possible) and adapt. Of course, even doing that isn't always possible.trigger_error( "Your setup sucks, damned if I'm writing code that supports it :3", E_USER_ERROR ); I love not having to write commercial code where supporting idiots is mandatory, I'd rather not spend 90% of my time making sure my code works on different setups :3Then when the server's PHP is upgraded, you have to check everything all over again (or just pray). Oh, and did I mention sometimes the OS and OS-configuration abstractions leek? Needless to say, writing good reliable code in PHP is realistically impossible (frankly, I don't even bother to try anymore). And if you want to make a re-usable library...hah! Ha ha ha!! Ah ha ha ha ha ha!!!Fat chance of that if they've got register_globals enabled or magic_quotes etc. You'll be lucky if they upgrade in a few years :3 This said, there are people who are *that* stupid.So, PHP maintainability? Welcome to hell. PHP is evilness itself, given form as a programming language. Given a choice, I would seriously consider writing classic-ASP in VBScript on a WinME workstation running Microsoft Bob with an IDE that included Clippy if the only alternative was to do a big project in hand-written PHP.I guess I'm lucky here, all the PHP I ever have to write now is supported by a framework/CMS that some guy who knows what he's doing made, I've yet to have any issues with it anywhere it's been run fortunately. I'd put money on this not being the case for most people though. I would be curious as to how well D/FastCGI works, guess I'll have to have a play at some point. Robert
Jun 06 2010
"Robert Clipsham" <robert octarineparrot.com> wrote in message news:hufr5k$vnd$1 digitalmars.com...On 06/06/10 03:02, Nick Sabalausky wrote:Heh heh. "good reliable code in PHP" *is* a contradiction of terms, after all ;)So to write good reliable code in PHP:I was gonna make a witty remark here, I found it turning into a rant so I removed it though :3I guess I'm lucky here, all the PHP I ever have to write now is supported by a framework/CMS that some guy who knows what he's doing made, I've yet to have any issues with it anywhere it's been run fortunately. I'd put money on this not being the case for most people though.As much as I prefer to write Haxe (and then compile it down to PHP), one of the [many] things that bugs me about Haxe is that it doesn't appear to do any of those checks automatically. Big missed opportunity there.I would be curious as to how well D/FastCGI works, guess I'll have to have a play at some point.I've been positively salivating at the idea of combining D, FastCGI and a D-ified rails-like framework. Haven't gotten around to it though. Fortunately, I did recently find out that the hosts I'm currently using allow custom-made CGI. Unfortunately, I can't use FastCGI on them, although I've been getting so fed up with PHP lately (both the PHP language and the PHP platform - Haxe only sheilds you from [parts of] the language, not the platform), that I think I can live perfectly happily without FastCGI.
Jun 06 2010
On 06/06/10 18:26, Nick Sabalausky wrote:Heh heh. "good reliable code in PHP" *is* a contradiction of terms, after all ;)<?php echo 'Not true! D:', "\n"; ?> This said, I bet we could find a case where that doesn't work properly :3As much as I prefer to write Haxe (and then compile it down to PHP), one of the [many] things that bugs me about Haxe is that it doesn't appear to do any of those checks automatically. Big missed opportunity there.I've never really looked into haxe, but I agree, if it doesn't do those checks it's fairly useless - have you made a bug report? Your dreams could come true... Or you could forget and be forced to use D.. Dang!I've been positively salivating at the idea of combining D, FastCGI and a D-ified rails-like framework. Haven't gotten around to it though. Fortunately, I did recently find out that the hosts I'm currently using allow custom-made CGI. Unfortunately, I can't use FastCGI on them, although I've been getting so fed up with PHP lately (both the PHP language and the PHP platform - Haxe only sheilds you from [parts of] the language, not the platform), that I think I can live perfectly happily without FastCGI.I've been toying with the same idea, the framework I've been looking at porting uses a lot of runtime reflection though which I'm not sure is easy enough to do in D1. I've strayed away from D2 now after a couple of unsuccessful attempts at using it. Robert
Jun 06 2010
"Robert Clipsham" <robert octarineparrot.com> wrote in message news:hugmcq$2e8b$1 digitalmars.com...On 06/06/10 18:26, Nick Sabalausky wrote:I was thinking the same thing!Heh heh. "good reliable code in PHP" *is* a contradiction of terms, after all ;)<?php echo 'Not true! D:', "\n"; ?> This said, I bet we could find a case where that doesn't work properly :3You can still do the checks yourself. And the language itself, while certainly no D, is at least an improvement over using PHP directly. So it's still a net win, just not as big of a win as it could be.As much as I prefer to write Haxe (and then compile it down to PHP), one of the [many] things that bugs me about Haxe is that it doesn't appear to do any of those checks automatically. Big missed opportunity there.I've never really looked into haxe, but I agree, if it doesn't do those checks it's fairly useless -have you made a bug report? Your dreams could come true...Yes, probably worth a shot, but I think I like your other idea below better... ;)Or you could forget and be forced to use D.. Dang!Haxe already has a rails-like framework I've been using (Haxe Igniter). It does have room for improvement, though. In fact I ended up hacking up a few things in it. But yea, I've been really itching to make one in D. But hell, with more immediate paid(-ish) work in the way, it's taking me long enough just to get the next version of my Goldie project out.I've been positively salivating at the idea of combining D, FastCGI and a D-ified rails-like framework. Haven't gotten around to it though. Fortunately, I did recently find out that the hosts I'm currently using allow custom-made CGI. Unfortunately, I can't use FastCGI on them, although I've been getting so fed up with PHP lately (both the PHP language and the PHP platform - Haxe only sheilds you from [parts of] the language, not the platform), that I think I can live perfectly happily without FastCGI.I've been toying with the same idea, the framework I've been looking at porting uses a lot of runtime reflection though which I'm not sure is easy enough to do in D1. I've strayed away from D2 now after a couple of unsuccessful attempts at using it.
Jun 06 2010
You just made me feel much less guilty that PHP's syntax turned me off back in my java days.
Jun 06 2010
"Adam Ruppe" <destructionator gmail.com> wrote in message news:mailman.111.1275779198.24349.digitalmars-d puremagic.com...On 6/5/10, Jeff Nowakowski <jeff dilacero.org> wrote:Yea, justified or not, it's a very prevailant belief in the web dev world that CGI == slow (since the whole process is reloaded on every request). In fact, until Adam mentioned his results, I had been wondering how CGI's overhead compared to the speed hit from using something like PHP (Of course, it probably depends on other things too, like Win vs Unix, Apache vs IIS, how much processing is actually done to generate the page, etc). And there's a lot of web devs and managers out there who would never even think to question their ingrained belief that CGI is slow. There's fastcgi, of course, but a lot of web devs (and managers) have never even heard of that.Why is this interesting? D is a static, compiled, "system" language designed to be near the speed of C. PHP is a scripting language, similar to Perl, but built to make web coding easier.The reason I did the benchmarks was because I was talking to someone about it, and he said "yeah, php sucks, but isn't CGI really slow?" It isn't, not with D.
Jun 05 2010
"Walter Bright" <newshound1 digitalmars.com> wrote in message news:hu9fic$24ic$1 digitalmars.com...D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_func ion_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.More of a long term-thing, but D needs a couple of "killer libs" (for instance, a really good D version of something Rails-like). Then, of course, an article walking through the use of it to easily create something fancy.
Jun 03 2010
"Nick Sabalausky" <a a.a> wrote in news:hu9na8$2hho$1 digitalmars.com:More of a long term-thing, but D needs a couple of "killer libs" (for instance, a really good D version of something Rails-like). Then, of course, an article walking through the use of it to easily create something fancy.I think I've said this before, but D needs a two killer apps plus one medical journal article. One of the killer apps needs to be commercial/proprietary so that people can see money being made with D. The other killer app needs to be open source so that contributors have to use D to work on it. The medical journal article needs to report that contributing to the open source app cures erectile dysfunction disorder.
Jun 03 2010
One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_func ion_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article?What about a followup article about more sophisticated CTFE, maybe in combination with string mixins to generate complex code? For example, if std.regex is evaluatable at compile time I will probably use it create some skeleton code out of an interface definition.
Jun 03 2010
Walter Bright wrote:Anyone have good ideas on topics for D articles?Yes, I think the relevant themes are: features from such competitor languages. 2. D does not require the programmer to use only one particular paradigm, at the option of imperative, object oriented, and metaprogramming; does not require significant change of syntax, helps migrating to D quickly from C/C++, while significantly increasing productivity; direct linking with C libraries; direct access to the native OS interface. I also should mention, these need improvement in D: 1. Concurrency support and optimization for multicore/multiprocessor/GPGPU systems. 2. Better toolchain support. The first two inspired me to try the D. The second two should inspire the others. -- Alex Makhotin, the founder of BITPROX, http://bitprox.com
Jun 04 2010
On 2010-06-04 01:58:03 +0200, Walter Bright said:D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_func ion_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.I will write a blog article how I used D to write an extension DLL for the Rebol-3 language. I used the C stuff and ported it over in a couple of hours. Being now able to use D on the compile side give totally new possibilities. On the other hand those articles should focus on those complaints and sighs topics from other languages and show how elegant D can solve it. To keep the link. -- Robert M. Münch http://www.robertmuench.de
Jun 04 2010
Might be unimportant and off topic, but I think cool website might be nice first impression. As I see, almost all effort is in direction of converting existing programmers to D. We are maybe forgetting about inexperienced people that are just looking for first (compiled) language. They usually chose easiest to use right away, with most understandable docs and easiest installation.
Jun 04 2010
Walter Bright wrote:D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_func ion_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Great idea .. an article in Linux Journal about how D is the ideal language for producing shared object (.so) libraries on *nix would be a cool topic to assist the marketing effort.
Jun 04 2010
On Sat, 05 Jun 2010 02:24:40 +0930, Justin Johansson wrote:Walter Bright wrote:compiletime_function_execution_in_d/D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/+1, that is a killer feature. Wishing for the day when I can build x86-64 shared libs with DMD2... Grahamwhich was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.Great idea .. an article in Linux Journal about how D is the ideal language for producing shared object (.so) libraries on *nix would be a cool topic to assist the marketing effort.
Jun 04 2010
how to generate a header file in the source files dir? when i wan't get a big project like dwtx headers, i like push all source file to dmd and gener= ate header file, but there is a lot source file have same name, and i only get one header file in dmd run dir or Hd dir=E3=80=82 This is very inconvenient for such a large projects, Is there any way to avoid this problem? 2010/6/4 Walter Bright <newshound1 digitalmars.com>D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved wi=thD. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects =ofD and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_e=xecution_in_d/ which was well received on reddit.Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.
Jun 04 2010
On 06/03/2010 07:58 PM, Walter Bright wrote:D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.One thing that I think will really make people really notice D is std.concurrency. If it makes concurrency as easy as that in Erlang, that will be a huge win and definitely make it stand out vs. many other languages. Here are some other thoughts: - Compare D to scripting languages like Perl and Python to show how you can do similar things. I suggest this because to me, it seems like D compares very nicely to Perl 5 in terms of getting things done. Also, if you show that the code is about as easy to write, fast to compile, and can do the job in less time, win! - Re-write some basic Unix utilities in D and compare the code. grep would probably be a good one to start with since it can leverage D's built in regular expressions. - Show how much better D is at handling errors/exceptions with some real-world examples. A big win would be to show that D can resist some common attacks, such as buffer overflows. That would be interesting to people who have to write secure network applications. Casey
Jun 04 2010
"Walter Bright" <newshound1 digitalmars.com> wrote in message news:hu9fic$24ic$1 digitalmars.com...D is an extremely powerful language,Like OxyClean! (?)but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D.So will this snakeoil solve my rheumatoid arthritis?Essentially, we have a marketing problem.Go (go pun intended) figure?.One great way to address itWhoa, you presented a "hypothesis", and are now "embarking off on it" and soliciting others to do the same and take it for granted that your "hypothesis" (or whatever it was) is good. It's one thing to throw good money after bad. It's quite another to draw other people into your losing game.
Jun 05 2010
"Walter Bright" <newshound1 digitalmars.com> wrote in message news:hu9fic$24ic$1 digitalmars.com...D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_func ion_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.I think you have and have had good intent (that is not necessarily a reality, just a hope, I don't trust anyone or believe anything). I don't diss you. If I had a compiler to build, I'd send out an RFP to you, maybe. If I had a "task" to fill that required a "language builder", I wouldn't call on you, knowing what I know about you and this place. I know you're old, so I won't task you with riddles, so I'll give that answer: "building a language", is not a task on a project manager's schedule. You have kids (I hope!). I think you should put D in maintenance mode (like C and C++ are).
Jun 05 2010
I think Walter has been doing a great job with D. I do not like all the choices he has made (I am more radical when it is about breaking old habits from C) but, overall, D is an admirable and well-balanced language. And dmd a quite nice compiler. I hope it will be on 64-bits asap. I admire and use Walter's work. eles == Quote from ArnoldSSchwartz (asschwann usenet.com)'s article"Walter Bright" <newshound1 digitalmars.com> wrote in message news:hu9fic$24ic$1 digitalmars.com...areD is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problemscompiletime_function_execution_in_d/solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/towhich was well received on reddit. Anyone have good ideas on topics for D articles? And anyone wantthosestand up and write an article? They don't have to be comprehensive articles (though of coursedon'tare better), even blog entries will do.I think you have and have had good intent (that is not necessarily a reality, just a hope, I don't trust anyone or believe anything). Idiss you. If I had a compiler to build, I'd send out an RFP to you, maybe. If I had a "task" to fill that required a "languagebuilder", Iwouldn't call on you, knowing what I know about you and this place.Iknow you're old, so I won't task you with riddles, so I'll give that answer: "building a language", is not a task on a project manager's schedule. You have kids (I hope!). I think you should put D in maintenancemode(like C and C++ are).
Jun 06 2010
"eles" <eles eles.com> wrote in message news:hufl4b$mkf$1 digitalmars.com...but, overall, D is an admirable and well-balanced language.Why?And dmd a quite nice compiler.ech. That's just technical detail.I hope it will be on 64-bits asap.It doesn't seem so hard to do. I am surprised to hear that there was no such forsight. I don't build any 32-bit computers anymore. Win 7 64-bit only.
Jun 06 2010
Am 04.06.2010 01:58, schrieb Walter Bright:D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, like http://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/ which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.what about writing an "connect" example of D featureset usage in an C, or C++ and the way back - something that shows Ds interoperability - with some compiler (like intel/microsoft and borland) related tools, example what is needed to bring the different object-formats together
Jun 06 2010
dennis luehring wrote:with some compiler (like intel/microsoft and borland) related tools, example what is needed to bring the different object-formats togetherI experienced a runtime access violation on Windows when interoperating with the DLL created with the MSVC, which attempted to callback DMD executable. Mingw32 GCC is doing well, however cannot interoparate with XPCOM. Unless I'm doing something wrong, crosscompiler interoperability is a problem for me, however such issue have other languages. If there's a reference on how to face this kind of problems, I would be glad to have it, like other people which supposed to work with the D. -- Alex Makhotin, the founder of BITPROX, http://bitprox.com
Jun 06 2010
Am 06.06.2010 14:41, schrieb Alex Makhotin:dennis luehring wrote:perfekt scenario! can you provide us with some "small" example of working/non-working constructs? that combined with an more real example of the ABI-Usage will have the needed low-level-style for an good article/blog entry - Zarathustra got currently some ABI description problems in the D.learn group under the delegates with C linkage topic maybe we can all put together nice examples, talking about objs,assembler,call-styles etc.with some compiler (like intel/microsoft and borland) related tools, example what is needed to bring the different object-formats togetherI experienced a runtime access violation on Windows when interoperating with the DLL created with the MSVC, which attempted to callback DMD executable. Mingw32 GCC is doing well, however cannot interoparate with XPCOM. Unless I'm doing something wrong, crosscompiler interoperability is a problem for me, however such issue have other languages. If there's a reference on how to face this kind of problems, I would be glad to have it, like other people which supposed to work with the D.
Jun 06 2010
Am 06.06.2010 19:49, schrieb dennis luehring:Am 06.06.2010 14:41, schrieb Alex Makhotin:what about a large (splitted into smaller ones) article about 1. absolute low level D -> how to call C (maybe also small C++) examples using mingw,gcc,vs (different obj formats) and intel - and back (variables, functions, delegates, strings, etc...) 2. higher abstraction using Dll-Callbacks, Dll-Calling etc., Win-Api, COM 3. application leven XPCOM, JNI etc., Dot.Net? all combined with small "thats the detailed look in assembler, c-style" "what does microsoft, intel, etc. compiler do" good idea?dennis luehring wrote:perfekt scenario! can you provide us with some "small" example of working/non-working constructs? that combined with an more real example of the ABI-Usage will have the needed low-level-style for an good article/blog entry - Zarathustra got currently some ABI description problems in the D.learn group under the delegates with C linkage topic maybe we can all put together nice examples, talking about objs,assembler,call-styles etc.with some compiler (like intel/microsoft and borland) related tools, example what is needed to bring the different object-formats togetherI experienced a runtime access violation on Windows when interoperating with the DLL created with the MSVC, which attempted to callback DMD executable. Mingw32 GCC is doing well, however cannot interoparate with XPCOM. Unless I'm doing something wrong, crosscompiler interoperability is a problem for me, however such issue have other languages. If there's a reference on how to face this kind of problems, I would be glad to have it, like other people which supposed to work with the D.
Jun 06 2010
== Quote from Walter Bright (newshound1 digitalmars.com)'s articleD is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, likehttp://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.This probably won't be replied to because I'm starting a new sub-thread in a mature discussion, but I wonder if we could write about the advantages and disadvantages of duck typing vs. static typing, comparing Python vs. Java at first, then bring D into the picture to show how, to a greater extent than C++ without introducing the pitfalls of duck typing. Here's a simple example of something that would be awkward to impossible to do efficiently in any other language: /**Finds the largest element present in any of the ranges passed in.\ */ CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { // Quick and dirty impl ignoring error checking: typeof(return) ret = args[0].front(); foreach(arg; args) { foreach(elem; arg) { ret = max(elem, ret); } } return ret; } Do this in C++ -> FAIL because there are no variadics. (Yes, C++1x will have them, but I might die of old age by the time C++1x exists.) Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language? Do this in Java -> FAIL because arrays are primitives, not Objects and variadics only work with Objects. You can't easily make an array of arrays because the elements of args may be different but related types (e.g. int, float). of Object, which you have to cast, and w/o some extra information you don't know what to cast them to.
Jun 06 2010
On Sun, 6 Jun 2010 22:42:42 +0000 (UTC), dsimcha <dsimcha yahoo.com> wrote:== Quote from Walter Bright (newshound1 digitalmars.com)'s articleSeems like that example could be done fairly easily with Objective-C. Granted, it won't have the raw performance of D, but it might be worthwhile to point it out, since it (or rather, its superset on top of C) is duck typed. If someone were to create Objective-D, I think I'd die of happiness.D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, likehttp://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.This probably won't be replied to because I'm starting a new sub-thread in a mature discussion, but I wonder if we could write about the advantages and disadvantages of duck typing vs. static typing, comparing Python vs. Java at first, then bring D into the picture to show how, to a greater extent than C++ without introducing the pitfalls of duck typing. Here's a simple example of something that would be awkward to impossible to do efficiently in any other language: /**Finds the largest element present in any of the ranges passed in.\ */ CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { // Quick and dirty impl ignoring error checking: typeof(return) ret = args[0].front(); foreach(arg; args) { foreach(elem; arg) { ret = max(elem, ret); } } return ret; } Do this in C++ -> FAIL because there are no variadics. (Yes, C++1x will have them, but I might die of old age by the time C++1x exists.) Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language? Do this in Java -> FAIL because arrays are primitives, not Objects and variadics only work with Objects. You can't easily make an array of arrays because the elements of args may be different but related types (e.g. int, float).
Jun 06 2010
"dsimcha" <dsimcha yahoo.com> wrote in message news:huh892$agk$1 digitalmars.com.../**Finds the largest element present in any of the ranges passed in.\ */ CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { // Quick and dirty impl ignoring error checking: typeof(return) ret = args[0].front(); foreach(arg; args) { foreach(elem; arg) { ret = max(elem, ret); } } return ret; }I clearly haven't been following D2 closely enough. Or maybe I'm just more tired than I think... Can you explain that function signature?: CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) {Do this in C++ -> FAIL because there are no variadics. (Yes, C++1x will have them, but I might die of old age by the time C++1x exists.)C++0x^H^H1x is starting to remind me of Duke Nukem Forever. (Except I actually gave a rat's ass about Duke ;) )Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?I bet there's a lot of people who wouldn't bat an eye at that idea. Unfortunately.Do this in Java -> FAIL because arrays are primitives, not Objects and variadics only work with Objects. You can't easily make an array of arrays because the elements of args may be different but related types (e.g. int, float).I actually find that funny. Something in Java that isn't an Object? I remember "Everything's an object!" being paraded around as a selling point.
Jun 06 2010
On Mon, Jun 7, 2010 at 06:58, Nick Sabalausky <a a.a> wrote:"dsimcha" <dsimcha yahoo.com> wrote in message news:huh892$agk$1 digitalmars.com...T is a typetuple, with ranges as elements (types). These ranges may have different element types. staticMap!(ElementType, T) will map the ElementType template on each type in T and from this typetuple create another typetuple:the application of ElementType on each of them: say you have T == (int[], byte[], ulong[]) then staticMap!(ElementType, T) is (int,byte,ulong) Then, CommonType is a template that takes a typetuple and finds the common type among them. Then any element from any of the input ranges can be cast to this type. If CommonType finds no common type, it returns 'void'. Then, he use typeof(return) to create a variable with this type he just obtained. I really like this compile-time calculations on types: as David said, it allows you to stay generic while having well-defined behavior. Of course, in a real application, you would put a constraint on this template, testing for CommonType not to be void. That way, calling largest element on (string[], double[][]) wouldn't even compile. Hmm, in fact it could be put in this example, because it shows this kind of function can be safe. Philippe/**Finds the largest element present in any of the ranges passed in.\ */ CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { // Quick and dirty impl ignoring error checking: typeof(return) ret = args[0].front(); foreach(arg; args) { foreach(elem; arg) { ret = max(elem, ret); } } return ret; }I clearly haven't been following D2 closely enough. Or maybe I'm just more tired than I think... Can you explain that function signature?: CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) {
Jun 06 2010
Nick Sabalausky wrote:I actually find that funny. Something in Java that isn't an Object? I=20 remember "Everything's an object!" being paraded around as a selling po=int.=20Yes, in Java, everything is an object except where that bothered the language "designers". There are several such design decisions in Java... Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jun 07 2010
""Jérôme M. Berger"" <jeberger free.fr> wrote in message news:hujboe$tp2$1 digitalmars.com...Nick Sabalausky wrote:Yea, that's a good example of why I've grown a distaste towards hard-and-fast religious design strategies. The designer inevitably comes across cases where it just doesn't work particularly well, and then they're forced to either stay true to their misguided principles by accepting an awkward problematic design, or contradict their alleged principles and go with a better design. And when they do the latter, that runs the risk of causing problems in other areas that had been relying on the old principle being rigidly followed. ------------------------------- Not sent from an iPhone.I actually find that funny. Something in Java that isn't an Object? I remember "Everything's an object!" being paraded around as a selling point.Yes, in Java, everything is an object except where that bothered the language "designers". There are several such design decisions in Java...
Jun 07 2010
Nick Sabalausky wrote:Yea, that's a good example of why I've grown a distaste towards hard-and-fast religious design strategies. The designer inevitably comes across cases where it just doesn't work particularly well, and then they're forced to either stay true to their misguided principles by accepting an awkward problematic design, or contradict their alleged principles and go with a better design. And when they do the latter, that runs the risk of causing problems in other areas that had been relying on the old principle being rigidly followed.D has design principles, but those principles are often contradictory. I don't see a good reason to follow a design principle out of principle if it destroys the utility of the language. For example, consider: version (unittest) 'unittest' is a keyword, not an identifier. Making this work requires a special case in the grammar. But the alternatives, version (Unittest) version (unit_test) version (unittests) etc. are all much worse than simply violating a principle and putting the special case in.
Jun 07 2010
"Walter Bright" <newshound1 digitalmars.com> wrote in message news:hujdg6$125b$1 digitalmars.com...Nick Sabalausky wrote:Great example. Of course, one could argue that we religiously follow pragmatism ;) ------------------------------- Not sent from an iPhone.Yea, that's a good example of why I've grown a distaste towards hard-and-fast religious design strategies. The designer inevitably comes across cases where it just doesn't work particularly well, and then they're forced to either stay true to their misguided principles by accepting an awkward problematic design, or contradict their alleged principles and go with a better design. And when they do the latter, that runs the risk of causing problems in other areas that had been relying on the old principle being rigidly followed.D has design principles, but those principles are often contradictory. I don't see a good reason to follow a design principle out of principle if it destroys the utility of the language. For example, consider: version (unittest) 'unittest' is a keyword, not an identifier. Making this work requires a special case in the grammar. But the alternatives, version (Unittest) version (unit_test) version (unittests) etc. are all much worse than simply violating a principle and putting the special case in.
Jun 07 2010
Walter Bright, el 7 de junio a las 11:24 me escribiste:Nick Sabalausky wrote:Please, document this! http://d.puremagic.com/issues/show_bug.cgi?id=4230 -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- ¿Qué será lo que hace que una brújula siempre marque el norte? - Ser aguja, nada más, y cumplir su misión. -- Ricardo VaporesoYea, that's a good example of why I've grown a distaste towards hard-and-fast religious design strategies. The designer inevitably comes across cases where it just doesn't work particularly well, and then they're forced to either stay true to their misguided principles by accepting an awkward problematic design, or contradict their alleged principles and go with a better design. And when they do the latter, that runs the risk of causing problems in other areas that had been relying on the old principle being rigidly followed.D has design principles, but those principles are often contradictory. I don't see a good reason to follow a design principle out of principle if it destroys the utility of the language. For example, consider: version (unittest) 'unittest' is a keyword, not an identifier. Making this work requires a special case in the grammar. But the alternatives, version (Unittest) version (unit_test) version (unittests) etc. are all much worse than simply violating a principle and putting the special case in.
Jun 07 2010
Leandro Lucarella wrote:Please, document this! http://d.puremagic.com/issues/show_bug.cgi?id=4230Done.
Jun 07 2010
Walter Bright, el 7 de junio a las 14:42 me escribiste:Leandro Lucarella wrote:Thanks =) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Es mejor probar el sabor de sapo y darse cuenta que es feo, antes que no hacerlo y creer que es una gran gomita de pera. -- Dr Ricardo Vaporesso, Malta 1951Please, document this! http://d.puremagic.com/issues/show_bug.cgi?id=4230Done.
Jun 07 2010
Walter Bright wrote:Nick Sabalausky wrote:Me feels that many readers of this ng would enjoy a recap of just exactly are those design principles? Of more interest though will be the ensuring discussion from your response!!! :-)Yea, that's a good example of why I've grown a distaste towards hard-and-fast religious design strategies. The designer inevitably comes across cases where it just doesn't work particularly well, and then they're forced to either stay true to their misguided principles by accepting an awkward problematic design, or contradict their alleged principles and go with a better design. And when they do the latter, that runs the risk of causing problems in other areas that had been relying on the old principle being rigidly followed.D has design principles, but those principles are often contradictory. I don't see a good reason to follow a design principle out of principle if it destroys the utility of the language.
Jun 13 2010
Mon, 07 Jun 2010 14:06:24 -0400, Nick Sabalausky wrote:""Jérôme M. Berger"" <jeberger free.fr> wrote in message news:hujboe$tp2$1 digitalmars.com...Part of the "religious" feel of Java comes from the fact that it runs on a VM. The safe memory model imposes some restrictions as you might have noticed in SafeD. The 'everything is an Object' idea is a bit broken, added primitive types has a rationale behind it. The decision made the VM a useful tool for real enterprise applications.Nick Sabalausky wrote:Yea, that's a good example of why I've grown a distaste towards hard-and-fast religious design strategies. The designer inevitably comes across cases where it just doesn't work particularly well, and then they're forced to either stay true to their misguided principles by accepting an awkward problematic design, or contradict their alleged principles and go with a better design. And when they do the latter, that runs the risk of causing problems in other areas that had been relying on the old principle being rigidly followed.I actually find that funny. Something in Java that isn't an Object? I remember "Everything's an object!" being paraded around as a selling point.Yes, in Java, everything is an object except where that bothered the language "designers". There are several such design decisions in Java...
Jun 07 2010
retard wrote:Mon, 07 Jun 2010 14:06:24 -0400, Nick Sabalausky wrote:Hear, hear. The idea that "everything is a Object" is definitely broken. Java cannot fix this misidea and this leaves an opportunity for newcomer languages (or oldcomer languages in new clothes).""Jérôme M. Berger"" <jeberger free.fr> wrote in message news:hujboe$tp2$1 digitalmars.com...Part of the "religious" feel of Java comes from the fact that it runs on a VM. The safe memory model imposes some restrictions as you might have noticed in SafeD. The 'everything is an Object' idea is a bit broken, added primitive types has a rationale behind it. The decision made the VM a useful tool for real enterprise applications.Nick Sabalausky wrote:Yea, that's a good example of why I've grown a distaste towards hard-and-fast religious design strategies. The designer inevitably comes across cases where it just doesn't work particularly well, and then they're forced to either stay true to their misguided principles by accepting an awkward problematic design, or contradict their alleged principles and go with a better design. And when they do the latter, that runs the risk of causing problems in other areas that had been relying on the old principle being rigidly followed.I actually find that funny. Something in Java that isn't an Object? I remember "Everything's an object!" being paraded around as a selling point.Yes, in Java, everything is an object except where that bothered the language "designers". There are several such design decisions in Java...
Jun 13 2010
dsimcha wrote:=3D=3D Quote from Walter Bright (newshound1 digitalmars.com)'s articleghs aboutD is an extremely powerful language, but when I read complaints and si=D.other languages, few seem to know that these problems are solved with =ts of DEssentially, we have a marketing problem. One great way to address it is by writing articles about various aspec=_execution_in_d/and how they solve problems, likehttp://www.reddit.com/r/programming/comments/cb14j/compiletime_function=and up andwhich was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to st=rewrite an article? They don't have to be comprehensive articles (though of course those a=in abetter), even blog entries will do.=20 This probably won't be replied to because I'm starting a new sub-thread=mature discussion, but I wonder if we could write about the advantages =anddisadvantages of duck typing vs. static typing, comparing Python vs. Ja=va atfirst, then bring D into the picture to show how, to a greater extent t=han C++typingwithout introducing the pitfalls of duck typing. =20 Here's a simple example of something that would be awkward to impossibl=e to doefficiently in any other language: =20 /**Finds the largest element present in any of the ranges passed in.\ */ CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { // Quick and dirty impl ignoring error checking: typeof(return) ret =3D args[0].front(); =20 foreach(arg; args) { foreach(elem; arg) { ret =3D max(elem, ret); } } =20 return ret; } =20 Do this in C++ -> FAIL because there are no variadics. (Yes, C++1x wil=l havethem, but I might die of old age by the time C++1x exists.) =20 Do this in any dynamic language -> FAIL because looping is so slow that=you mightdie of old age before it executes. Besides, who wants to do computatio=nallyintensive, multithreaded work in a dynamic language? =20In python: max (map (max, args)) should have reasonable performances and is *much* more elegant... Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jun 07 2010
On 06/07/2010 12:57 PM, "Jérôme M. Berger" wrote:dsimcha wrote:I very much doubt that. Andrei== Quote from Walter Bright (newshound1 digitalmars.com)'s articleIn python: max (map (max, args)) should have reasonable performances and is *much* more elegant...D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, likehttp://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.This probably won't be replied to because I'm starting a new sub-thread in a mature discussion, but I wonder if we could write about the advantages and disadvantages of duck typing vs. static typing, comparing Python vs. Java at first, then bring D into the picture to show how, to a greater extent than C++ without introducing the pitfalls of duck typing. Here's a simple example of something that would be awkward to impossible to do efficiently in any other language: /**Finds the largest element present in any of the ranges passed in.\ */ CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { // Quick and dirty impl ignoring error checking: typeof(return) ret = args[0].front(); foreach(arg; args) { foreach(elem; arg) { ret = max(elem, ret); } } return ret; } Do this in C++ -> FAIL because there are no variadics. (Yes, C++1x will have them, but I might die of old age by the time C++1x exists.) Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?
Jun 07 2010
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message news:hujc46$v49$1 digitalmars.com...On 06/07/2010 12:57 PM, "Jérôme M. Berger" wrote:It might be faster than using nested loops in Python. But yea, seems unlikely it would compare to the D version. Plus, can't you still do something like this? (I may not have this exactly right) CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { static assert( !is(typeof(return) == void) ); return max( map!max(args) ); } Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like: T max(T range) { return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); } ------------------------------- Not sent from an iPhone.dsimcha wrote:I very much doubt that. Andrei== Quote from Walter Bright (newshound1 digitalmars.com)'s articleIn python: max (map (max, args)) should have reasonable performances and is *much* more elegant...D is an extremely powerful language, but when I read complaints and sighs about other languages, few seem to know that these problems are solved with D. Essentially, we have a marketing problem. One great way to address it is by writing articles about various aspects of D and how they solve problems, likehttp://www.reddit.com/r/programming/comments/cb14j/compiletime_function_execution_in_d/which was well received on reddit. Anyone have good ideas on topics for D articles? And anyone want to stand up and write an article? They don't have to be comprehensive articles (though of course those are better), even blog entries will do.This probably won't be replied to because I'm starting a new sub-thread in a mature discussion, but I wonder if we could write about the advantages and disadvantages of duck typing vs. static typing, comparing Python vs. Java at first, then bring D into the picture to show how, to a greater extent than C++ typing without introducing the pitfalls of duck typing. Here's a simple example of something that would be awkward to impossible to do efficiently in any other language: /**Finds the largest element present in any of the ranges passed in.\ */ CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { // Quick and dirty impl ignoring error checking: typeof(return) ret = args[0].front(); foreach(arg; args) { foreach(elem; arg) { ret = max(elem, ret); } } return ret; } Do this in C++ -> FAIL because there are no variadics. (Yes, C++1x will have them, but I might die of old age by the time C++1x exists.) Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?
Jun 07 2010
"Nick Sabalausky" <a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 07 2010
"Nick Sabalausky" <a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com..."Nick Sabalausky" <a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 07 2010
Hello Nick,"Nick Sabalausky" <a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com...so we have: alias reduce!"a>b?a:b" range_max; CommonType!(staticMap!(ElementType, T)) largestElement(T...)(T args) { static assert( !is(typeof(return) == void) ); return max( map!max(args) ); } Why isn't that just one line, like: alias polyMapReduce!(reduce!"a>b?a:b", "a>b?a:b") largestElelemt; I'm shure a better one could be written but I think this would do it: auto polyMapReduce(alias map, string reduce, T...)(T t) { static assert(T.length > 0); static if(T.length > 1) { auto a = map(t[0]); auto b = polyMapReduce!(map,reduce)(t[1..$]); return mixin(reduce); } else return map(t[0]); } -- ... <IXOYE><"Nick Sabalausky" <a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 07 2010
Mon, 07 Jun 2010 18:16:15 -0400, Nick Sabalausky wrote:"Nick Sabalausky" <a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com...max = reduce > FSM, I love <funfunfun>. :)"Nick Sabalausky" <a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 08 2010
On Jun 8, 10 15:55, retard wrote:Mon, 07 Jun 2010 18:16:15 -0400, Nick Sabalausky wrote:If there's any language allowing defining a max like this, it has implemented reduce (a.k.a. fold) wrongly."Nick Sabalausky"<a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com...max = reduce> FSM, I love<funfunfun>. :)"Nick Sabalausky"<a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 08 2010
Tue, 08 Jun 2010 19:43:26 +0800, KennyTM~ wrote:On Jun 8, 10 15:55, retard wrote:Right, I should not have used the symbol >, but last post was right after I woke up. Let's say it depends on the definition of > :)Mon, 07 Jun 2010 18:16:15 -0400, Nick Sabalausky wrote:If there's any language allowing defining a max like this, it has implemented reduce (a.k.a. fold) wrongly."Nick Sabalausky"<a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com...max = reduce> FSM, I love<funfunfun>. :)"Nick Sabalausky"<a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 08 2010
retard wrote:Tue, 08 Jun 2010 19:43:26 +0800, KennyTM~ wrote:Hey retard, you are a legend.On Jun 8, 10 15:55, retard wrote:Right, I should not have used the symbol >, but last post was right after I woke up. Let's say it depends on the definition of > :)Mon, 07 Jun 2010 18:16:15 -0400, Nick Sabalausky wrote:If there's any language allowing defining a max like this, it has implemented reduce (a.k.a. fold) wrongly."Nick Sabalausky"<a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com...max = reduce> FSM, I love<funfunfun>. :)"Nick Sabalausky"<a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 09 2010
On 06/07/2010 05:16 PM, Nick Sabalausky wrote:"Nick Sabalausky"<a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com...This is kind of funny. This works because reduce is defined as follows: template reduce(alias fun) { alias Reduce!(fun).reduce reduce; } I did that to work around some old compiler bugs that have been since fixed. I'd initially intended to define reduce like this: Unqual!E reduce(alias fun, E, R)(E seed, R r) { ... } but that wouldn't have allowed Nick's alias, which is quite useful. So it looks like we have a cool idiom. Andrei"Nick Sabalausky"<a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 08 2010
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message news:huld21$15sj$1 digitalmars.com...On 06/07/2010 05:16 PM, Nick Sabalausky wrote:Template currying ;) Maybe not as flexible as typical currying, but still. Curry...dang, now I'm hungry... Also, what's Unqual?"Nick Sabalausky"<a a.a> wrote in message news:hujd9m$11of$1 digitalmars.com...This is kind of funny. This works because reduce is defined as follows: template reduce(alias fun) { alias Reduce!(fun).reduce reduce; } I did that to work around some old compiler bugs that have been since fixed. I'd initially intended to define reduce like this: Unqual!E reduce(alias fun, E, R)(E seed, R r) { ... } but that wouldn't have allowed Nick's alias, which is quite useful. So it looks like we have a cool idiom."Nick Sabalausky"<a a.a> wrote in message news:hujd6a$11e8$1 digitalmars.com...Or: alias reduce!"a>b?a:b" max; God, I love D :)Assuming, of course, a 'max' that works on a range, which would be easy enough to do. Probably something like:ElementType!T max(T range) // Corrected{ return reduce!ordinaryMax(range); // Or return reduce!"a>b?a:b"(range); }
Jun 08 2010
On Tue, Jun 8, 2010 at 20:13, Nick Sabalausky <a a.a> wrote:Template currying ;) Maybe not as flexible as typical currying, but still.I recenly achieved getting partially there. At least, given foo(A,B,C)(n args list) {...} curry!foo will correctly create n 1-arg templated function inside one another and deliver the result at the end. But it does not verify the compatibility of arguments while filling the arguments :( Given foo(A,B,C)(A a, Tuple!(B,A) b, C[A] c) curry!foo will accept any A a, but then should only accept b's of the correct type: Tuple!(B,A), for some B and the already defined A, and the same for c. I'm making sense there? I more or less see how to get there, but can't get motivated to do this :-)Also, what's Unqual?Gets rid of any const/immutable qualifiers. Philipe
Jun 08 2010
On Tue, Jun 8, 2010 at 14:28, Andrei Alexandrescu < SeeWebsiteForEmail erdani.org> wrote:This is kind of funny. This works because reduce is defined as follows: template reduce(alias fun) { alias Reduce!(fun).reduce reduce; } I did that to work around some old compiler bugs that have been since fixed. I'd initially intended to define reduce like this: Unqual!E reduce(alias fun, E, R)(E seed, R r) { ... } but that wouldn't have allowed Nick's alias, which is quite useful. So it looks like we have a cool idiom.Currying in general is always handy to have. The possibility to say alias map!fun funMapper; would be cool also. If possible, having this in Phobos would be quite nice. Bu then, I'm one of those persons that'd like to have alias take(3) takeThree; // will then work on any range. Instead of take(range, 3). If find the former to be much more generic. I liked it so much I defined a small template to invert and curry these (R,n) functions. Philippe
Jun 08 2010
Andrei Alexandrescu wrote:On 06/07/2010 12:57 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:hat you mightDo this in any dynamic language -> FAIL because looping is so slow t=ionallydie of old age before it executes. Besides, who wants to do computat=What do you doubt? That it has reasonable performance or that it is more elegant? Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr=20 I very much doubt that. =20intensive, multithreaded work in a dynamic language?In python: max (map (max, args)) should have reasonable performances and is *much* more elegant...
Jun 07 2010
On 06/07/2010 04:35 PM, "Jérôme M. Berger" wrote:Andrei Alexandrescu wrote:That it has reasonable performance. Then, there are a number of things that can't be compared such as figuring out the tightest static types, something that Python doesn't worry about (at the expense of precision and performance). I see such examples as simple illustrations "look, if you give up X, you gain Y!" - just coming without mentioning X. AndreiOn 06/07/2010 12:57 PM, "Jérôme M. Berger" wrote:What do you doubt? That it has reasonable performance or that it is more elegant?I very much doubt that.Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?In python: max (map (max, args)) should have reasonable performances and is *much* more elegant...
Jun 07 2010
Andrei Alexandrescu wrote:On 06/07/2010 04:35 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:sAndrei Alexandrescu wrote:On 06/07/2010 12:57 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:What do you doubt? That it has reasonable performance or that it i=I very much doubt that.Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?In python: max (map (max, args)) should have reasonable performances and is *much* more elegant...Please define "reasonable performance"...more elegant?=20 That it has reasonable performance. Then, there are a number of things that can't be compared such as figuring out the tightest static types, something that Python doesn't worry about (at the expense of precision and performance). =20I see such examples as simple illustrations "look, if you give up X, yo=ugain Y!" - just coming without mentioning X. =20Precisely my point :) If you look at the OP message, what it boils down to is: "look if you do this the D way in a dynamic language it'll be dead slow" - just coming without mentioning that the D way isn't the right way in those languages... Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Jun 08 2010
J=C3=A9r=C3=B4me M. Berger wrote:Andrei Alexandrescu wrote:isOn 06/07/2010 04:35 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:Andrei Alexandrescu wrote:On 06/07/2010 12:57 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:What do you doubt? That it has reasonable performance or that it =I very much doubt that.Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?In python: max (map (max, args)) should have reasonable performances and is *much* more elegant...more elegant?That it has reasonable performance. Then, there are a number of things=that can't be compared such as figuring out the tightest static types,=something that Python doesn't worry about (at the expense of precision=ouand performance).Please define "reasonable performance"... =20I see such examples as simple illustrations "look, if you give up X, y=PS: I should perhaps mention that I like D. I just think that spreading FUD about other languages is not the right way to promote D... Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.frgain Y!" - just coming without mentioning X.Precisely my point :) If you look at the OP message, what it boils down to is: "look if you do this the D way in a dynamic language it'll be dead slow" - just coming without mentioning that the D way isn't the right way in those languages... =20
Jun 08 2010
On 06/08/2010 01:29 PM, "Jérôme M. Berger" wrote:PS: I should perhaps mention that I like D. I just think that spreading FUD about other languages is not the right way to promote D...Hope I didn't do that. Andrei
Jun 08 2010
On 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:Andrei Alexandrescu wrote:Within 15% of hand-optimized code specialized for the types at hand. AndreiOn 06/07/2010 04:35 PM, "Jérôme M. Berger" wrote:Please define "reasonable performance"...Andrei Alexandrescu wrote:That it has reasonable performance. Then, there are a number of things that can't be compared such as figuring out the tightest static types, something that Python doesn't worry about (at the expense of precision and performance).On 06/07/2010 12:57 PM, "Jérôme M. Berger" wrote:What do you doubt? That it has reasonable performance or that it is more elegant?I very much doubt that.Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?In python: max (map (max, args)) should have reasonable performances and is *much* more elegant...
Jun 08 2010
Andrei Alexandrescu wrote:On 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changerPlease define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 08 2010
On 06/08/2010 04:05 PM, Walter Bright wrote:Andrei Alexandrescu wrote:max of n elements is O(n). AndreiOn 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changerPlease define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 08 2010
Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrotemax of n elements is O(n).T max( T )( T[] values ) { T result = values[0]; foreach ( i, e; values[1..$] ) { if ( max( values[i+1..$] ) > result ) { result = max( values[i+1..$] ); } } return result; } -- Simen
Jun 08 2010
Simen kjaeraas <simen.kjaras gmail.com> wrote:Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wroteBetter: T max( T )( T[] values ) { if ( values.length == 1 ) { return values[0]; } else { return max( values[0..values.length/2] ) > max( values[values.length/2..$] ) ? max( values[0..values.length/2] ) : max( values[values.length/2..$] ); } } -- Simenmax of n elements is O(n).T max( T )( T[] values ) { T result = values[0]; foreach ( i, e; values[1..$] ) { if ( max( values[i+1..$] ) > result ) { result = max( values[i+1..$] ); } } return result; }
Jun 08 2010
On 06/08/2010 04:53 PM, Simen kjaeraas wrote:Simen kjaeraas <simen.kjaras gmail.com> wrote:I'm not sure I understand the point. Could you please elaborate? AndreiAndrei Alexandrescu <SeeWebsiteForEmail erdani.org> wroteBetter: T max( T )( T[] values ) { if ( values.length == 1 ) { return values[0]; } else { return max( values[0..values.length/2] ) > max( values[values.length/2..$] ) ? max( values[0..values.length/2] ) : max( values[values.length/2..$] ); } }max of n elements is O(n).T max( T )( T[] values ) { T result = values[0]; foreach ( i, e; values[1..$] ) { if ( max( values[i+1..$] ) > result ) { result = max( values[i+1..$] ); } } return result; }
Jun 08 2010
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message news:humfgd$1l7$2 digitalmars.com...On 06/08/2010 04:53 PM, Simen kjaeraas wrote:He's being a smart-ass and making implementations of max() that are worse than O(n) :) Hee hee. Obfuscation is fun :)Simen kjaeraas <simen.kjaras gmail.com> wrote:I'm not sure I understand the point. Could you please elaborate?Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wroteBetter: T max( T )( T[] values ) { if ( values.length == 1 ) { return values[0]; } else { return max( values[0..values.length/2] ) > max( values[values.length/2..$] ) ? max( values[0..values.length/2] ) : max( values[values.length/2..$] ); } }max of n elements is O(n).T max( T )( T[] values ) { T result = values[0]; foreach ( i, e; values[1..$] ) { if ( max( values[i+1..$] ) > result ) { result = max( values[i+1..$] ); } } return result; }
Jun 08 2010
Nick Sabalausky <a a.a> wrote:He's being a smart-ass and making implementations of max() that are worse than O(n) :)Well, I tried. Second try I was apparently too drunk to write bad code. -- Simen
Jun 09 2010
"Simen kjaeraas" <simen.kjaras gmail.com> wrote in message news:op.vd05x514vxi10f biotronic-pc.lan......I was apparently too drunk to write bad code.That's officially my favorite sentence of the day :)
Jun 09 2010
Tue, 08 Jun 2010 16:14:51 -0500, Andrei Alexandrescu wrote:On 06/08/2010 04:05 PM, Walter Bright wrote:This probably means that D 2 won't be very efficient on multicore until the authors learn some basic parallel programming skills. Now where did you get your PhD - I'm collecting a list of toy universities people should avoid.Andrei Alexandrescu wrote:max of n elements is O(n).On 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changerPlease define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 08 2010
"retard" <re tard.com.invalid> wrote in message news:hun6ok$13s5$1 digitalmars.com...Tue, 08 Jun 2010 16:14:51 -0500, Andrei Alexandrescu wrote:You used to have meaningful things to say. Now you're just trolling.On 06/08/2010 04:05 PM, Walter Bright wrote:This probably means that D 2 won't be very efficient on multicore until the authors learn some basic parallel programming skills. Now where did you get your PhD - I'm collecting a list of toy universities people should avoid.Andrei Alexandrescu wrote:max of n elements is O(n).On 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changerPlease define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 08 2010
Wed, 09 Jun 2010 01:13:43 -0400, Nick Sabalausky wrote:"retard" <re tard.com.invalid> wrote in message news:hun6ok$13s5$1 digitalmars.com...Max of n unordered elements can be solved in O(log log n) time assuming you have enough cores and constant time memory access. Happy now?Tue, 08 Jun 2010 16:14:51 -0500, Andrei Alexandrescu wrote:You used to have meaningful things to say. Now you're just trolling.On 06/08/2010 04:05 PM, Walter Bright wrote:This probably means that D 2 won't be very efficient on multicore until the authors learn some basic parallel programming skills. Now where did you get your PhD - I'm collecting a list of toy universities people should avoid.Andrei Alexandrescu wrote:max of n elements is O(n).On 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changerPlease define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 08 2010
"retard" <re tard.com.invalid> wrote in message news:hunc9t$1c9e$1 digitalmars.com...Wed, 09 Jun 2010 01:13:43 -0400, Nick Sabalausky wrote:Yes, actually :)"retard" <re tard.com.invalid> wrote in message news:hun6ok$13s5$1 digitalmars.com...Max of n unordered elements can be solved in O(log log n) time assuming you have enough cores and constant time memory access. Happy now?Tue, 08 Jun 2010 16:14:51 -0500, Andrei Alexandrescu wrote:You used to have meaningful things to say. Now you're just trolling.On 06/08/2010 04:05 PM, Walter Bright wrote: max of n elements is O(n).This probably means that D 2 won't be very efficient on multicore until the authors learn some basic parallel programming skills. Now where did you get your PhD - I'm collecting a list of toy universities people should avoid.
Jun 08 2010
== Quote from retard (re tard.com.invalid)'s articleWed, 09 Jun 2010 01:13:43 -0400, Nick Sabalausky wrote:Technically true, but when's the last time you needed to find the max of n unordered elements, where n was large enough to justify the overhead of using even 2 threads? Even if you use some kind of pool, there's still the synchronization overhead."retard" <re tard.com.invalid> wrote in message news:hun6ok$13s5$1 digitalmars.com...Max of n unordered elements can be solved in O(log log n) time assuming you have enough cores and constant time memory access. Happy now?Tue, 08 Jun 2010 16:14:51 -0500, Andrei Alexandrescu wrote:You used to have meaningful things to say. Now you're just trolling.On 06/08/2010 04:05 PM, Walter Bright wrote:This probably means that D 2 won't be very efficient on multicore until the authors learn some basic parallel programming skills. Now where did you get your PhD - I'm collecting a list of toy universities people should avoid.Andrei Alexandrescu wrote:max of n elements is O(n).On 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changerPlease define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 09 2010
On 06/09/2010 01:28 AM, retard wrote:Wed, 09 Jun 2010 01:13:43 -0400, Nick Sabalausky wrote:When calculating the complexity of an operation you don't consider cores in unlimited supply; it's a constant. Complexity being calculated in terms of the number of inputs, max of n elements is O(n) because you need to look at each element at least once. Cores being a constant k, you can then consider that max can be distributed such that each core looks at n/k elements. What's left is k intermediate results, which can be further processed in log(k) time (see below); since we consider k a constant, this approach could claim a net k-fold speedup. If available cores are proportional to n (an unusual assumption), you first compare pairs of the n elements with n/2 cores, then n/4 comparisons against pairs of the remaining elements etc. Each step halves the number of candidates so the complexity is O(log n). I'd be curious to find out how that can be reduced to O(log log n). Finally, for small values of n, you could consider the number of cores sufficiently large, but, as was pointed out, using threads for max is actually impractical, so superscalar execution may be a better venue. Practically this means exploiting ILP by reducing data dependencies between intermediate results. I suggest you take a look at a thread entitled "challenge: implement the max function" that I started on 01/21/2007. That thread discusses ILP issues, and continues with the me to quote from my own post on 01/23/2007: ================== That's a good point, and goes right to the core of my solution, which (similarly to Bruno Medeiros') arranges operations in an optimal way for superscalar evaluation, e.g. max(a, b, c, d) is expanded not to: max2(max2(max2(a, b), c), d) but instead to: max2(max2(a, b), max2(c, d)) The number of operations is the same but in the latter case there is logaritmically less dependency between partial results. When max2 expands into a primitive comparison, the code is easy prey for a superscalar machine to execute in parallel. This won't count in a great deal of real code, but the fact that this will go in the standard library warrants the thought. Besides, the fact that the language makes it so easy, we can actually think of such subtlety, is very encouraging. ================== The messages that follow further discuss how associative reduce should be ordered to take advantage of superscalar execution. Andrei"retard"<re tard.com.invalid> wrote in message news:hun6ok$13s5$1 digitalmars.com...Max of n unordered elements can be solved in O(log log n) time assuming you have enough cores and constant time memory access. Happy now?Tue, 08 Jun 2010 16:14:51 -0500, Andrei Alexandrescu wrote:You used to have meaningful things to say. Now you're just trolling.On 06/08/2010 04:05 PM, Walter Bright wrote:This probably means that D 2 won't be very efficient on multicore until the authors learn some basic parallel programming skills. Now where did you get your PhD - I'm collecting a list of toy universities people should avoid.Andrei Alexandrescu wrote:max of n elements is O(n).On 06/08/2010 01:27 PM, "Jérôme M. Berger" wrote:I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changerPlease define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 09 2010
Wed, 09 Jun 2010 09:37:51 -0500, Andrei Alexandrescu wrote:On 06/09/2010 01:28 AM, retard wrote:With this logic, all parallel algorithms have the same time complexity as their sequential versions.Max of n unordered elements can be solved in O(log log n) time assuming you have enough cores and constant time memory access. Happy now?When calculating the complexity of an operation you don't consider cores in unlimited supply; it's a constant. Complexity being calculated in terms of the number of inputs, max of n elements is O(n) because you need to look at each element at least once. Cores being a constant k, you can then consider that max can be distributed such that each core looks at n/k elements. What's left is k intermediate results, which can be further processed in log(k) time (see below); since we consider k a constant, this approach could claim a net k-fold speedup.If available cores are proportional to n (an unusual assumption), you first compare pairs of the n elements with n/2 cores, then n/4 comparisons against pairs of the remaining elements etc. Each step halves the number of candidates so the complexity is O(log n). I'd be curious to find out how that can be reduced to O(log log n).First, divide the problem into log(log(n)) blocks and solve them sequentially, the complexity is O(log log n), because the problem size is log(log(n)) and the sequential algorithm works in O(n). Then, use a divide and conquer algorithm for the n/log(log(n)) maximums obtained from the blocks. With the correct algorithm this stage is also O(log log n), thus the overall complexity is O(log log n). And yes, it assumes you have n/log(log(n)) cores.Finally, for small values of n, you could consider the number of cores sufficiently large, but, as was pointed out, using threads for max is actually impractical, so superscalar execution may be a better venue. Practically this means exploiting ILP by reducing data dependencies between intermediate results. I suggest you take a look at a thread entitled "challenge: implement the max function" that I started on 01/21/2007. That thread discusses ILP issues, and continues with theI believe this is true in practice. I only mentioned the time complexity of the parallel version, I didn't make any claims about its real world performance. If the problem is small enough, I'd use Python instead.
Jun 11 2010
retard wrote:First, divide the problem into log(log(n)) blocks and solve them sequentially, the complexity is O(log log n), because the problem size is log(log(n)) and the sequential algorithm works in O(n). Then, use a divide and conquer algorithm for the n/log(log(n)) maximums obtained from the blocks. With the correct algorithm this stage is also O(log log n), thus the overall complexity is O(log log n). And yes, it assumes you have n/log(log(n)) cores.What is the correct algorithm for the second stage? Do you have a reference at hand? Andrei
Jun 11 2010
Fri, 11 Jun 2010 08:37:31 -0700, Andrei Alexandrescu wrote:retard wrote:Unfortunately I can't remember. It was probably explained in Jaja's book, which I skimmed through when there was the last parallel programming course 7-8 years ago - I only have some notes left.First, divide the problem into log(log(n)) blocks and solve them sequentially, the complexity is O(log log n), because the problem size is log(log(n)) and the sequential algorithm works in O(n). Then, use a divide and conquer algorithm for the n/log(log(n)) maximums obtained from the blocks. With the correct algorithm this stage is also O(log log n), thus the overall complexity is O(log log n). And yes, it assumes you have n/log(log(n)) cores.What is the correct algorithm for the second stage? Do you have a reference at hand? Andrei
Jun 11 2010
retard wrote:Fri, 11 Jun 2010 08:37:31 -0700, Andrei Alexandrescu wrote:That's right. I'm now glad I followed this through; I learned a couple of things. www.cs.berkeley.edu/~satishr/cs273.03/scribe9.ps Focusing on posting more content and fewer of those bizarre outbursts would make everyone on this group happier - primarily yourself. Andreiretard wrote:Unfortunately I can't remember. It was probably explained in Jaja's book, which I skimmed through when there was the last parallel programming course 7-8 years ago - I only have some notes left.First, divide the problem into log(log(n)) blocks and solve them sequentially, the complexity is O(log log n), because the problem size is log(log(n)) and the sequential algorithm works in O(n). Then, use a divide and conquer algorithm for the n/log(log(n)) maximums obtained from the blocks. With the correct algorithm this stage is also O(log log n), thus the overall complexity is O(log log n). And yes, it assumes you have n/log(log(n)) cores.What is the correct algorithm for the second stage? Do you have a reference at hand? Andrei
Jun 12 2010
:D Wow. This troll is getting increasingly desperate. Now it resorts t= o = straw man. On Tue, 08 Jun 2010 23:53:41 -0500, retard <re tard.com.invalid> wrote:Tue, 08 Jun 2010 16:14:51 -0500, Andrei Alexandrescu wrote:.On 06/08/2010 04:05 PM, Walter Bright wrote:Andrei Alexandrescu wrote:On 06/08/2010 01:27 PM, "J=E9r=F4me M. Berger" wrote:Please define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand=lThis probably means that D 2 won't be very efficient on multicore unti=I would have said O(n) or O(log n), as opposed to, say, O(n*n). General rules for performance improvements: 1. nobody notices a 10% improvement 2. users will start noticing speedups when they exceed 2x 3. a 10x speedup is a game changermax of n elements is O(n).the authors learn some basic parallel programming skills. Now where di=dyou get your PhD - I'm collecting a list of toy universities people should avoid.-- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jun 08 2010
Walter Bright wrote:Andrei Alexandrescu wrote:Well, then my python function is Ok (O(n)) ;) Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.frOn 06/08/2010 01:27 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:=20 I would have said O(n) or O(log n), as opposed to, say, O(n*n). =20Please define "reasonable performance"...Within 15% of hand-optimized code specialized for the types at hand.
Jun 09 2010
Andrei Alexandrescu wrote:On 06/08/2010 01:27 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:sAndrei Alexandrescu wrote:On 06/07/2010 04:35 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:Andrei Alexandrescu wrote:That it has reasonable performance. Then, there are a number of thing=On 06/07/2010 12:57 PM, "J=C3=A9r=C3=B4me M. Berger" wrote:What do you doubt? That it has reasonable performance or that it is more elegant?I very much doubt that.Do this in any dynamic language -> FAIL because looping is so slow that you might die of old age before it executes. Besides, who wants to do computationally intensive, multithreaded work in a dynamic language?In python: max (map (max, args)) should have reasonable performances and is *much* more elegant...,that can't be compared such as figuring out the tightest static types=nsomething that Python doesn't worry about (at the expense of precisio=Then almost nothing has "reasonable performance"... Jerome PS: I should maybe point out that I also do quite a lot of Verilog development. Therefore I can hand optimize specialized code a lot better than anything you can do on a standard CPU... --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr=20 Within 15% of hand-optimized code specialized for the types at hand. =20and performance).Please define "reasonable performance"...
Jun 09 2010