Re: dmd support for IDEs
Nick Sabalausky wrote: Jeremie Pelletier" wrote in message news:hats2b$as...@digitalmars.com... Lutger wrote: Jacob Carlborg wrote: ... As far as I know neither Qt(d) or gtkD uses native controls on platforms other than linux, which to me is unacceptable. The look especially on mac. Qt used to try and look like native controls, but now it uses them directly. It has pros and cons, Firefox too has the native look and feel without using the native controls, so it saves on the overhead of tons of GDI handles and can render the entire GUI in cairo. I use FF a lot and umm...no it doesn't. Not remotely. It's always stood out as every bit of a blatant GTK app as GAIM, GIMP, or Thunderbird. As soon as I can find a browser with equivilents too all my essential hacks (*cough* extensions) and *real* controls (which rules out IE and Opera. And Chrome/Safari... AH HA HA HA!), then I'm ditching this garbage. Are you talking about FF 3.5? It's a really poor product. Crashes all the time, has some terrible UI misfeatures. I'm really amazed they shipped it in that condition.
A safer switch?
This is a pruned method from a command-line Java program: private static void parseCmdLine(String args[]) { int i = 0; String arg; while (i < args.length && args[i].startsWith("-")) { arg = args[i++]; if (arg.equals("-s")) { if (i < args.length) size = new Integer(args[i++]).intValue(); else throw new Error("-l ..."); } else if (arg.equals("-m")) { printMsgs = true; } else if (arg.equals("-p")) { printResults = true; } else if (arg.equals("-h")) { usage(); } } if (size == 0) usage(); } I may translate part of that to D like this: switch (arg) { case "-s": if (idx < args.length) size = toInt(args[idx++]); else throw new Exception("..."); break; case "-m": printMessages = true; break; case "-p": printResults = true; break; case "-h": showUsage(); default: showUsage(); throw new Exception("..."); } But the "-h" case misses a break. Languages like C# have found a way to avoid (in most cases) that common bug. D may use some like this: switch (arg) { case("-s") { try { next_arg = iargs.next(); size = toInt(args[idx++]); } catch (...) { throw new Exception("..."); } } case("-m") { printMessages = true; } case("-p") // just 1 istruction, no {} needed printResults = true; case("-h"); // semicolon isn't allowed here showUsage(); default { // default case may need some care throw new Exception("..."); } } Mixing "case:" and "case()" in the same switch is not allowed, to keep things tidy. "break" is implicit. You can add "continue" if you want to step to the following case. If you put the switch inside a loop, the continue is relative to the switch and not the loop. So if you want to continue the loop you need a "continue LABEL;" where the LABEL if before the loop. Bye, bearophile
Re: A safer switch? + abbreviation of member names in enum switches
bearophile Wrote: > This is a pruned method from a command-line Java program: > > private static void parseCmdLine(String args[]) { >... > } > > > I may translate part of that to D like this: > > switch (arg) { >... > } > > But the "-h" case misses a break. Languages like C# have found a way to avoid > (in most cases) that common bug. D may use some like this: > ... (Sorry bearophile, don't mean to steal your thunder but since I'm writing some D1 switch code right now, I may as well strike while the iron is still hot ...) Speaking of switch statements, when switching on an enum type, e.g. enum Color { RED, GREEN, BLUE } void foo( Color color) { switch (color) { case Color.RED: break; case Color.GREEN: break; case Color.BLUE: break; } } Would it be possible for the compiler to infer the declared enum type, in this case Color, making for abbreviation of the enum member names in the case clauses as per the following? void bar( Color color) { switch (color) { case RED: break; case GREEN: break; case BLUE: break; } } Koala hugs, -- Justin Johansson
Re: dmd support for IDEs
Sun, 11 Oct 2009 09:39:32 -0500, Ellery Newcomer thusly wrote: > Denis Koroskin wrote: >> On Sun, 11 Oct 2009 05:19:56 +0400, Walter Bright >> wrote: >> >> If anyone is interested and is willing to test and/or help, I will >> gladly share my code. > > Oooo.. You should put that on dsource or somewhere. Hacking D sounds > like a lot more fun than hacking C++. I wouldn't mind helping out on > this one. Wow, I am pretty sure I have already seen a D port of dmd on dsource. Was there a good reason to start yet another port of it?
Re: dmd support for IDEs
Sun, 11 Oct 2009 12:44:08 -0400, Jeremie Pelletier thusly wrote: > language_fan wrote: >> Well since there is already a project working on an Eclipse plugin, I >> see little use for other IDEs at the moment. The D community is rather >> small and only a small amount of people are capable of developing and >> willing to donate their free time on free IDE development (commercial >> IDEs have small potential now that >> Netbeans/Eclipse/IntelliJ/KDevelop/Visual Studio dominate the market). >> So why not concentrate on fixing the spec and fixing compiler bugs >> instead of building a modest IDE support no one will use? > > Eclipse is heavy, slow and often unresponsive. I use poseidon myself > because it is light and fast and I don't require much more from an IDE > at the moment. If you turn off all the advanced features of Eclipse (spell checking, interactive parsing & type checking etc), it will become a lot more responsive. You can even uninstall many of the plugins if you really do not need them. I recommend firing up the latest development build with the latest 1.6 jvm. It will take couple of seconds for the JIT to spot the hot spots after starting up. Of course Poseidon is faster *now* that it lacks all the advanced features, but once you start adding more, it will eventually grind to a halt.
Re: A safer switch? + abbreviation of member names in enum switches
Justin Johansson: > Would it be possible for the compiler to infer the declared enum type, in > this case Color, making for abbreviation of the enum member names in the case > clauses as per the following? > > void bar( Color color) { >switch (color) { >case RED: > break; >case GREEN: > break; >case BLUE: > break; >} > } That's a special case, with the purpose of shortening code a little. So while writing Color.something isn't handy, it safe and it has no special casing. So I don't like your idea a lot. Related: I have compiled your code with D1 with warnings (-w): enum Color { RED, GREEN, BLUE } void foo(Color color) { switch (color) { case Color.RED: break; case Color.GREEN: break; case Color.BLUE: break; } } void main() {} It prints: warning - test.d(8): Error: switch statement has no default warning - test.d(8): Error: statement is not reachable But there's no need for default there because all enum cases are covered. So that warning test has to be improved. Bye, bearophile
Re: A safer switch?
On Mon, 12 Oct 2009 11:03:13 +0300, bearophile wrote: This is a pruned method from a command-line Java program: (snip) This was discussed before. IIRC, someone suggested to force using a control-flow keyword (break/continue/goto) at the end of a case. Using "continue" to fall through was rejected because it changes its meaning when there's a switch in a loop. You'd use goto to jump to the particular (next) switch case. -- Best regards, Vladimir mailto:thecybersha...@gmail.com
Re: dmd support for IDEs
Eclipse is heavy, slow and often unresponsive. I use poseidon myself because it is light and fast and I don't require much more from an IDE at the moment. You can try to download just bare Eclipse platform (which is just text editor) and install descent into it using Eclipse software updates. It starts up faster than C or Java version Eclipse and there is only D related stuff in the UI. http://download.eclipse.org/eclipse/downloads/drops/R-3.5.1-200909170800/index.php Under "Platform runtime binary"
Re: dmd support for IDEs
Ary Borenszweig Wrote: > Walter Bright wrote: > > In my discussions with companies about adopting D, the major barrier > > that comes up over and over isn't Tango vs Phobos, dmd being GPL, > > debugger support, libraries, bugs, etc., although those are important. > > > > It's the IDE. > > > > So, while I'm not going to be writing an IDE, I figure that dmd can > > help. dmd already puts out .doc and .di files. How about putting out an > > xml file giving all the information needed for an IDE to implement > > autocompletion? There'd be one .xml file generated per .d source file. > > > > What do you think? > > What I think is that even with an xml representing the parse tree (maybe > with some semantic stuff resolved) it'll be still incomplete for a real > IDE (the kind of thing users expect from an IDE). You can see this > video, for example: > > http://www.youtube.com/watch?v=KQbTT605ags > > So you have: > > --- > module one; > > class Foo(T) { >static if (is(T == class)) { > T property; >} else { > T someMethod() { return T.init; } >} >mixin(guessWhat!(T)()); > } > --- > > You want to define an xml for that module that'll help IDEs. Can you > think what it'll look like? > > Now the user writes in another module: > > class Bar { > } > > void x() { >auto foo = new Foo!(Bar)(); >foo. <-- what does the IDE do here? > } > > Now, the correct thing for the IDE to do is to suggest the field "Bar > property". How can the IDE do that just with an xml? It can't. It need > to perform some kind of semantic anlysis to Foo's argument to see if > it's a class, match the static if in the template, replace template > parameters, etc. It also needs to evaluate the string mixin. > > Of course you could say "Bah, just show all the declarations inside the > template in the autocomplete", but that's wrong. That'll lead to files > that don't compile. You could ommit supporting autocompletion or other > nice features, but that's exactly the big features of D. If you don't > support that then it's like using Java or C# from within the IDE: you > could use the advanced features but the IDE won't help you. And in your > discussions with companies adopting D, I'm sure they were talking about > great IDEs like JDT Eclipse or Visual Studio, not just some tool that > helps you a little but not anymore when things get interesting. > > Oh, and you need to have some kind of semantic analysis to know the type > of "auto foo". Again, maybe the IDE can be dummy and see "auto foo = new > Foo!(Bar)" and say "ok, foo's type is Foo!(Bar)", but then you have: > > auto b = foo.property; > b. <-- and here? > // remember "property" is templated and depends on static analysis > // or the IDE could need to resolve alias this or other things > > So... my opinion (like some others, I see) is to either ask things to > the compiler directly (but here the compiler lacks some info, like exact > source range positions), or to have a compiler (not a full-blown one, > just the front-end) built into the IDE, and that's what Descent is. > Unfortunately Descent is sometimes slow, sometimes buggy, but that's > normal: just a few people develop and maintain it (so I can see a > similarity with dmd here, where each day I see two or three new bugs > reported). If more people were into it, more unit tests were written > into it and, most of all, more people would use it, it'll get better. > > Another problem that people see in Descent (maybe also JDT Eclipse and > Visual Studio0 is that it's huge, it consumes a lot of memory and they > don't want to open a huge tool just to hack some lines. My answer is: > memory performance can be improved (but not a lot), but since an IDE is > a huge tool it requires a lof from the computer. And an IDE is not meant > to be used to hack some lines, it's meant to help you write big project, > huge projects without getting lost in the amount of code. > > So my bet would be to start supporting an existing IDE that integrates a > compiler into it. Updating it is easy: just port the diffs between DMD > versions. It's a huge job for one or two people, but if a lot of people > were involved it's not that much. Of course I'd recommend you to try > Descent since I'm one of it's creators and I do believe it can get > pretty good. :-) A lot of people like me have been waiting for a good IDE for D for a long time. In the field of IDE of D, Descent has already have a good baseline. So I think the community should put more effort in make Descent better, other than create another IDE. For this reason, I think Ary Borenszweig's opinion on in which way can dmd help in building a better IDE may be more valuable than Water's, for he is the author of the currently most advanced IDE of D. Sorry for my poor English.
Re: CTFE vs. traditional metaprogramming
language_fan wrote: Sat, 10 Oct 2009 10:30:31 +0200, Don thusly wrote: The more fundamental problem is that you can't instantiate a template from inside CTFE. IE, you can cross from the "compile-time world" to the "runtime world" only once -- you can never get back. That's not exactly true. Also both templates and CTFE are compile time features. You can compute a value with CTFE in the "value world" and lift the result to the "type world" with a template. Yes, but the problem is that variables inside a CTFE function, even though they are known at compile-time, are not permitted to be used as template value parameters. For example: template A(int X) { enum int A = B(X)+1; } // OK, template can call CTFE int B(int X) { return A!(X) + 1; } // Not OK, CTFE cannot call template.
Re: dmd support for IDEs
Sun, 11 Oct 2009 16:07:44 -0300, Leandro Lucarella thusly wrote: > Walter Bright, el 10 de octubre a las 18:19 me escribiste: >> In my discussions with companies about adopting D, the major barrier >> that comes up over and over isn't Tango vs Phobos, dmd being GPL, >> debugger support, libraries, bugs, etc., although those are important. >> >> It's the IDE. >> >> They say that the productivity gains of D's improvements are >> overbalanced by the loss of productivity by moving away from an IDE. >> And what is it about an IDE that is so productive? Intellisense >> (Microsoft's word for autocompletion). > > I think you've got that answer because they are not using D alread. When > they start using D, they will start complaining about Phobos vs. Tango, > debugger support, librararies, bugs, etc. ;) (maybe not DMD being GPL > though, even when I think it's important). What can I say, the larger the enterprise, the larger the expectations and need for stability. You can try it yourself, any Java 1.4 code from 2003 can be compiled, debugged, profiled etc. nicely with the most recent version of jdk and 3rd party tools. It's also nicely compatible with new code. OTOH take some D 1.0 code from 2003 (e.g. the free dool/dui or aba games code available online) and try to do *something* with it. Basically nothing works. You even have problems with new code as some project depends on a specific svn version of tango trunk. There is a lot to be done before D is ready for large scale enterprise use.
Re: dmd support for IDEs
Sun, 11 Oct 2009 17:01:03 -0400, Nick Sabalausky thusly wrote: > "language_fan" wrote in message > news:hasd5u$1fg...@digitalmars.com... >> >> Well since there is already a project working on an Eclipse plugin, I >> see little use for other IDEs at the moment. The D community is rather >> small and only a small amount of people are capable of developing and >> willing to donate their free time on free IDE development (commercial >> IDEs have small potential now that >> Netbeans/Eclipse/IntelliJ/KDevelop/Visual Studio dominate the market). >> So why not concentrate on fixing the spec and fixing compiler bugs >> instead of building a modest IDE support no one will use? > > Any editor that is less responsive than notepad is useless to me, and > I'm far from alone on that. Thus, we don't go anywhere near Eclipse, > VS.NET, or anything along those lines (bunch of bloated garbage...and > probably designed to get developers to buy fancier hardware and thus end > up develop apps that require their users to buy fancier hardware). Fine, if you are happy with your productivity. For me it was a natural choice. I started with notepad like editors, then moved to "programmer's editors" like crimson editor and jedit, soon discovered vim and emacs, and finally have settled down on Eclipse, Netbeans, Visual Studio, and IntelliJ IDEA. The productivity boost is enormous. "Practical" languages have lots of boiler-plate, and I can easily generate hundreds of lines of code with a couple of key combinations or mouse clicks. Another killer feature is the "intellisense" stuff. Having the ability to see a) inferred type b) integrated html rendered javadoc c) type correct class members etc. saves me hours of work time per day. YMMV
Re: Geek of the week
bearophile wrote: Just a note: What are the application areas that D targets? WB: In short, any application that would otherwise use C or C++ would be suitable for D.< That may become true in future, but it can't be true now. If I buy an Arduino, or a little 16 bit CPU that has to go inside a cheap microwave oven, I usually have to program it in C, Forth (or worse). I can't use D for that. Currently D is not fit for the world of small real-time CPUs. And embedded CPUs are very common, for every desktop (and handheld) CPU produced, 10 or 100 small CPUs for embedded purposes are produced. But there are possible ways to make D fitter for those purposes. For example it may be designed a "lightD", a subset of D (that has no built-in AAs, that uses no GC, etc), and adds several tricks/constructs useful when your available RAM is 1200 bytes long and your available ROM (well, flash, or a different slower kind of RAM) is 3 bytes. In such situations a compiler is even asked to produce not just the faster or shorter binary, but sometimes even the less energy consuming one! (think about a -Oe compilation flag, beside the -O and the -Os). Or maybe D will never fit for such purposes. I wouldn't want the language to be too different though. Maybe a subset runtime (with gc off by default) + std lib though (subset of existing and not really a third choice of library). Call just about anything in tango and you get an allocation, no explicit delete and an assumption that the GC will take care of it eventually. Aswell as the embedded, regular operating systems are a big area of C/C++. This should be an easier fit for D but all D kernel/os projects have probably been abandoned.
Re: Geek of the week
Tim Matthews: > I wouldn't want the language to be too different though. I agree. But it will take some work to have a D compiler able to produce uncompressed binaries 2500 bytes long that at runtime use 500 bytes of RAM to do something useful :-) Bye, bearophile
Re: CTFE vs. traditional metaprogramming
language_fan wrote: Sat, 10 Oct 2009 10:26:11 +0200, Don thusly wrote: CTFE doesn't mean "string mixins using CTFE". It just means CTFE. (BTW you can do string mixins with templates only, no CTFE, if you are completely insane). CTFE without mixins is rather limited form of metaprogramming. You can basically only initialize some static non-code data, and not much more. That's a lot, though. For example, you can perform the compilation step for a regexp, and determine whether it needs to be implemented with backtracking, or not. CTFE is perfect for parsing DSLs. String mixins with templates was the only way to go before CTFE became possible -- those were the times! They were very short times . String mixins were introduced in DMDD1.005, (5 Feb 2007) and CTFE came in 1.006, ten days later. But that was indeed a very fun time for D. I did a lot of early metaprogramming work with template value parameters, before string mixins. It was quite ugly, and painful to write. D metaprogramming techniques have gradually got less hacky over time.
Re: OT: GUI Libraries
Sun, 11 Oct 2009 22:54:39 -0400, Chad J thusly wrote: > Jeremie Pelletier wrote: > >> We can make programs that switch between GUI backends, most just don't >> go in that direction. Its as easy as graphics engines having GL and DX >> backends for their render system. Web 2.0 toolkits are platform neutral. You can define your own GUI with javascript & html & css. The interfaces (ajax, javascript, css, html, xml) have all been standardized. The objects on the GUI also do not waste low level handles like the traditional GUI toolkits do. I am sure that more locally usable Web 2.0 desktop applications are coming in the next few years.
Re: Messages both in d.D.ide and d.D ?
On 10/11/09 23:15, Walter Bright wrote: Denis Koroskin wrote: On Mon, 12 Oct 2009 00:44:48 +0400, Jacob Carlborg wrote: Why do some messages show up both in d.D.ide and d.D? Because the Walter decided to post the topic to both newsgroups at once, and all the replies follow it (take a look at message header). I tried that as an experiment. Not sure if it was a good idea or not. Probably not. No it's just confusing, trying to follow one discussion in two newsgroups
Re: A safer switch? + abbreviation of member names in enum switches
Mon, 12 Oct 2009 04:55:07 -0400, Justin Johansson thusly wrote: > Would it be possible for the compiler to infer the declared enum type, > in this case Color, making for abbreviation of the enum member names in > the case clauses [snip]? Yes. Java does this.
Re: CTFE vs. traditional metaprogramming
Mon, 12 Oct 2009 12:07:19 +0200, Don thusly wrote: > language_fan wrote: >> Sat, 10 Oct 2009 10:30:31 +0200, Don thusly wrote: >> >>> The more fundamental problem is that you can't instantiate a template >>> from inside CTFE. IE, you can cross from the "compile-time world" to >>> the "runtime world" only once -- you can never get back. >> >> That's not exactly true. Also both templates and CTFE are compile time >> features. You can compute a value with CTFE in the "value world" and >> lift the result to the "type world" with a template. > > Yes, but the problem is that variables inside a CTFE function, even > though they are known at compile-time, are not permitted to be used as > template value parameters. For example: > > template A(int X) { enum int A = B(X)+1; } // OK, template can call CTFE > > int B(int X) { return A!(X) + 1; } > // Not OK, CTFE cannot call template. As far as I can tell there is no reason why you cannot call templates from a CTFE code. Your code above has two problems: a) it never terminates b) due to some lookup problem the compiler gets confused, this has nothing to do with CTFE not being able to call templates - for instance this works: > template A(int X) { enum int A = 2+1; } > > int B(int X) { return A!(X) + 1; }
Re: Rationals Lib?
dsimcha wrote: I've written a prototype lib that does arithmetic on rational numbers (fractions). I got the idea from the Maxima computer algebra system. ( http://maxima.sourceforge.net ). It's templated to work on any integer type where operators are properly overloaded, though in practice you'd probably want to use something arbitrary precision, since adding/subtracting fractions can yield some really really big numbers for numerators and denominators, and if you don't care that much about accuracy, floats are faster anyhow. I'm still cleaning things up, etc, but usage is something like this: import std.bigint, fractions; void main() { auto f1 = fraction( BigInt("314159265"), BigInt("27182818")); auto f2 = fraction( BigInt("8675309"), BigInt("362436")); f1 += f2; assert(f1 == fraction( BigInt("174840986505151"), BigInt("4926015912324"))); // Print result. Prints: // "174840986505151 / 4926015912324" writeln(f1); // Print result in decimal form. Prints: // "35.4934" writeln(cast(real) result); } Some questions for the community: 1. Does this look useful to anyone? 2. What might be some non-obvious key features for a lib like this? 3. What is the status of arbitrary precision integer arithmetic in D2? Will we be getting something better than std.bigint in the foreseeable future? This lib isn't very useful without a fast BigInt underneath it. Yes, I will moving Tango BigInt to D2 Phobos. I've been delaying it for ages, hoping there would be a progress on the Phobos/Tango merger. But the Tango folks just don't seem interested in a merger, or even in closing the rift. :-( 4. There is one small part (conversion to float) where I had to assume that the BigInt implementation was the one in std.bigint, to cast certain division results back to native types. Will there eventually be a de facto standard way to cast BigInts to native types so I can get rid of this dependency? Yes. 5. Is there any use for approximate rational arithmetic built on machine-sized integers? For example, if adding two fractions would generate an overflow, try to find the closest answer that wouldn't? I would guess that if you want to do something like this, you're better off just using floats, but I could be wrong. I can't think of a use for it.
Re: dmd support for IDEs
On 10/12/09 02:08, Jeremie Pelletier wrote: Lutger wrote: Jacob Carlborg wrote: ... As far as I know neither Qt(d) or gtkD uses native controls on platforms other than linux, which to me is unacceptable. The look especially on mac. Qt used to try and look like native controls, but now it uses them directly. It has pros and cons, Firefox too has the native look and feel without using the native controls, so it saves on the overhead of tons of GDI handles and can render the entire GUI in cairo. In the Mac version for a long time they used the older tabs from Mac OS X 10.4 or even older. That's the problem not using native controls, if the operating system change them it's a lot of more work to update your application.
Re: dmd support for IDEs
On 10/12/09 04:14, Chad J wrote: Jeremie Pelletier wrote: Lutger wrote: Jacob Carlborg wrote: ... As far as I know neither Qt(d) or gtkD uses native controls on platforms other than linux, which to me is unacceptable. The look especially on mac. Qt used to try and look like native controls, but now it uses them directly. It has pros and cons, Firefox too has the native look and feel without using the native controls, so it saves on the overhead of tons of GDI handles and can render the entire GUI in cairo. I actually rather dislike GTK from a user standpoint. It doesn't mesh well at all on my KDE linux setup. The file dialog is also a frequent source of annoyance, as it is different then everything else and seems to want to fight with me. Qt is much better at these things. Too bad we can't just make programs switch between GUI backends at will ;) Why not have a GUI toolkit available on almost all platforms that uses native controls just like DWT?
Re: Messages both in d.D.ide and d.D ?
Mon, 12 Oct 2009 13:32:00 +0200, Jacob Carlborg thusly wrote: > On 10/11/09 23:15, Walter Bright wrote: >> Denis Koroskin wrote: >>> On Mon, 12 Oct 2009 00:44:48 +0400, Jacob Carlborg >>> wrote: >>> Why do some messages show up both in d.D.ide and d.D? >>> >>> Because the Walter decided to post the topic to both newsgroups at >>> once, and all the replies follow it (take a look at message header). >> >> I tried that as an experiment. Not sure if it was a good idea or not. >> Probably not. > > No it's just confusing, trying to follow one discussion in two > newsgroups A proper NNTP client fully supports crossposting. There is no need to re- read the messages.
Re: CTFE vs. traditional metaprogramming
language_fan wrote: Mon, 12 Oct 2009 12:07:19 +0200, Don thusly wrote: language_fan wrote: Sat, 10 Oct 2009 10:30:31 +0200, Don thusly wrote: The more fundamental problem is that you can't instantiate a template from inside CTFE. IE, you can cross from the "compile-time world" to the "runtime world" only once -- you can never get back. That's not exactly true. Also both templates and CTFE are compile time features. You can compute a value with CTFE in the "value world" and lift the result to the "type world" with a template. Yes, but the problem is that variables inside a CTFE function, even though they are known at compile-time, are not permitted to be used as template value parameters. For example: template A(int X) { enum int A = B(X)+1; } // OK, template can call CTFE int B(int X) { return A!(X) + 1; } // Not OK, CTFE cannot call template. As far as I can tell there is no reason why you cannot call templates from a CTFE code. Your code above has two problems: a) it never terminates It wasn't meant to be a compilable example. b) due to some lookup problem the compiler gets confused, this has nothing to do with CTFE not being able to call templates - for instance this works: template A(int X) { enum int A = 2+1; } int B(int X) { return A!(X) + 1; } You're seeing a few bugs there. In the template X isn't a constant, it's an alias (that is NOT in the spec, bug 2962). If you try adding a "static assert(X!=2)", you'll find it's not a constant. It will let you write: enum int A = X + 1; but that's bug 2414. The rule is, any CTFE function must also be evaluatable at run-time. Templates cannot be instantiated at run-time. Therefore templates cannot be instantiated in CTFE.
Re: Messages both in d.D.ide and d.D ?
On 10/12/09 14:02, language_fan wrote: Mon, 12 Oct 2009 13:32:00 +0200, Jacob Carlborg thusly wrote: On 10/11/09 23:15, Walter Bright wrote: Denis Koroskin wrote: On Mon, 12 Oct 2009 00:44:48 +0400, Jacob Carlborg wrote: Why do some messages show up both in d.D.ide and d.D? Because the Walter decided to post the topic to both newsgroups at once, and all the replies follow it (take a look at message header). I tried that as an experiment. Not sure if it was a good idea or not. Probably not. No it's just confusing, trying to follow one discussion in two newsgroups A proper NNTP client fully supports crossposting. There is no need to re- read the messages. Do you have any suggestions (available on mac)? I use Thunderbird now.
Re: CTFE vs. traditional metaprogramming
On Mon, 12 Oct 2009 16:01:59 +0400, Don wrote: language_fan wrote: Mon, 12 Oct 2009 12:07:19 +0200, Don thusly wrote: language_fan wrote: Sat, 10 Oct 2009 10:30:31 +0200, Don thusly wrote: The more fundamental problem is that you can't instantiate a template from inside CTFE. IE, you can cross from the "compile-time world" to the "runtime world" only once -- you can never get back. That's not exactly true. Also both templates and CTFE are compile time features. You can compute a value with CTFE in the "value world" and lift the result to the "type world" with a template. Yes, but the problem is that variables inside a CTFE function, even though they are known at compile-time, are not permitted to be used as template value parameters. For example: template A(int X) { enum int A = B(X)+1; } // OK, template can call CTFE int B(int X) { return A!(X) + 1; } // Not OK, CTFE cannot call template. As far as I can tell there is no reason why you cannot call templates from a CTFE code. Your code above has two problems: a) it never terminates It wasn't meant to be a compilable example. b) due to some lookup problem the compiler gets confused, this has nothing to do with CTFE not being able to call templates - for instance this works: template A(int X) { enum int A = 2+1; } int B(int X) { return A!(X) + 1; } You're seeing a few bugs there. In the template X isn't a constant, it's an alias (that is NOT in the spec, bug 2962). If you try adding a "static assert(X!=2)", you'll find it's not a constant. It will let you write: enum int A = X + 1; but that's bug 2414. The rule is, any CTFE function must also be evaluatable at run-time. Templates cannot be instantiated at run-time. Therefore templates cannot be instantiated in CTFE. I believe you mean "Templates that depend on arguments passed to a function cannot be instantiated". It doesn't mean you can't used templates in CTFE at all.
Re: dmd support for IDEs
Mon, 12 Oct 2009 14:02:11 +0200, Jacob Carlborg thusly wrote: > On 10/12/09 04:14, Chad J wrote: >> Too bad we can't just make programs switch between GUI backends at will >> ;) > > Why not have a GUI toolkit available on almost all platforms that uses > native controls just like DWT? The list of native platforms SWT supports is this: Win32 WPF (under development) AIX, FreeBSD, Linux, HP-UX, Solaris: Motif GTK+ Mac OS X: Carbon Cocoa QNX Photon Pocket PC As a FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia user I fail to see how SWT is more native than the ones I develop for. All SWT applications look weird, unthemed, and have horrible usability issues in the file open/save dialogs. DWT brings another level of cruft above the "lightweight" SWT and performs badly.
Re: Messages both in d.D.ide and d.D ?
On Mon, 12 Oct 2009 16:05:13 +0400, Jacob Carlborg wrote: On 10/12/09 14:02, language_fan wrote: Mon, 12 Oct 2009 13:32:00 +0200, Jacob Carlborg thusly wrote: On 10/11/09 23:15, Walter Bright wrote: Denis Koroskin wrote: On Mon, 12 Oct 2009 00:44:48 +0400, Jacob Carlborg wrote: Why do some messages show up both in d.D.ide and d.D? Because the Walter decided to post the topic to both newsgroups at once, and all the replies follow it (take a look at message header). I tried that as an experiment. Not sure if it was a good idea or not. Probably not. No it's just confusing, trying to follow one discussion in two newsgroups A proper NNTP client fully supports crossposting. There is no need to re- read the messages. Do you have any suggestions (available on mac)? I use Thunderbird now. I use Opera 10 and it works just great: marking a message as read in digitalmars.D also marks it read in digitalmars.IDE
Re: CTFE vs. traditional metaprogramming
Mon, 12 Oct 2009 14:01:59 +0200, Don thusly wrote: > language_fan wrote: >> As far as I can tell there is no reason why you cannot call templates >> from a CTFE code. Your code above has two problems: a) it never >> terminates > > It wasn't meant to be a compilable example. > > b) due to some lookup problem the compiler gets confused, this >> has nothing to do with CTFE not being able to call templates - for >> instance this works: >> >>> template A(int X) { enum int A = 2+1; } >>> >>> int B(int X) { return A!(X) + 1; } > > You're seeing a few bugs there. In the template X isn't a constant, it's > an alias (that is NOT in the spec, bug 2962). If you try adding a > "static assert(X!=2)", you'll find it's not a constant. It will let you > write: enum int A = X + 1; but that's bug 2414. > > The rule is, any CTFE function must also be evaluatable at run-time. > Templates cannot be instantiated at run-time. Therefore templates cannot > be instantiated in CTFE. Ah, I see what you meant now. Indeed, there are some open issues wrt how these things should work. Basically your original example could be compilable, even when there is a dependency on a runtime variable, if a proper macro system was available. The compiler could just copy'n'paste the template body to the point where it is being instantiated. This all happens in the static part of the function declaration. I have no idea how to fix the template system -- I'm not too happy with the idea of extending parametric polymorphism this much. A distinct AST level macro system would make more sense.
Re: dmd support for IDEs
Sat, 10 Oct 2009 18:19:56 -0700, Walter Bright thusly wrote: > In my discussions with companies about adopting D, the major barrier > that comes up over and over isn't Tango vs Phobos, dmd being GPL, > debugger support, libraries, bugs, etc., although those are important. > > It's the IDE. > > They say that the productivity gains of D's improvements are > overbalanced by the loss of productivity by moving away from an IDE. And > what is it about an IDE that is so productive? Intellisense (Microsoft's > word for autocompletion). > > So, while I'm not going to be writing an IDE, I figure that dmd can > help. dmd already puts out .doc and .di files. How about putting out an > xml file giving all the information needed for an IDE to implement > autocompletion? There'd be one .xml file generated per .d source file. > > The nice thing about an xml file is while D is relatively easy to parse, > xml is trivial. Furthermore, an xml format would be fairly robust in the > face of changes to D syntax. > > What do you think? Another point not mentioned here is that modern IDEs use incremental and interactive compilation model. The compiler should be run as a persistent background process and parsing should happen perhaps on the level of the current scope. Re-compiling a million line project after each key stroke simply makes no sense. Even compiling the current module once per key stroke is too slow. Specifying an intermediate json/xml file format is a huge task considering the amount of language constructs, types etc. available in D. I'm all for good tool support but as many have already mentioned, the support would only bring marginal improvements to small scale tools like vim and emacs. Usually small scale D projects (< 1 lines of code) are written with those tools (feel free to prove me wrong). These are not the kinds of projects large enterprises would use D for, they use scripting languages for smaller tasks. Thus the overall improvement is minimal. Spending the time on critical compiler bugs on the other hand would help everyone in the community.
Re: Array literals' default type
Sat, 10 Oct 2009 17:15:55 +0200, Yigal Chripun thusly wrote: > Now, wouldn't it be wonderful if D had provided real tuple support > without all the Tuple!() nonsense? 'D has full built-in tuple support' has been the answer each time I've asked. It seems not to be advisable to ask more about this specific feature since the language creators easily get annoyed when asked about this. They see more value in reserving the syntax for the C style sequencing operator which is rarely used. Also they have apparently scientifically proven that the auto-flattening semantics of tuples somehow works better than real product types, and have no intention to make it an explicit controllable operation, which is also easily implementable.
Re: SymRational, Computer Algebra
On Sun, 11 Oct 2009 12:24:57 -0500, dsimcha wrote: I've been thinking about where a Rational struct could lead, and realized that the next step is to give D some capabilities for dealing with symbols. For example, it would be nice to have something like: auto foo = symRational!SomeBigInt("1 / e + pi / 2 + G"); // Do a whole bunch of manipulations on foo. writeln(foo); // Symbolic expression. writeln(toReal(foo, constVal("G", 6e-11), constVal("pi", 3.14), constVal("e", 2.718)); Of course, now we're starting to talk about building a basic computer algebra system into Phobos, or at least into some stand-alone lib. While we clearly don't have the manpower to do a "real" CAS, some basic CAS-like capabilities would be nice. Programmers in most languages tend to use floating-point arithmetic as their default way of doing math. It really only makes sense to do this when speed is more important than precision or interpretability of the answer. However, it seems to get used even when this isn't the case simply because it's what's readily available. If D/Phobos had some built-in (very basic) CAS-like capabilities that were as easy to use as floats, people might actually consider using either symbolic or numerical manipulation on the relevant tradeoffs rather than just choosing numeric because it's what's easily available. The problem with using a CAS's builtin language whenever you want basic CAS-like capabilities is that it's too domain-specific. You can't easily integrate it into a larger program that requires a full-fledged general purpose programming language. The beauty of D is that it has so many features for library designers that libraries can start to look like DSLs yet still integrate smoothly with the general-purpose subset of D. Half the reason why I wrote the dstats statistics lib was to prove this concept, since similar issues arise in performing statistical calculations. The question, then, becomes, how far do we go toward trying to put some basic CAS-like capabilities like symbolic arithmetic into Phobos? Could things like this really be D's killer application? I think CAS capabilities would be much better for a third-party library than for Phobos. The Phobos developers may not be interested in improving it like the maintainers of a third-party library would. Also, you wouldn't have to tie the releases of the CAS library to the Phobos releases if it were a third-party library. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: dmd support for IDEs
Jacob Carlborg schrieb: > On 10/11/09 20:58, Yigal Chripun wrote: >> On 11/10/2009 15:23, Ary Borenszweig wrote: >>> Walter Bright wrote: In my discussions with companies about adopting D, the major barrier that comes up over and over isn't Tango vs Phobos, dmd being GPL, debugger support, libraries, bugs, etc., although those are important. It's the IDE. So, while I'm not going to be writing an IDE, I figure that dmd can help. dmd already puts out .doc and .di files. How about putting out an xml file giving all the information needed for an IDE to implement autocompletion? There'd be one .xml file generated per .d source file. What do you think? >>> >>> What I think is that even with an xml representing the parse tree (maybe >>> with some semantic stuff resolved) it'll be still incomplete for a real >>> IDE (the kind of thing users expect from an IDE). You can see this >>> video, for example: >>> >>> http://www.youtube.com/watch?v=KQbTT605ags >>> >>> So you have: >>> >>> --- >>> module one; >>> >>> class Foo(T) { >>> static if (is(T == class)) { >>> T property; >>> } else { >>> T someMethod() { return T.init; } >>> } >>> mixin(guessWhat!(T)()); >>> } >>> --- >>> >>> You want to define an xml for that module that'll help IDEs. Can you >>> think what it'll look like? >>> >>> Now the user writes in another module: >>> >>> class Bar { >>> } >>> >>> void x() { >>> auto foo = new Foo!(Bar)(); >>> foo. <-- what does the IDE do here? >>> } >>> >>> Now, the correct thing for the IDE to do is to suggest the field "Bar >>> property". How can the IDE do that just with an xml? It can't. It need >>> to perform some kind of semantic anlysis to Foo's argument to see if >>> it's a class, match the static if in the template, replace template >>> parameters, etc. It also needs to evaluate the string mixin. >>> >>> Of course you could say "Bah, just show all the declarations inside the >>> template in the autocomplete", but that's wrong. That'll lead to files >>> that don't compile. You could ommit supporting autocompletion or other >>> nice features, but that's exactly the big features of D. If you don't >>> support that then it's like using Java or C# from within the IDE: you >>> could use the advanced features but the IDE won't help you. And in your >>> discussions with companies adopting D, I'm sure they were talking about >>> great IDEs like JDT Eclipse or Visual Studio, not just some tool that >>> helps you a little but not anymore when things get interesting. >>> >>> Oh, and you need to have some kind of semantic analysis to know the type >>> of "auto foo". Again, maybe the IDE can be dummy and see "auto foo = new >>> Foo!(Bar)" and say "ok, foo's type is Foo!(Bar)", but then you have: >>> >>> auto b = foo.property; >>> b. <-- and here? >>> // remember "property" is templated and depends on static analysis >>> // or the IDE could need to resolve alias this or other things >>> >>> So... my opinion (like some others, I see) is to either ask things to >>> the compiler directly (but here the compiler lacks some info, like exact >>> source range positions), or to have a compiler (not a full-blown one, >>> just the front-end) built into the IDE, and that's what Descent is. >>> Unfortunately Descent is sometimes slow, sometimes buggy, but that's >>> normal: just a few people develop and maintain it (so I can see a >>> similarity with dmd here, where each day I see two or three new bugs >>> reported). If more people were into it, more unit tests were written >>> into it and, most of all, more people would use it, it'll get better. >>> >>> Another problem that people see in Descent (maybe also JDT Eclipse and >>> Visual Studio0 is that it's huge, it consumes a lot of memory and they >>> don't want to open a huge tool just to hack some lines. My answer is: >>> memory performance can be improved (but not a lot), but since an IDE is >>> a huge tool it requires a lof from the computer. And an IDE is not meant >>> to be used to hack some lines, it's meant to help you write big project, >>> huge projects without getting lost in the amount of code. >>> >>> So my bet would be to start supporting an existing IDE that integrates a >>> compiler into it. Updating it is easy: just port the diffs between DMD >>> versions. It's a huge job for one or two people, but if a lot of people >>> were involved it's not that much. Of course I'd recommend you to try >>> Descent since I'm one of it's creators and I do believe it can get >>> pretty good. :-) >> >> well put. >> >> btw, given that we have a port of SWT for D, how hard would it be to >> create our own native D version of eclipse? > > Frank Benoit (who started DWT, the tango version) was think about this. > Quite a big part is already ported, SWT, JFace, Forms, OSGI and so on, > see: http://hg.dsource.org/projects/dwt2/file/88652073d1c2/ . Sorry, OSGi is just dummy, to make other stuff compile.
Re: A safer switch? + abbreviation of member names in enum switches
language_fan Wrote: > Mon, 12 Oct 2009 04:55:07 -0400, Justin Johansson thusly wrote: > > > Would it be possible for the compiler to infer the declared enum type, > > in this case Color, making for abbreviation of the enum member names in > > the case clauses [snip]? > > Yes. Java does this. My question written in haste. Strike "possible for the compiler to infer the declared enum type" and replace with "a desirable feature for the compiler to be able to infer the declared enum type". Naturally it would be possible. bearophile Wrote: > That's a special case, with the purpose of shortening code a little. So while > writing Color.something isn't handy, it safe and it has no special casing. So > I don't like your idea a lot. Sorry; my feeling is that if it's not necessary to type the extra verbage, why be compelled to do so, especially in this case when the type of the case targets are tightly bound to the type of the var in the switch(). There is absolutely no loss of type safety that I can see .. though I'm prepared to be corrected. btw. It's been a few months since I've coded in Java but the reason the issue stuck me was that I had initially typed the shorter version in D out of die-hard (Java) habit and then, upon complaint, briefly thought, okay Mr D Compiler, since you insist ... > Related: I have compiled your code with D1 with warnings (-w): > enum Color { > RED, > GREEN, > BLUE > } > > void foo(Color color) { > switch (color) { > case Color.RED: > break; > case Color.GREEN: > break; > case Color.BLUE: > break; > } > } > > warning - test.d(8): Error: switch statement has no default > warning - test.d(8): Error: statement is not reachable > > But there's no need for default there because all enum cases are covered. So > that warning test has to be improved. Indeed. -- Justin Johansson
Re: dmd support for IDEs
On 12/10/2009 11:41, breezes wrote: Ary Borenszweig Wrote: Walter Bright wrote: In my discussions with companies about adopting D, the major barrier that comes up over and over isn't Tango vs Phobos, dmd being GPL, debugger support, libraries, bugs, etc., although those are important. It's the IDE. So, while I'm not going to be writing an IDE, I figure that dmd can help. dmd already puts out .doc and .di files. How about putting out an xml file giving all the information needed for an IDE to implement autocompletion? There'd be one .xml file generated per .d source file. What do you think? What I think is that even with an xml representing the parse tree (maybe with some semantic stuff resolved) it'll be still incomplete for a real IDE (the kind of thing users expect from an IDE). You can see this video, for example: http://www.youtube.com/watch?v=KQbTT605ags So you have: --- module one; class Foo(T) { static if (is(T == class)) { T property; } else { T someMethod() { return T.init; } } mixin(guessWhat!(T)()); } --- You want to define an xml for that module that'll help IDEs. Can you think what it'll look like? Now the user writes in another module: class Bar { } void x() { auto foo = new Foo!(Bar)(); foo.<-- what does the IDE do here? } Now, the correct thing for the IDE to do is to suggest the field "Bar property". How can the IDE do that just with an xml? It can't. It need to perform some kind of semantic anlysis to Foo's argument to see if it's a class, match the static if in the template, replace template parameters, etc. It also needs to evaluate the string mixin. Of course you could say "Bah, just show all the declarations inside the template in the autocomplete", but that's wrong. That'll lead to files that don't compile. You could ommit supporting autocompletion or other nice features, but that's exactly the big features of D. If you don't support that then it's like using Java or C# from within the IDE: you could use the advanced features but the IDE won't help you. And in your discussions with companies adopting D, I'm sure they were talking about great IDEs like JDT Eclipse or Visual Studio, not just some tool that helps you a little but not anymore when things get interesting. Oh, and you need to have some kind of semantic analysis to know the type of "auto foo". Again, maybe the IDE can be dummy and see "auto foo = new Foo!(Bar)" and say "ok, foo's type is Foo!(Bar)", but then you have: auto b = foo.property; b.<-- and here? // remember "property" is templated and depends on static analysis // or the IDE could need to resolve alias this or other things So... my opinion (like some others, I see) is to either ask things to the compiler directly (but here the compiler lacks some info, like exact source range positions), or to have a compiler (not a full-blown one, just the front-end) built into the IDE, and that's what Descent is. Unfortunately Descent is sometimes slow, sometimes buggy, but that's normal: just a few people develop and maintain it (so I can see a similarity with dmd here, where each day I see two or three new bugs reported). If more people were into it, more unit tests were written into it and, most of all, more people would use it, it'll get better. Another problem that people see in Descent (maybe also JDT Eclipse and Visual Studio0 is that it's huge, it consumes a lot of memory and they don't want to open a huge tool just to hack some lines. My answer is: memory performance can be improved (but not a lot), but since an IDE is a huge tool it requires a lof from the computer. And an IDE is not meant to be used to hack some lines, it's meant to help you write big project, huge projects without getting lost in the amount of code. So my bet would be to start supporting an existing IDE that integrates a compiler into it. Updating it is easy: just port the diffs between DMD versions. It's a huge job for one or two people, but if a lot of people were involved it's not that much. Of course I'd recommend you to try Descent since I'm one of it's creators and I do believe it can get pretty good. :-) A lot of people like me have been waiting for a good IDE for D for a long time. In the field of IDE of D, Descent has already have a good baseline. So I think the community should put more effort in make Descent better, other than create another IDE. For this reason, I think Ary Borenszweig's opinion on in which way can dmd help in building a better IDE may be more valuable than Water's, for he is the author of the currently most advanced IDE of D. Sorry for my poor English. What I definitely don't like is that Decent is just a Eclipse plugin. I don't want a Java IDE plus D. I would prefer a pure D IDE. Being a Netbeans guy but I am pretty sure that it is possible to remove all the Java related things. side effects : less bloat more speed. my 2 euro cents
Re: dmd support for IDEs
On Sun, 11 Oct 2009 09:32:32 -0500, Denis Koroskin <2kor...@gmail.com> wrote: On Sun, 11 Oct 2009 05:19:56 +0400, Walter Bright wrote: In my discussions with companies about adopting D, the major barrier that comes up over and over isn't Tango vs Phobos, dmd being GPL, debugger support, libraries, bugs, etc., although those are important. It's the IDE. They say that the productivity gains of D's improvements are overbalanced by the loss of productivity by moving away from an IDE. And what is it about an IDE that is so productive? Intellisense (Microsoft's word for autocompletion). So, while I'm not going to be writing an IDE, I figure that dmd can help. dmd already puts out .doc and .di files. How about putting out an xml file giving all the information needed for an IDE to implement autocompletion? There'd be one .xml file generated per .d source file. The nice thing about an xml file is while D is relatively easy to parse, xml is trivial. Furthermore, an xml format would be fairly robust in the face of changes to D syntax. What do you think? I believe it won't work. It will always be slow and incomplete. Instead, I would make it easier to embed DMD into an IDE: separate DMDFE from DMDBE, fix memory leaks, remove all the static data (so that code would be re-intrable and it could work in different threads in parallel), move most of DMD code into a DLL so that an IDE could dynamically link with it and whatever it pleases with the source code. In fact, that's what I do right now. I'm writing my own D IDE in my spare time (in D, of course). I already made a lot of progress and now it's time to start implementing source code analysis. First thing I did is I made complete D bindings for C++ code. It worked out quite well but it was leaking so badly that I dropped it. Instead, I started porting DMD entirely to D (except the backend, of course), and I already got some great results. A few simple programs compile and produce byte-perfect binaries. It's still in its early stages and there is a lot of work to do, but it will be finished soon (hopefully). It could probably become a part of an official distribution, eventually. :) If anyone is interested and is willing to test and/or help, I will gladly share my code. I would like it if this went open so I could examine it and possibly contribute to it. I have wanted to do something like this, but all I have started so far is a GUI toolkit. I am new to D so I have not spent much time on it yet. It would be nice to be able to work on something more developed. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: Array literals' default type
language_fan wrote: Sat, 10 Oct 2009 17:15:55 +0200, Yigal Chripun thusly wrote: Now, wouldn't it be wonderful if D had provided real tuple support without all the Tuple!() nonsense? 'D has full built-in tuple support' has been the answer each time I've asked. It seems not to be advisable to ask more about this specific feature since the language creators easily get annoyed when asked about this. They see more value in reserving the syntax for the C style sequencing operator which is rarely used. Also they have apparently scientifically proven that the auto-flattening semantics of tuples somehow works better than real product types, and have no intention to make it an explicit controllable operation, which is also easily implementable. Not so, Andrei has said that he thinks auto-flattening was a bad idea. And AFAIK, Walter doesn't disagree. Andrei and I, and almost everyone else, have tried to persuade Walter to remove the comma operator, but without success. But I doubt you'd be able to use it for tuples, because x, y = foo(); already has meaning in C and tuples would give it a different meaning. I'd LOVE to be proved wrong. It is very difficult to change Walter's mind about many things, but despite what people say, it is not impossible.
Re: dmd support for IDEs
BLS wrote: On 12/10/2009 11:41, breezes wrote: Ary Borenszweig Wrote: Walter Bright wrote: In my discussions with companies about adopting D, the major barrier that comes up over and over isn't Tango vs Phobos, dmd being GPL, debugger support, libraries, bugs, etc., although those are important. It's the IDE. So, while I'm not going to be writing an IDE, I figure that dmd can help. dmd already puts out .doc and .di files. How about putting out an xml file giving all the information needed for an IDE to implement autocompletion? There'd be one .xml file generated per .d source file. What do you think? What I think is that even with an xml representing the parse tree (maybe with some semantic stuff resolved) it'll be still incomplete for a real IDE (the kind of thing users expect from an IDE). You can see this video, for example: http://www.youtube.com/watch?v=KQbTT605ags So you have: --- module one; class Foo(T) { static if (is(T == class)) { T property; } else { T someMethod() { return T.init; } } mixin(guessWhat!(T)()); } --- You want to define an xml for that module that'll help IDEs. Can you think what it'll look like? Now the user writes in another module: class Bar { } void x() { auto foo = new Foo!(Bar)(); foo.<-- what does the IDE do here? } Now, the correct thing for the IDE to do is to suggest the field "Bar property". How can the IDE do that just with an xml? It can't. It need to perform some kind of semantic anlysis to Foo's argument to see if it's a class, match the static if in the template, replace template parameters, etc. It also needs to evaluate the string mixin. Of course you could say "Bah, just show all the declarations inside the template in the autocomplete", but that's wrong. That'll lead to files that don't compile. You could ommit supporting autocompletion or other nice features, but that's exactly the big features of D. If you don't support that then it's like using Java or C# from within the IDE: you could use the advanced features but the IDE won't help you. And in your discussions with companies adopting D, I'm sure they were talking about great IDEs like JDT Eclipse or Visual Studio, not just some tool that helps you a little but not anymore when things get interesting. Oh, and you need to have some kind of semantic analysis to know the type of "auto foo". Again, maybe the IDE can be dummy and see "auto foo = new Foo!(Bar)" and say "ok, foo's type is Foo!(Bar)", but then you have: auto b = foo.property; b.<-- and here? // remember "property" is templated and depends on static analysis // or the IDE could need to resolve alias this or other things So... my opinion (like some others, I see) is to either ask things to the compiler directly (but here the compiler lacks some info, like exact source range positions), or to have a compiler (not a full-blown one, just the front-end) built into the IDE, and that's what Descent is. Unfortunately Descent is sometimes slow, sometimes buggy, but that's normal: just a few people develop and maintain it (so I can see a similarity with dmd here, where each day I see two or three new bugs reported). If more people were into it, more unit tests were written into it and, most of all, more people would use it, it'll get better. Another problem that people see in Descent (maybe also JDT Eclipse and Visual Studio0 is that it's huge, it consumes a lot of memory and they don't want to open a huge tool just to hack some lines. My answer is: memory performance can be improved (but not a lot), but since an IDE is a huge tool it requires a lof from the computer. And an IDE is not meant to be used to hack some lines, it's meant to help you write big project, huge projects without getting lost in the amount of code. So my bet would be to start supporting an existing IDE that integrates a compiler into it. Updating it is easy: just port the diffs between DMD versions. It's a huge job for one or two people, but if a lot of people were involved it's not that much. Of course I'd recommend you to try Descent since I'm one of it's creators and I do believe it can get pretty good. :-) A lot of people like me have been waiting for a good IDE for D for a long time. In the field of IDE of D, Descent has already have a good baseline. So I think the community should put more effort in make Descent better, other than create another IDE. For this reason, I think Ary Borenszweig's opinion on in which way can dmd help in building a better IDE may be more valuable than Water's, for he is the author of the currently most advanced IDE of D. Sorry for my poor English. What I definitely don't like is that Decent is just a Eclipse plugin. I don't want a Java IDE plus D. I would prefer a pure D IDE. Being a Netbeans guy but I am pretty sure that it is possible to remove all the Java related things. side effects : less bloat more speed. my 2 euro cents No, but that's the good thing about it: it's
Re: Array literals' default type
Don wrote: Not so, Andrei has said that he thinks auto-flattening was a bad idea. And AFAIK, Walter doesn't disagree. You should try harder, because if you don't change it soon, it will be there forever due to compatibility requirements. Andrei and I, and almost everyone else, have tried to persuade Walter to remove the comma operator, but without success. But I doubt you'd be able to use it for tuples, because x, y = foo(); already has meaning in C and tuples would give it a different meaning. I'd LOVE to be proved wrong. Wasn't the comma operator to be supposed to be important for automatic code generation? Even if it is, you could just pick a different token to implement this operator. It doesn't have to be a comma, does it? It is very difficult to change Walter's mind about many things, but despite what people say, it is not impossible.
Re: dmd support for IDEs
Ary Borenszweig wrote: Michal Minich wrote somewhere else: --- You can try to download just bare Eclipse platform (which is just text editor) and install descent into it using Eclipse software updates. It starts up faster than C or Java version Eclipse and there is only D related stuff in the UI. http://download.eclipse.org/eclipse/downloads/drops/R-3.5.1-200909170800/index.php Under "Platform runtime binary" --- I tried it and it's true, it feels much lighter this way and you don't a lot of bloat in menus and other things. It would be great to put this on the Descent front page.
Re: A safer switch?
On Mon, Oct 12, 2009 at 04:03:13AM -0400, bearophile wrote: > But the "-h" case misses a break. This has been discussed to death *multiple times*. Why bring it up again, especially with nothing really new to add to the argument? Here's what I suggest you do to get what you want: make a macro in your editor so whenever you type the word "case" it expands it to "break; case". And expand "default" to "break; default". Then, you'll get the implicit breaks you want without changing the language for the rest of us. -- Adam D. Ruppe http://arsdnet.net
Re: A safer switch?
bearophile wrote: switch (arg) { case("-s") { try { next_arg = iargs.next(); size = toInt(args[idx++]); } catch (...) { throw new Exception("..."); } } case("-m") { printMessages = true; } case("-p") // just 1 istruction, no {} needed printResults = true; case("-h"); // semicolon isn't allowed here showUsage(); default { // default case may need some care throw new Exception("..."); } } You can do something like this: void main(string[] args) { auto t = ["-s"[]: { writefln("handle argument -s"); }, "-m": { writefln("handle argument -m"); }]; if (auto pcode = args[1] in t) { (*pcode)(); } else { //default case } } Even the ugly and unneeded case labels are gone! If you don't mind your ulta-modern switch-case to allocate memory when it's used. If you still don't like it, you can do some ugly mixin() and CTFE stuff. Nobody will mind because that's modern D style.
Re: Array literals' default type
grauzone wrote: Don wrote: Not so, Andrei has said that he thinks auto-flattening was a bad idea. And AFAIK, Walter doesn't disagree. You should try harder, because if you don't change it soon, it will be there forever due to compatibility requirements. The TODO list is very long. Andrei and I, and almost everyone else, have tried to persuade Walter to remove the comma operator, but without success. But I doubt you'd be able to use it for tuples, because x, y = foo(); already has meaning in C and tuples would give it a different meaning. I'd LOVE to be proved wrong. Wasn't the comma operator to be supposed to be important for automatic code generation? It's used frequently in in the compiler internals. EG, given int foo(X x = default_value) { return 0; } then foo(); becomes: (X tmp = default_value, foo(tmp)); I don't think it sees much use outside of compilers. There are other ways to get the same effect in user code. Even if it is, you could just pick a different token to implement this operator. It doesn't have to be a comma, does it? It doesn't need any syntax at all, when it's inside the compiler. But the problem is, that comma has that meaning in C. (OTOH I wonder how much extant C++ code uses the comma operator. I bet there's not much of it. (But more than code than uses octal!)). BTW as an asm programmer, I'm completely baffled as to why the concept of 'single return value from a function' became dominant in programming languages. It's a very unnatural restriction from a machine point of view.
Re: dmd support for IDEs
language_fan wrote: Sun, 11 Oct 2009 09:39:32 -0500, Ellery Newcomer thusly wrote: Denis Koroskin wrote: On Sun, 11 Oct 2009 05:19:56 +0400, Walter Bright wrote: If anyone is interested and is willing to test and/or help, I will gladly share my code. Oooo.. You should put that on dsource or somewhere. Hacking D sounds like a lot more fun than hacking C++. I wouldn't mind helping out on this one. Wow, I am pretty sure I have already seen a D port of dmd on dsource. Was there a good reason to start yet another port of it? Maybe learning, porting a library or application from a language to another is a great way to learn about it inside out. I used to do that a lot too.
Re: A safer switch?
grauzone wrote: bearophile wrote: switch (arg) { case("-s") { try { next_arg = iargs.next(); size = toInt(args[idx++]); } catch (...) { throw new Exception("..."); } } case("-m") { printMessages = true; } case("-p") // just 1 istruction, no {} needed printResults = true; case("-h"); // semicolon isn't allowed here showUsage(); default { // default case may need some care throw new Exception("..."); } } You can do something like this: void main(string[] args) { auto t = ["-s"[]: { writefln("handle argument -s"); }, "-m": { writefln("handle argument -m"); }]; if (auto pcode = args[1] in t) { (*pcode)(); } else { //default case } } Even the ugly and unneeded case labels are gone! If you don't mind your ulta-modern switch-case to allocate memory when it's used. If you still don't like it, you can do some ugly mixin() and CTFE stuff. Nobody will mind because that's modern D style. import std.getopt; void main(string[] args) { getopt(args, "s", { writefln("handle argument -s"); }, "-m", { writefln("handle argument -m"); }); ... } Andrei
Re: dmd support for IDEs
Yigal Chripun wrote: On 12/10/2009 07:33, Jeremie Pelletier wrote: Jérôme M. Berger wrote: Jeremie Pelletier wrote: I agree however that GTK being in C is rather annoying, C is a great language but GUIs is one area where OOP really shines. Note that Gtk *is* object oriented despite being in C... Jerome It's a sorry hack, you have to use casts everywhere you'd rely on polymorphism in D or C+ and its harder to remember, read, code, maintain, and doesn't have any performance gains over C++, the explicit struct pointer in C is the implicit 'this' in C++ and non-virtual methods can be optimized as direct calls with no vtbl indirections. I tried gtkD and I don't like using an OOP layer on top of a C interface because that adds overhead for the exact same features, most good GUI libraries should abstract the platform anyways so GTK is usually only seen there and not in user code. It's still more fun to use than the Windows' windowing API, which doesn't even support layout objects such as boxes and grids, now that's total pain! what about MS' WPF? It has all the bells and whistles of modern UI, doesn't it? Isn't that just a pretty layer on top of win32/com? I now only use native toolkits as backends for my gui abstraction layer, using this would only add a level of indirection and make no sense.
Re: A safer switch? + abbreviation of member names in enum switches
bearophile wrote: Justin Johansson: Would it be possible for the compiler to infer the declared enum type, in this case Color, making for abbreviation of the enum member names in the case clauses as per the following? void bar( Color color) { switch (color) { case RED: break; case GREEN: break; case BLUE: break; } } That's a special case, with the purpose of shortening code a little. So while writing Color.something isn't handy, it safe and it has no special casing. So I don't like your idea a lot. Related: I have compiled your code with D1 with warnings (-w): enum Color { RED, GREEN, BLUE } void foo(Color color) { switch (color) { case Color.RED: break; case Color.GREEN: break; case Color.BLUE: break; } } void main() {} It prints: warning - test.d(8): Error: switch statement has no default warning - test.d(8): Error: statement is not reachable But there's no need for default there because all enum cases are covered. So that warning test has to be improved. Bye, bearophile final switch(color) { ... } :)
Re: Use of first person in a book
On Fri, 09 Oct 2009 03:11:01 -0500, Andrei Alexandrescu wrote: Thanks to all who answered! I wish there was such consensus in other matters as well :o). Allow me to put forth an excerpt from TDPL without any particular reason: http://erdani.com/tdpl/excerpt.pdf Andrei Nice, but I noticed two mistakes on page 140. * "n divides p_k" => "p_k divides n" * In the paragraph starting with "Why does the iteration", the statement "If iter is greater than sqrt(n) then we can be sure iter can’t be a divisor of n" is wrong since iter could equal n (try 6 or 2 as input). The function still works since you return accum * n. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: dmd support for IDEs
On Mon, 12 Oct 2009 19:18:41 +0400, Jeremie Pelletier wrote: Yigal Chripun wrote: On 12/10/2009 07:33, Jeremie Pelletier wrote: Jérôme M. Berger wrote: Jeremie Pelletier wrote: I agree however that GTK being in C is rather annoying, C is a great language but GUIs is one area where OOP really shines. Note that Gtk *is* object oriented despite being in C... Jerome It's a sorry hack, you have to use casts everywhere you'd rely on polymorphism in D or C+ and its harder to remember, read, code, maintain, and doesn't have any performance gains over C++, the explicit struct pointer in C is the implicit 'this' in C++ and non-virtual methods can be optimized as direct calls with no vtbl indirections. I tried gtkD and I don't like using an OOP layer on top of a C interface because that adds overhead for the exact same features, most good GUI libraries should abstract the platform anyways so GTK is usually only seen there and not in user code. It's still more fun to use than the Windows' windowing API, which doesn't even support layout objects such as boxes and grids, now that's total pain! what about MS' WPF? It has all the bells and whistles of modern UI, doesn't it? Isn't that just a pretty layer on top of win32/com? I now only use native toolkits as backends for my gui abstraction layer, using this would only add a level of indirection and make no sense. No, IIRC, it doesn't rely on Win32 API at all: Wikipedia quote: Designed to remove dependencies on the aging GDI subsystem, WPF is built on DirectX, which provides hardware acceleration and enables modern UI features like transparency, gradients and transforms.
Re: dmd support for IDEs
On Mon, 12 Oct 2009 12:58:56 +0400, language_fan wrote: Sun, 11 Oct 2009 09:39:32 -0500, Ellery Newcomer thusly wrote: Denis Koroskin wrote: On Sun, 11 Oct 2009 05:19:56 +0400, Walter Bright wrote: If anyone is interested and is willing to test and/or help, I will gladly share my code. Oooo.. You should put that on dsource or somewhere. Hacking D sounds like a lot more fun than hacking C++. I wouldn't mind helping out on this one. Wow, I am pretty sure I have already seen a D port of dmd on dsource. Was there a good reason to start yet another port of it? I know about DParser, but it's somewhat outdated, incomplete and doesn't support code generation. It also diverged from DMD quite a lot so fixing it would be quite hard (I, too, plan to make it more D-ish - get rid of casts, replace void* "Array"s with type-safe equivalents etc - but not until it is 100% ready). I just believe rewriting it from scratch will be plain faster. I can also test the code much easier - if it produces exact same binary then it works correct.
Re: Array literals' default type
On Mon, 12 Oct 2009 09:47:34 -0500, Don wrote: (OTOH I wonder how much extant C++ code uses the comma operator. I bet there's not much of it. (But more than code than uses octal!)). Boost Assign uses the comma operator. http://www.boost.org/doc/libs/1_40_0/libs/assign/doc/index.html#operator+= However, the C++ code vector values; values += 1,2,3,4,5,6,7,8,9; could be translated to int[] values; values ~= [1,2,3,4,5,6,7,8,9]; in D so no comma operator would be needed there. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: dmd support for IDEs
Denis Koroskin wrote: On Mon, 12 Oct 2009 19:18:41 +0400, Jeremie Pelletier wrote: Yigal Chripun wrote: On 12/10/2009 07:33, Jeremie Pelletier wrote: Jérôme M. Berger wrote: Jeremie Pelletier wrote: I agree however that GTK being in C is rather annoying, C is a great language but GUIs is one area where OOP really shines. Note that Gtk *is* object oriented despite being in C... Jerome It's a sorry hack, you have to use casts everywhere you'd rely on polymorphism in D or C+ and its harder to remember, read, code, maintain, and doesn't have any performance gains over C++, the explicit struct pointer in C is the implicit 'this' in C++ and non-virtual methods can be optimized as direct calls with no vtbl indirections. I tried gtkD and I don't like using an OOP layer on top of a C interface because that adds overhead for the exact same features, most good GUI libraries should abstract the platform anyways so GTK is usually only seen there and not in user code. It's still more fun to use than the Windows' windowing API, which doesn't even support layout objects such as boxes and grids, now that's total pain! what about MS' WPF? It has all the bells and whistles of modern UI, doesn't it? Isn't that just a pretty layer on top of win32/com? I now only use native toolkits as backends for my gui abstraction layer, using this would only add a level of indirection and make no sense. No, IIRC, it doesn't rely on Win32 API at all: Wikipedia quote: Designed to remove dependencies on the aging GDI subsystem, WPF is built on DirectX, which provides hardware acceleration and enables modern UI features like transparency, gradients and transforms. Oh, I need to look into that!
Revamped concurrency API
Occasionally people here ask for ways in which they can help D. One thing that would be extremely helpful at this point would be to help defining and implementing D's new concurrency API. Unfortunately, Bartosz has declined to contribute. That leaves Walter, Sean, Don, and participants to this group to do it. I'm sure you know the three of us are overcommitted, and I'm also sure many of you are also in that situation. But if we could somehow focus all of the energy and good will in this group to one task of extraordinary urgency and importance, that would be awesome. If anyone has ideas, suggestions, and code to help defining a new concurrency API for D, please post. Andrei
Re: Use of first person in a book
Phil Deets wrote: On Fri, 09 Oct 2009 03:11:01 -0500, Andrei Alexandrescu wrote: Thanks to all who answered! I wish there was such consensus in other matters as well :o). Allow me to put forth an excerpt from TDPL without any particular reason: http://erdani.com/tdpl/excerpt.pdf Andrei Nice, but I noticed two mistakes on page 140. * "n divides p_k" => "p_k divides n" * In the paragraph starting with "Why does the iteration", the statement "If iter is greater than sqrt(n) then we can be sure iter can’t be a divisor of n" is wrong since iter could equal n (try 6 or 2 as input). The function still works since you return accum * n. Fixed. Thanks! Andrei
Re: Revamped concurrency API
Andrei Alexandrescu wrote: Occasionally people here ask for ways in which they can help D. One thing that would be extremely helpful at this point would be to help defining and implementing D's new concurrency API. Unfortunately, Bartosz has declined to contribute. That leaves Walter, Sean, Don, and participants to this group to do it. I'm sure you know the three of us are overcommitted, and I'm also sure many of you are also in that situation. But if we could somehow focus all of the energy and good will in this group to one task of extraordinary urgency and importance, that would be awesome. If anyone has ideas, suggestions, and code to help defining a new concurrency API for D, please post. Andrei Don't fix it to one model, leave room for multiple concurrency models to be used side by side! I would begin by making the 'shared' specs usable, since the rest will be within the runtime and everything will rely on shared. I already made a post on this some time ago: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=96161 Jeremie
Re: Array literals' default type
On Mon, Oct 12, 2009 at 9:42 AM, Phil Deets wrote: > On Mon, 12 Oct 2009 09:47:34 -0500, Don wrote: > >> (OTOH I wonder how much extant C++ code uses the comma operator. I bet >> there's not much of it. (But more than code than uses octal!)). There are quite a few uses out there if you count for-loop clauses and stuff hidden in macros. I think it probably isn't possible to have a, b = foo(); be valid D syntax with the "Don't re-interpret valid C" constraint. But perhaps a slight variation like this could work: (a, b) = foo(); --bb
Re: Revamped concurrency API
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > Occasionally people here ask for ways in which they can help D. One > thing that would be extremely helpful at this point would be to help > defining and implementing D's new concurrency API. Unfortunately, > Bartosz has declined to contribute. That leaves Walter, Sean, Don, and > participants to this group to do it. > I'm sure you know the three of us are overcommitted, and I'm also sure > many of you are also in that situation. But if we could somehow focus > all of the energy and good will in this group to one task of > extraordinary urgency and importance, that would be awesome. > If anyone has ideas, suggestions, and code to help defining a new > concurrency API for D, please post. For what it's worth, I've been experimenting with message-passing for one leg of the API. I decided to copy the Erlang API because it's very simple and easy to build fancier stuff on top of. What I have so far is: void sendmsg(T)( Pid pid, T val ); final void recvmsg(T...)( Pid pid, T ops ); Pid spawn(T)( T fun ); spawn() is pretty limited so far in that it only spawns threads--I'd expect that function to end up with multiple overloads at some point. Also 'ops' in recvmsg are delegates. Typical use would be: // Thread A sendmsg( pid, 5 ); sendmsg( pid, tuple(5) ); // Thread B recvmsg( pid, (int val) { writefln( "got int: %s", val ); } ); recvmsg( pid, (Tuple!(int) val) { writefln( "got tuple: %s", val ); } ); I thought about using predefined types for "receive any" and "abort after timeout" functions to pass to recvmsg. Pattern matching in D is largely limited to type matching at the moment, which is kind of a limitation, so I'd considered having the delegates return a bool indicating whether the value passed was a match or not. Anyway, thought I'd just add this to the thread in case it sparks discussion. I have a working implementation of this around somewhere if anyone is interested.
Re: Revamped concurrency API
Sean Kelly Wrote: > > void sendmsg(T)( Pid pid, T val ); > final void recvmsg(T...)( Pid pid, T ops ); Oops, I should mention that 'pid' shouldn't be in recvmsg. I just have it in there for now for testing purposes.
Re: CTFE vs. traditional metaprogramming
Hello Don, CTFE doesn't mean "string mixins using CTFE". It just means CTFE. (BTW you can do string mixins with templates only, no CTFE, if you are completely insane). I'm guilty of proving this by building a *parser* that runs at compile time without using CTFE.
Re: CTFE vs. traditional metaprogramming
Hello Michel, On 2009-10-09 15:49:42 -0400, Andrei Alexandrescu said: Thanks! I plan to add more text at the end of the chapter that discusses the opportunities of CTFE. Walter revealed to me that CTFE, particularly now after it's been improved by leaps and bounds by Don and by Walter himself, could obviate a lot of the traditional metaprogramming techniques developed for C++. One question that bugs me is, where do you draw the line? Say there's a metaprogramming problem at hand. How to decide on solving it with CTFE vs. solving it with templates? It would be great to have a simple guideline that puts in contrast the pluses and minuses of the two approaches. It is quite possible that templates get relegated to parameterized functions and types, whereas all heavy lifting in metaprogramming should be carried with CTFE. My idea on templates is that they're good when you have type parameters, or to create types based on constant parameters. - - - But an interesting thing I realized in the last few months is this: all you can do with a template you can also do at runtime provided sufficient runtime reflection capabilities. Even creating types! Details follow. I'd like to forward the thought that runtime reflection and type creation is NOT a replacement for the same at compile time just as the compile time version is not a replacement for the run time version. Just to pick two differences: errors are forced to runtime and runtime types can't be inlined.
Re: A safer switch?
On Mon, Oct 12, 2009 at 5:14 AM, Vladimir Panteleev wrote: > This was discussed before. IIRC, someone suggested to force using a > control-flow keyword (break/continue/goto) at the end of a case. Using > "continue" to fall through was rejected because it changes its meaning when > there's a switch in a loop. You'd use goto to jump to the particular > (next) switch case. "goto case;" already exists and jumps to the next case in the switch. So bam, you're already set ;)
Re: dmd support for IDEs
On 10/12/09 14:11, language_fan wrote: Mon, 12 Oct 2009 14:02:11 +0200, Jacob Carlborg thusly wrote: On 10/12/09 04:14, Chad J wrote: Too bad we can't just make programs switch between GUI backends at will ;) Why not have a GUI toolkit available on almost all platforms that uses native controls just like DWT? The list of native platforms SWT supports is this: Win32 WPF (under development) AIX, FreeBSD, Linux, HP-UX, Solaris: Motif GTK+ Mac OS X: Carbon Cocoa QNX Photon Pocket PC As a FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia user I fail to see how SWT is more native than the ones I develop for. All SWT applications look weird, unthemed, and have horrible usability issues in the file open/save dialogs. DWT brings another level of cruft above the "lightweight" SWT and performs badly. As a said previously SWT is more native because it uses the native GUI library available on the current platform, for windows (before vista) win32, osx cocoa and on linux gtk. It doesn't decide how a button should look, it doesn't try do draw a button that is similar to the natives, it just call the native library to draw the button. I don't know what you mean by "unthemed" but if you refer to that applications on windows don't get the winxp look you have the same problem if you create the application in c++ or c and uses win32. It's caused by an older dll is loaded as default and to get the winxp look you have to request it to load the newer dll with a manifest file. Welcome to dlls. If you have problems with the open/save dialogs in SWT either you will have the same problem in other native applications because it uses the native dialogs or there's a bug in SWT. DWT doesn't add any extra levels that SWT doesn't have. In fact it removes one, the jni wrappers. DWT is a complete port of SWT to D, with only native code.
Re: CTFE vs. traditional metaprogramming
Hello language_fan, Sat, 10 Oct 2009 10:26:11 +0200, Don thusly wrote: CTFE doesn't mean "string mixins using CTFE". It just means CTFE. (BTW you can do string mixins with templates only, no CTFE, if you are completely insane). CTFE without mixins is rather limited form of metaprogramming. You can basically only initialize some static non-code data, and not much more. String mixins with templates was the only way to go before CTFE became possible -- those were the times! What does yacc do? Build a switch statement via cut-n-paste, define a few constants, define a few types via cut-n-paste, and initialize some static data. Oh and there's no such thing as non-code data, if you are crazy enough: const byte[] it = buildPositionIndependentCodeAsString(Data); int i = (cast(int function(int))it.ptr)(42);
Re: dmd support for IDEs
On Mon, Oct 12, 2009 at 3:39 AM, Don wrote: > > Are you talking about FF 3.5? It's a really poor product. Crashes all the > time, has some terrible UI misfeatures. I'm really amazed they shipped it in > that condition. > I will gladly join in on the FF3.5 bashing. What a piece. EXTREMELY unresponsive, uses 3-4 times as much memory as FF3, flash videos don't play without hiccuping every five seconds, and it would just go into infinite loops or something and become completely unresponsive. I actually downgraded to 3.0 and it was like a new browser again! :P
Re: Array literals' default type
On Mon, Oct 12, 2009 at 10:47 AM, Don wrote: >> Wasn't the comma operator to be supposed to be important for automatic >> code generation? > > It's used frequently in in the compiler internals. EG, given > > int foo(X x = default_value) { return 0; } > then foo(); becomes: (X tmp = default_value, foo(tmp)); There doesn't need to be any *syntactic* reservation for something that's used internally by the compiler. I mean, we don't have to explicitly mark which brace blocks introduce scopes, but ScopeStatements are alive and well inside the compiler. CommaExp could just become "SequenceExp" or something and it would have the exact same effect. I really don't think there will be a lot of moaning if comma expressions disappeared. And yes, for loop increments can be special-cased, geez..
Re: Array literals' default type
Mon, 12 Oct 2009 13:04:03 -0400, Jarrett Billingsley thusly wrote: > On Mon, Oct 12, 2009 at 10:47 AM, Don wrote: > >>> Wasn't the comma operator to be supposed to be important for automatic >>> code generation? >> >> It's used frequently in in the compiler internals. EG, given >> >> int foo(X x = default_value) { return 0; } then foo(); becomes: (X >> tmp = default_value, foo(tmp)); > > There doesn't need to be any *syntactic* reservation for something > that's used internally by the compiler. I mean, we don't have to > explicitly mark which brace blocks introduce scopes, but ScopeStatements > are alive and well inside the compiler. CommaExp could just become > "SequenceExp" or something and it would have the exact same effect. I > really don't think there will be a lot of moaning if comma expressions > disappeared. And yes, for loop increments can be special-cased, geez.. But it breaks the holy C compatibility. When a C veteran with 40+ years of C development experience under their belt studies D by porting a 1 MLOC library to D 2.0, his code will fail as the precious old comma does not compute sequencing, but instead will produce a nasty compile error. Porting the code in a single go will not be possible anymore and reddit commentators will literally crush D.
Re: dmd support for IDEs
Mon, 12 Oct 2009 18:54:25 +0200, Jacob Carlborg thusly wrote: > On 10/12/09 14:11, language_fan wrote: >> Mon, 12 Oct 2009 14:02:11 +0200, Jacob Carlborg thusly wrote: >> >>> On 10/12/09 04:14, Chad J wrote: Too bad we can't just make programs switch between GUI backends at will ;) >>> >>> Why not have a GUI toolkit available on almost all platforms that uses >>> native controls just like DWT? >> >> The list of native platforms SWT supports is this: >> >> Win32 >>WPF (under development) >> AIX, FreeBSD, Linux, HP-UX, Solaris: >>Motif >>GTK+ >> Mac OS X: >>Carbon >>Cocoa >> QNX Photon >> Pocket PC >> >> As a FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia user I fail to >> see how SWT is more native than the ones I develop for. All SWT >> applications look weird, unthemed, and have horrible usability issues >> in the file open/save dialogs. DWT brings another level of cruft above >> the "lightweight" SWT and performs badly. > > As a said previously SWT is more native because it uses the native GUI > library available on the current platform, for windows (before vista) > win32, osx cocoa and on linux gtk. It doesn't decide how a button should > look, it doesn't try do draw a button that is similar to the natives, it > just call the native library to draw the button. The problem is, 99% of win32 users use the win32 gui toolkit on win32, 99% of osx users use cocoa, but on Linux/BSD maybe about 40% use gtk+. It is not The native toolkit to use. I do not even have it installed on my system. > I don't know what you mean by "unthemed" but if you refer to that > applications on windows don't get the winxp look you have the same > problem if you create the application in c++ or c and uses win32. It's > caused by an older dll is loaded as default and to get the winxp look > you have to request it to load the newer dll with a manifest file. > Welcome to dlls. I mostly work on *nixen. The unthemed means that I do not have *any* gtk+ libraries installed anywhere so it defaults to the ugly default theme. To me gtk+ does not have the native feel as I never see any application written in it. Like I said, I only use { FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia}. I am sorry if you have trouble reading that. Whenever an application comes with its own (statically linked) gtk+ libs, it will look bad. I do not have any "control panel" to change the look and feel of the gtk+ applications. > > If you have problems with the open/save dialogs in SWT either you will > have the same problem in other native applications because it uses the > native dialogs or there's a bug in SWT. Look, this is what I get on Win32: http://johnbokma.com/textpad/select-a-file-dialog.png on Linux: http://www.matusiak.eu/numerodix/blog/wp-content/uploads/20050710- kdefilechooser.png on Java: http://www.dil.univ-mrs.fr/~garreta/docJava/tutorial/figures/uiswing/ components/FileChooserOpenMetal.png You can probably see something that I have started to call 'consistency'. Almost the same buttons and layouts on every platform. I immediately know how it works. The same design has been there since Windows 95, if I recall correctly. This is what many people have learned to live with. Now every time I see a gtk+/swt/dwt application I wonder where the heck that unintuitive terrible piece of cr*p came: http://book.javanb.com/swt-the-standard-widget-toolkit/images/0321256638/ graphics/14fig03.gif Native? It might very well use native binaries on my platform, but the native feel ends there.
Re: dmd support for IDEs
On 12/10/2009 15:49, Ary Borenszweig wrote: Michal Minich wrote somewhere else: --- You can try to download just bare Eclipse platform (which is just text editor) and install descent into it using Eclipse software updates. It starts up faster than C or Java version Eclipse and there is only D related stuff in the UI. http://download.eclipse.org/eclipse/downloads/drops/R-3.5.1-200909170800/index.php Under "Platform runtime binary" --- I tried it and it's true, it feels much lighter this way and you don't a lot of bloat in menus and other things. I tried it too. works fine, feels good.
Re: dmd support for IDEs
language_fan wrote: Mon, 12 Oct 2009 18:54:25 +0200, Jacob Carlborg thusly wrote: On 10/12/09 14:11, language_fan wrote: Mon, 12 Oct 2009 14:02:11 +0200, Jacob Carlborg thusly wrote: On 10/12/09 04:14, Chad J wrote: Too bad we can't just make programs switch between GUI backends at will ;) Why not have a GUI toolkit available on almost all platforms that uses native controls just like DWT? The list of native platforms SWT supports is this: Win32 WPF (under development) AIX, FreeBSD, Linux, HP-UX, Solaris: Motif GTK+ Mac OS X: Carbon Cocoa QNX Photon Pocket PC As a FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia user I fail to see how SWT is more native than the ones I develop for. All SWT applications look weird, unthemed, and have horrible usability issues in the file open/save dialogs. DWT brings another level of cruft above the "lightweight" SWT and performs badly. As a said previously SWT is more native because it uses the native GUI library available on the current platform, for windows (before vista) win32, osx cocoa and on linux gtk. It doesn't decide how a button should look, it doesn't try do draw a button that is similar to the natives, it just call the native library to draw the button. The problem is, 99% of win32 users use the win32 gui toolkit on win32, 99% of osx users use cocoa, but on Linux/BSD maybe about 40% use gtk+. It is not The native toolkit to use. I do not even have it installed on my system. I don't know what you mean by "unthemed" but if you refer to that applications on windows don't get the winxp look you have the same problem if you create the application in c++ or c and uses win32. It's caused by an older dll is loaded as default and to get the winxp look you have to request it to load the newer dll with a manifest file. Welcome to dlls. I mostly work on *nixen. The unthemed means that I do not have *any* gtk+ libraries installed anywhere so it defaults to the ugly default theme. To me gtk+ does not have the native feel as I never see any application written in it. Like I said, I only use { FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia}. I am sorry if you have trouble reading that. Whenever an application comes with its own (statically linked) gtk+ libs, it will look bad. I do not have any "control panel" to change the look and feel of the gtk+ applications. If you have problems with the open/save dialogs in SWT either you will have the same problem in other native applications because it uses the native dialogs or there's a bug in SWT. Look, this is what I get on Win32: http://johnbokma.com/textpad/select-a-file-dialog.png on Linux: http://www.matusiak.eu/numerodix/blog/wp-content/uploads/20050710- kdefilechooser.png on Java: http://www.dil.univ-mrs.fr/~garreta/docJava/tutorial/figures/uiswing/ components/FileChooserOpenMetal.png You can probably see something that I have started to call 'consistency'. Almost the same buttons and layouts on every platform. I immediately know how it works. The same design has been there since Windows 95, if I recall correctly. This is what many people have learned to live with. Now every time I see a gtk+/swt/dwt application I wonder where the heck that unintuitive terrible piece of cr*p came: http://book.javanb.com/swt-the-standard-widget-toolkit/images/0321256638/ graphics/14fig03.gif Native? It might very well use native binaries on my platform, but the native feel ends there. I get an entirely different file dialog on win7, and my gnome dialog on ubuntu looks nothing like the screenshot you linked. This is the win7 dialog: http://i.msdn.microsoft.com/Dd758094.Libraries_CommonFileDialog%28en-us,VS.85%29.png This is close to what I have on ubuntu: http://blogs.gnome.org/mortenw/wp-content/blogs.dir/26/files/2009/02/file-dialog2.png I have no Qt or KDE on both my linux installs (ubuntu 9 and a cross linux from scratch), the GUI looks smooth and works great, using the latest gnome 2.6 libraries. Why don't you install GTK+? You can't whine about applications built for gnome looking ugly if you don't have gtk installed, it can live pretty well alongside Qt, I used to do that until i switched to gnome after 2.6 was released.
Re: dmd support for IDEs
Mon, 12 Oct 2009 13:54:53 -0400, Jeremie Pelletier thusly wrote: > language_fan wrote: > I get an entirely different file dialog on win7, and my gnome dialog on > ubuntu looks nothing like the screenshot you linked. > > This is the win7 dialog: > http://i.msdn.microsoft.com/Dd758094.Libraries_CommonFileDialog%28en- us,VS.85%29.png This is pretty good in my book. > This is close to what I have on ubuntu: > http://blogs.gnome.org/mortenw/wp-content/blogs.dir/26/files/2009/02/ file-dialog2.png Yuck. > > I have no Qt or KDE on both my linux installs (ubuntu 9 and a cross > linux from scratch), the GUI looks smooth and works great, using the > latest gnome 2.6 libraries. > > Why don't you install GTK+? You can't whine about applications built for > gnome looking ugly if you don't have gtk installed, it can live pretty > well alongside Qt, I used to do that until i switched to gnome after 2.6 > was released. I have little desire to embrace inferior technologies. Attempting OOP on C is ridiculous, it should be called POOP. It is a personal choice. Besides FLTK2/Qt work pays well enough. I also have no time for desktop environment wars, tyvm. GTK+ != Gnome, as you well might know. I simply have no reason to install libgtk* since no package depends on them.
Re: dmd support for IDEs
Ary Borenszweig : > > --- > You can try to download just bare Eclipse platform (which is just text > editor) and install descent into it using Eclipse software updates. It > starts up faster than C or Java version Eclipse and there is only D > related stuff in the UI. > > http://download.eclipse.org/eclipse/downloads/drops/R-3.5.1-200909170800/index.php > Under "Platform runtime binary" > --- > > I tried it and it's true, it feels much lighter this way and you don't a > lot of bloat in menus and other things. if Descent is written in d so is very good !
Re: dmd support for IDEs
Ary Borenszweig : > > --- > You can try to download just bare Eclipse platform (which is just text > editor) and install descent into it using Eclipse software updates. It > starts up faster than C or Java version Eclipse and there is only D > related stuff in the UI. > > http://download.eclipse.org/eclipse/downloads/drops/R-3.5.1-200909170800/index.php > Under "Platform runtime binary" > --- > > I tried it and it's true, it feels much lighter this way and you don't a > lot of bloat in menus and other things. if Descent is written in d so is very good !
Re: dmd support for IDEs
On 10/12/09 19:41, language_fan wrote: Mon, 12 Oct 2009 18:54:25 +0200, Jacob Carlborg thusly wrote: On 10/12/09 14:11, language_fan wrote: Mon, 12 Oct 2009 14:02:11 +0200, Jacob Carlborg thusly wrote: On 10/12/09 04:14, Chad J wrote: Too bad we can't just make programs switch between GUI backends at will ;) Why not have a GUI toolkit available on almost all platforms that uses native controls just like DWT? The list of native platforms SWT supports is this: Win32 WPF (under development) AIX, FreeBSD, Linux, HP-UX, Solaris: Motif GTK+ Mac OS X: Carbon Cocoa QNX Photon Pocket PC As a FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia user I fail to see how SWT is more native than the ones I develop for. All SWT applications look weird, unthemed, and have horrible usability issues in the file open/save dialogs. DWT brings another level of cruft above the "lightweight" SWT and performs badly. As a said previously SWT is more native because it uses the native GUI library available on the current platform, for windows (before vista) win32, osx cocoa and on linux gtk. It doesn't decide how a button should look, it doesn't try do draw a button that is similar to the natives, it just call the native library to draw the button. The problem is, 99% of win32 users use the win32 gui toolkit on win32, 99% of osx users use cocoa, but on Linux/BSD maybe about 40% use gtk+. It is not The native toolkit to use. I do not even have it installed on my system. I don't know what you mean by "unthemed" but if you refer to that applications on windows don't get the winxp look you have the same problem if you create the application in c++ or c and uses win32. It's caused by an older dll is loaded as default and to get the winxp look you have to request it to load the newer dll with a manifest file. Welcome to dlls. I mostly work on *nixen. The unthemed means that I do not have *any* gtk+ libraries installed anywhere so it defaults to the ugly default theme. To me gtk+ does not have the native feel as I never see any application written in it. Like I said, I only use { FLTK2, Qt 3.x, Qt 4.x, Swing, and (forked) Harmonia}. I am sorry if you have trouble reading that. Whenever an application comes with its own (statically linked) gtk+ libs, it will look bad. I do not have any "control panel" to change the look and feel of the gtk+ applications. If you have problems with the open/save dialogs in SWT either you will have the same problem in other native applications because it uses the native dialogs or there's a bug in SWT. Look, this is what I get on Win32: http://johnbokma.com/textpad/select-a-file-dialog.png on Linux: http://www.matusiak.eu/numerodix/blog/wp-content/uploads/20050710- kdefilechooser.png on Java: http://www.dil.univ-mrs.fr/~garreta/docJava/tutorial/figures/uiswing/ components/FileChooserOpenMetal.png You can probably see something that I have started to call 'consistency'. Almost the same buttons and layouts on every platform. I immediately know how it works. The same design has been there since Windows 95, if I recall correctly. This is what many people have learned to live with. Now every time I see a gtk+/swt/dwt application I wonder where the heck that unintuitive terrible piece of cr*p came: http://book.javanb.com/swt-the-standard-widget-toolkit/images/0321256638/ graphics/14fig03.gif Native? It might very well use native binaries on my platform, but the native feel ends there. Of course it will look strange when you use an application built on a toolkit it isn't built for. Will have to wait for a Qt version.
Re: Array literals' default type
On Mon, Oct 12, 2009 at 1:21 PM, language_fan wrote: > Mon, 12 Oct 2009 13:04:03 -0400, Jarrett Billingsley thusly wrote: > >> On Mon, Oct 12, 2009 at 10:47 AM, Don wrote: >> Wasn't the comma operator to be supposed to be important for automatic code generation? >>> >>> It's used frequently in in the compiler internals. EG, given >>> >>> int foo(X x = default_value) { return 0; } then foo(); becomes: (X >>> tmp = default_value, foo(tmp)); >> >> There doesn't need to be any *syntactic* reservation for something >> that's used internally by the compiler. I mean, we don't have to >> explicitly mark which brace blocks introduce scopes, but ScopeStatements >> are alive and well inside the compiler. CommaExp could just become >> "SequenceExp" or something and it would have the exact same effect. I >> really don't think there will be a lot of moaning if comma expressions >> disappeared. And yes, for loop increments can be special-cased, geez.. > > But it breaks the holy C compatibility. When a C veteran with 40+ years > of C development experience under their belt studies D by porting a 1 > MLOC library to D 2.0, his code will fail as the precious old comma does > not compute sequencing, but instead will produce a nasty compile error. > Porting the code in a single go will not be possible anymore and reddit > commentators will literally crush D. > Fuck C.
Re: dmd support for IDEs
language_fan wrote: Another point not mentioned here is that modern IDEs use incremental and interactive compilation model. The compiler should be run as a persistent background process and parsing should happen perhaps on the level of the current scope. Re-compiling a million line project after each key stroke simply makes no sense. This would not require recompiling a million lines with every key stroke, unless you are editing a million line module. Even compiling the current module once per key stroke is too slow. As you say, it should be done as a background process. Specifying an intermediate json/xml file format is a huge task considering the amount of language constructs, types etc. available in D. It isn't. It's far less work than ddoc is, for example. I'm all for good tool support but as many have already mentioned, the support would only bring marginal improvements to small scale tools like vim and emacs. Usually small scale D projects (< 1 lines of code) are written with those tools (feel free to prove me wrong). These are not the kinds of projects large enterprises would use D for, they use scripting languages for smaller tasks. Thus the overall improvement is minimal. I think the bang for the buck on this is large. Spending the time on critical compiler bugs on the other hand would help everyone in the community. That hasn't been shorted, look at the changelog!
Re: dmd support for IDEs
Denis Koroskin wrote: I just believe rewriting it from scratch will be plain faster. I can also test the code much easier - if it produces exact same binary then it works correct. The dmd front end is also written in a "D-ish" style which should make translation to D easier.
Re: dmd support for IDEs
language_fan wrote: Mon, 12 Oct 2009 13:54:53 -0400, Jeremie Pelletier thusly wrote: language_fan wrote: I get an entirely different file dialog on win7, and my gnome dialog on ubuntu looks nothing like the screenshot you linked. This is the win7 dialog: http://i.msdn.microsoft.com/Dd758094.Libraries_CommonFileDialog%28en- us,VS.85%29.png This is pretty good in my book. This is close to what I have on ubuntu: http://blogs.gnome.org/mortenw/wp-content/blogs.dir/26/files/2009/02/ file-dialog2.png Yuck. I have no Qt or KDE on both my linux installs (ubuntu 9 and a cross linux from scratch), the GUI looks smooth and works great, using the latest gnome 2.6 libraries. Why don't you install GTK+? You can't whine about applications built for gnome looking ugly if you don't have gtk installed, it can live pretty well alongside Qt, I used to do that until i switched to gnome after 2.6 was released. I have little desire to embrace inferior technologies. Attempting OOP on C is ridiculous, it should be called POOP. It is a personal choice. Besides FLTK2/Qt work pays well enough. I also have no time for desktop environment wars, tyvm. GTK+ != Gnome, as you well might know. I simply have no reason to install libgtk* since no package depends on them. I don't know if you're talking about gtk 1 or 2, I don't have gtk1 installed but gtk2 is always one of the first package i build when I create a linux from scratch, so many things depend on it. I never had any issues using gnome without qt, yet I had plenty using KDE without gtk. Its just a matter of what software you build, I usually don't like the feel of KDE applications, its a matter of preferences there. I agree that gnome being coded in C is plain ugly in the code, but the results are still very convenient to use. Oh and I know gtk != gnome, but its been a while since it left gimp to become part of the gnome set of libraries.
dmd development model.
This has been raised numerous times by many people before, but still I'm going to write it. The last three releases are broken for both QtD and tango. Why is it happening? I see the reason in the dmd development model. Say dmd 2.031 works for a project (which can be a large one). The consequent release 2.032 does not. If you make a diff between the two versions it's considerably large. How are we supposed to locate the regression? If dmd delepers contributed every change to the VCS separately, it would be much easier to track down the change that caused the issue. From my side I could test the version of dmd from trunk every 2 days and file bugs as they appear. That's how most of the open source projects work, and this model works fine. Few days before the release there can be an appropriate notice, so that people could test their code. That would make dmd releases less buggy. I know that Walter sends the compiler to tango devs prior to release, but that's not a robust solution to the problem, developers may not have time at the moment for example. However with the truly open model not only core developers of projects, but anyone can test the compiler. What we have now is annoying. We have a series of non-working releases. LDC for example still hasn't updated it's front-end since dmd 1.045. Putting dmd to svn was a great move, but without adopting the advantages of VCS it's rather useless. Thank you, Eldar.
Re: dmd support for IDEs
Hello Walter, Ellery Newcomer wrote: In the xml, will we see ct stuff and other transformations that DMD performs on the source expanded? ct stuff? What is that? Won't see dmd operations on the source expanded. What you'll see is basically what ddoc generates, but in a machine readable format. I.e. you'll see function names, with their types, line number, comment, etc. Essentially what intellisense would pop up. template Foo (T) { T map(T[]) { ... } } class Bar { mixin Foo!(int); } void main() { Bar bar; bar. /// will the IDE have to do anything special to see 'map' or will it just be listed as another function? } If your ide can't see or doesn't have compiler, it won't be able to do much (erm duh) Yeah, but without a compiler why edit D source? My normal setup is running eclipse on a windows box to edit files on a linux box (via file share) where I compile things (I need some other stuff from linux). For this, I have no need for a compiler on the box with the IDE unless the IDE needs it solely for the auto-complete.
Re: dmd support for IDEs
Walter Bright wrote: Denis Koroskin wrote: I just believe rewriting it from scratch will be plain faster. I can also test the code much easier - if it produces exact same binary then it works correct. The dmd front end is also written in a "D-ish" style which should make translation to D easier. But some stuff doesn't quite match: for example, Expression is declared in expression.h. But not all methods are implemented in expression.c. There's at least the interpret() method, which is in interpret.c. How would you translate this into D? Just mash everything into a single .d source file?
Re: dmd support for IDEs
language_fan wrote: I have little desire to embrace inferior technologies. Attempting OOP on C is ridiculous, it should be called POOP. It is a personal choice. They're also developing a C# like language, that uses the GTK object model as base: http://live.gnome.org/Vala
Re: dmd support for IDEs
Hello Walter, Jérôme M. Berger wrote: . all the symbols in that module, and the members of those symbols (recursively) Including local variables for functions? That seems pointless, as they'll be inaccessible outside of the scope of the function. Good auto compleat needs a list of *Every* allowed identifier at any point in the code. Basicly the full symbol table.
Re: dmd support for IDEs
Hello Walter, Think of what it provides as very similar to what ddoc does, except that instead of being in a human-readable format it would be a machine-readable one. If that's what you are planning, I can tell you right now it's not enough. Much of the things IDEs need is not present in ddoc. Just off hand, I'd say more than 50% of the IDE features I use from C#/VS would need (much) more than ddoc has. What would be better is a dump of a fully annotated AST from just before it's passed off for optimization and code gen.
Re: dmd support for IDEs
On Mon, Oct 12, 2009 at 11:32 AM, Walter Bright wrote: >> Specifying an intermediate json/xml file format is a huge task considering >> the amount of language constructs, types etc. available in D. > > It isn't. It's far less work than ddoc is, for example. > >> I'm all for good tool support but as many have already mentioned, the >> support would only bring marginal improvements to small scale tools like vim >> and emacs. Usually small scale D projects (< 1 lines of code) are >> written with those tools (feel free to prove me wrong). These are not the >> kinds of projects large enterprises would use D for, they use scripting >> languages for smaller tasks. Thus the overall improvement is minimal. > > I think the bang for the buck on this is large. Even if this turns out to be useless for IDEs, it'll still be good for creating external documentation generators that go beyond what DDoc is capable of providing. I think the subject of DDoc's limitations has come up more than once here. Put in another light, it sounds like this would basically be the D equivalent of GCC-XML. Which I think has been found to have many interesting uses. For instance Gregor used GCC-XML to put together a D bindings generator for C code. With this XML/JSON output, someone could do similar and write a bindings generator for D code. That could be handy if you want to call your D code from C or C# or whatever. But it doesn't sound to me like it will be that much use to serious IDEs. --bb
Re: dmd support for IDEs
Hello Walter, Robert Clipsham wrote: How well will this work with partially parsable files? Probably not very well. This would work best with getting information from modules other than the one being edited. Ouch. There goes about half of what people will want.
Re: dmd development model.
On Mon, 12 Oct 2009 14:48:17 -0400, Eldar Insafutdinov wrote: > This has been raised numerous times by many people before, but still I'm > going to write it. The last three releases are broken for both QtD and > tango. Why is it happening? I see the reason in the dmd development > model. Say dmd 2.031 works for a project (which can be a large one). The > consequent release 2.032 does not. If you make a diff between the two > versions it's considerably large. How are we supposed to locate the > regression? > > If dmd delepers contributed every change to the VCS separately, it would > be much easier to track down the change that caused the issue. From my > side I could test the version of dmd from trunk every 2 days and file > bugs as they appear. That's how most of the open source projects work, > and this model works fine. Few days before the release there can be an > appropriate notice, so that people could test their code. That would > make dmd releases less buggy. I know that Walter sends the compiler to > tango devs prior to release, but that's not a robust solution to the > problem, developers may not have time at the moment for example. However > with the truly open model not only core developers of projects, but > anyone can test the compiler. > > What we have now is annoying. We have a series of non-working releases. > LDC for example still hasn't updated it's front-end since dmd 1.045. > Putting dmd to svn was a great move, but without adopting the advantages > of VCS it's rather useless. > > Thank you, > Eldar. Same opinion here. There are quite some nice fixes in the last releases, but it's useless if other regressions make it unusable. I (sort of) understand why Walter can't look at other projects code and can't even test it for legal reasons. This problem would be solved by multiple commits over time (between releases). Users can test their projects against dmd trunk (Tango, QTD to name only a few). It would be easier to locate and fix problems _before_ releases. No beta/Pre- releases are needed. A VCS is not for final code, it's for dirty work. trunk don't have to contain shiny code with a history of complete commits. It's allowed to be messy.
Re: dmd support for IDEs
Jeremie Pelletier wrote: Denis Koroskin wrote: On Mon, 12 Oct 2009 19:18:41 +0400, Jeremie Pelletier wrote: Yigal Chripun wrote: On 12/10/2009 07:33, Jeremie Pelletier wrote: Jérôme M. Berger wrote: Jeremie Pelletier wrote: I agree however that GTK being in C is rather annoying, C is a great language but GUIs is one area where OOP really shines. Note that Gtk *is* object oriented despite being in C... Jerome It's a sorry hack, you have to use casts everywhere you'd rely on polymorphism in D or C+ and its harder to remember, read, code, maintain, and doesn't have any performance gains over C++, the explicit struct pointer in C is the implicit 'this' in C++ and non-virtual methods can be optimized as direct calls with no vtbl indirections. I tried gtkD and I don't like using an OOP layer on top of a C interface because that adds overhead for the exact same features, most good GUI libraries should abstract the platform anyways so GTK is usually only seen there and not in user code. It's still more fun to use than the Windows' windowing API, which doesn't even support layout objects such as boxes and grids, now that's total pain! what about MS' WPF? It has all the bells and whistles of modern UI, doesn't it? Isn't that just a pretty layer on top of win32/com? I now only use native toolkits as backends for my gui abstraction layer, using this would only add a level of indirection and make no sense. No, IIRC, it doesn't rely on Win32 API at all: Wikipedia quote: Designed to remove dependencies on the aging GDI subsystem, WPF is built on DirectX, which provides hardware acceleration and enables modern UI features like transparency, gradients and transforms. Oh, I need to look into that! Yeah, we made a game in WPF in the company I work for, using bindings (*the* feature of WPF): it was sluggish. From the start I recommended doing it in a lower-level language (I recommended D!) but no one listened to me. It runs pretty slow with an amazing computer. I don't like WPF (nor Siliveright). :-P
Re: dmd support for IDEs
Jarrett Billingsley wrote: On Mon, Oct 12, 2009 at 3:39 AM, Don wrote: Are you talking about FF 3.5? It's a really poor product. Crashes all the time, has some terrible UI misfeatures. I'm really amazed they shipped it in that condition. I will gladly join in on the FF3.5 bashing. What a piece. EXTREMELY unresponsive, uses 3-4 times as much memory as FF3, flash videos don't play without hiccuping every five seconds, and it would just go into infinite loops or something and become completely unresponsive. I actually downgraded to 3.0 and it was like a new browser again! :P Me too. And when clicking a tab sometimes it will make a whole new window out of it. There's even an extension to fix that! :-P
Re: dmd development model.
Eldar Insafutdinov wrote: This has been raised numerous times by many people before, but still I'm going to write it. The last three releases are broken for both QtD and tango. Why is it happening? I see the reason in the dmd development model. Say dmd 2.031 works for a project (which can be a large one). The consequent release 2.032 does not. If you make a diff between the two versions it's considerably large. How are we supposed to locate the regression? If dmd delepers contributed every change to the VCS separately, it would be much easier to track down the change that caused the issue. From my side I could test the version of dmd from trunk every 2 days and file bugs as they appear. That's how most of the open source projects work, and this model works fine. Few days before the release there can be an appropriate notice, so that people could test their code. That would make dmd releases less buggy. I know that Walter sends the compiler to tango devs prior to release, but that's not a robust solution to the problem, developers may not have time at the moment for example. However with the truly open model not only core developers of projects, but anyone can test the compiler. What we have now is annoying. We have a series of non-working releases. LDC for example still hasn't updated it's front-end since dmd 1.045. Putting dmd to svn was a great move, but without adopting the advantages of VCS it's rather useless. Thank you, Eldar. FWIW I do as you say with Phobos. Andrei
Re: dmd support for IDEs
Don wrote: Ary Borenszweig wrote: Michal Minich wrote somewhere else: --- You can try to download just bare Eclipse platform (which is just text editor) and install descent into it using Eclipse software updates. It starts up faster than C or Java version Eclipse and there is only D related stuff in the UI. http://download.eclipse.org/eclipse/downloads/drops/R-3.5.1-200909170800/index.php Under "Platform runtime binary" --- I tried it and it's true, it feels much lighter this way and you don't a lot of bloat in menus and other things. It would be great to put this on the Descent front page. I put it on the "Installing the plugin" page as soon as I saw it here. Thanks Michal Minich!
Re: dmd support for IDEs
On Mon, Oct 12, 2009 at 3:23 PM, Ary Borenszweig wrote: > Jarrett Billingsley wrote: >> >> On Mon, Oct 12, 2009 at 3:39 AM, Don wrote: >>> >>> Are you talking about FF 3.5? It's a really poor product. Crashes all the >>> time, has some terrible UI misfeatures. I'm really amazed they shipped it >>> in >>> that condition. >>> >> >> I will gladly join in on the FF3.5 bashing. What a piece. EXTREMELY >> unresponsive, uses 3-4 times as much memory as FF3, flash videos don't >> play without hiccuping every five seconds, and it would just go into >> infinite loops or something and become completely unresponsive. I >> actually downgraded to 3.0 and it was like a new browser again! :P > > Me too. And when clicking a tab sometimes it will make a whole new window > out of it. There's even an extension to fix that! :-P > Yes OMG I hate that. Sometimes I don't even have to click the tab, just middle-click-scrolling will do that. I wasn't aware there was even an extension :P
Re: dmd support for IDEs
Walter Bright wrote: language_fan wrote: Another point not mentioned here is that modern IDEs use incremental and interactive compilation model. The compiler should be run as a persistent background process and parsing should happen perhaps on the level of the current scope. Re-compiling a million line project after each key stroke simply makes no sense. This would not require recompiling a million lines with every key stroke, unless you are editing a million line module. Even compiling the current module once per key stroke is too slow. As you say, it should be done as a background process. Specifying an intermediate json/xml file format is a huge task considering the amount of language constructs, types etc. available in D. It isn't. It's far less work than ddoc is, for example. I'm all for good tool support but as many have already mentioned, the support would only bring marginal improvements to small scale tools like vim and emacs. Usually small scale D projects (< 1 lines of code) are written with those tools (feel free to prove me wrong). These are not the kinds of projects large enterprises would use D for, they use scripting languages for smaller tasks. Thus the overall improvement is minimal. I think the bang for the buck on this is large. For each snippet of code that doesn't currently compile, I generate a red warning in the TDPL draft. Currently there are 28 such red warnings, and each may be arbitrarily difficult to fix. There are other issues that we know need to be done as soon as yesterday. IMHO it would be frivolous to spend time on anything else but the 28 bugs. This XML/JSON generation is like combing one's hair before leaving the burning house. Just run! (I'm not saying I don't like combed hair or XML/JSON parsing, but the latter is absolutely nothing you need to work on now.) Please understand that TDPL is on a crash course and we can't have a book without a language (I'm also assuming we can't have a language without a book). Walter, please avoid all distractions and make bringing D in sync with the book your sole preoccupation. I am working *extremely* hard on the book, and I wish I were seeing the same level of commitment in you. Andrei
Re: Revamped concurrency API
Andrei Alexandrescu: >Unfortunately, Bartosz has declined to contribute.< I have read a good amount of his interesting blog posts, he has shown me many things I didn't know about. And he was very happy about the idea of helping D concurrency. Do you know why he has changed his mind regarding this? Maybe because Walter has refused the uniqueness/lend ideas? Bear hugs, bearophile
Re: Array literals' default type
language_fan wrote: Mon, 12 Oct 2009 13:04:03 -0400, Jarrett Billingsley thusly wrote: On Mon, Oct 12, 2009 at 10:47 AM, Don wrote: Wasn't the comma operator to be supposed to be important for automatic code generation? It's used frequently in in the compiler internals. EG, given int foo(X x = default_value) { return 0; } then foo(); becomes: (X tmp = default_value, foo(tmp)); There doesn't need to be any *syntactic* reservation for something that's used internally by the compiler. I mean, we don't have to explicitly mark which brace blocks introduce scopes, but ScopeStatements are alive and well inside the compiler. CommaExp could just become "SequenceExp" or something and it would have the exact same effect. I really don't think there will be a lot of moaning if comma expressions disappeared. And yes, for loop increments can be special-cased, geez.. But it breaks the holy C compatibility. When a C veteran with 40+ years of C development experience under their belt studies D by porting a 1 MLOC library to D 2.0, his code will fail as the precious old comma does not compute sequencing, but instead will produce a nasty compile error. Porting the code in a single go will not be possible anymore and reddit commentators will literally crush D. What is it with C compatibility? Can't you link C functions and you are done? What's the compulsive need to port everything written in C or C++ to D?
Re: Revamped concurrency API
bearophile wrote: Andrei Alexandrescu: Unfortunately, Bartosz has declined to contribute.< I have read a good amount of his interesting blog posts, he has shown me many things I didn't know about. And he was very happy about the idea of helping D concurrency. Do you know why he has changed his mind regarding this? Maybe because Walter has refused the uniqueness/lend ideas? You may want to email Bartosz and ask him. Andrei
Re: dmd support for IDEs
Andrei Alexandrescu wrote: Walter Bright wrote: language_fan wrote: Another point not mentioned here is that modern IDEs use incremental and interactive compilation model. The compiler should be run as a persistent background process and parsing should happen perhaps on the level of the current scope. Re-compiling a million line project after each key stroke simply makes no sense. This would not require recompiling a million lines with every key stroke, unless you are editing a million line module. Even compiling the current module once per key stroke is too slow. As you say, it should be done as a background process. Specifying an intermediate json/xml file format is a huge task considering the amount of language constructs, types etc. available in D. It isn't. It's far less work than ddoc is, for example. I'm all for good tool support but as many have already mentioned, the support would only bring marginal improvements to small scale tools like vim and emacs. Usually small scale D projects (< 1 lines of code) are written with those tools (feel free to prove me wrong). These are not the kinds of projects large enterprises would use D for, they use scripting languages for smaller tasks. Thus the overall improvement is minimal. I think the bang for the buck on this is large. For each snippet of code that doesn't currently compile, I generate a red warning in the TDPL draft. Currently there are 28 such red warnings, and each may be arbitrarily difficult to fix. There are other issues that we know need to be done as soon as yesterday. IMHO it would be frivolous to spend time on anything else but the 28 bugs. This XML/JSON generation is like combing one's hair before leaving the burning house. Just run! (I'm not saying I don't like combed hair or XML/JSON parsing, but the latter is absolutely nothing you need to work on now.) Please understand that TDPL is on a crash course and we can't have a book without a language (I'm also assuming we can't have a language without a book). Walter, please avoid all distractions and make bringing D in sync with the book your sole preoccupation. I am working *extremely* hard on the book, and I wish I were seeing the same level of commitment in you. Andrei I ammend the above: s/commitment/focus/. Of course Walter is motivate and committed more than anyone else to make D successful, but it's time to force ourselves to absolutely focus on the important _and_ urgent matters. Andrei
Re: dmd support for IDEs
BCS wrote: > Hello Walter, > > What would be better is a dump of a > fully annotated AST from just before it's passed off for optimization > and code gen. > > To reiterate my offer, I would be willing to implement this in DMD provided I can then assume that any modern D compiler will have it.
Re: dmd support for IDEs
Jarrett Billingsley wrote: On Mon, Oct 12, 2009 at 3:23 PM, Ary Borenszweig wrote: Jarrett Billingsley wrote: On Mon, Oct 12, 2009 at 3:39 AM, Don wrote: Are you talking about FF 3.5? It's a really poor product. Crashes all the time, has some terrible UI misfeatures. I'm really amazed they shipped it in that condition. I will gladly join in on the FF3.5 bashing. What a piece. EXTREMELY unresponsive, uses 3-4 times as much memory as FF3, flash videos don't play without hiccuping every five seconds, and it would just go into infinite loops or something and become completely unresponsive. I actually downgraded to 3.0 and it was like a new browser again! :P Me too. And when clicking a tab sometimes it will make a whole new window out of it. There's even an extension to fix that! :-P Yes OMG I hate that. Sometimes I don't even have to click the tab, just middle-click-scrolling will do that. I wasn't aware there was even an extension :P Here it is: https://addons.mozilla.org/en-US/firefox/addon/12276 But I eventually uninstalled it because Firefox started working very weired. But maybe that's just FF and not the extension. I think they are trying to copy Chrome's features, I don't know why... I always want to have my tabs in a single window, why would I want to go back to IE6?
Re: dmd support for IDEs
On Mon, Oct 12, 2009 at 3:31 PM, Andrei Alexandrescu wrote: > Walter, please avoid all distractions and make bringing D in sync with the > book your sole preoccupation. I am working *extremely* hard on the book, and > I wish I were seeing the same level of commitment in you. You're writing a book about a language that doesn't exist and then complaining that Walter isn't writing it for you? Wow. Just wow. I'm out of here.
Re: Revamped concurrency API
bearophile wrote: Andrei Alexandrescu: Unfortunately, Bartosz has declined to contribute.< I have read a good amount of his interesting blog posts, he has shown me many things I didn't know about. And he was very happy about the idea of helping D concurrency. Do you know why he has changed his mind regarding this? Maybe because Walter has refused the uniqueness/lend ideas? I believe that Bearophile is likely to be on target here. Bartosz has spent a lot of time and effort educating the D community on the subject of data races etc, and many thanks for him for doing this. And now he 'declined to contribute' ? Too busy at work, perhaps ? More likely, a difference in opinion, as to the direction this should proceed, without any discussion on various/conflicting proposals with the community. Is this the way serious architecture decisions should be made ? Would Walter/Bartosz/Andrei like to comment further Nick B