Re: More radical ideas about gc and reference counting
On 2014-05-12 19:14, Dicebot wrote: It lacks any good static reflection though. And this stuff is damn addictive when you try it of D caliber. It has macros, that basically requires great support for static reflection to be usable. -- /Jacob Carlborg
Re: Next step on reference counting topics
On 12/05/14 21:00, Andrei Alexandrescu wrote: There's been a lot of talk lately regarding improving resource management for D, and I'd like to figure the next logical step to take. It seems clear that we have reached a collective impasse on a few fundamentals, and that more just talk about it all is at the point of diminishing returns. One action item that is hopefully useful to people of all viewpoints is to double down on library support, and see how far we can get and what insights we collect from the experience. For that I'm proposing we start real work toward a state-of-the-art std.refcounted module. It would include adapters for class, array, and pointer types, and should inform language improvements for qualifiers (i.e. the tail-const problem), copy elision, literals, operators, and such. Perhaps, as has been already stared, sprinkle Phobos with output ranges and/or allocators. -- /Jacob Carlborg
Re: radical ideas about GC and ARC : need to be time driven?
On 13/05/14 13:46, Kagamin wrote: BTW, I don't see how ARC would be more able to call destructors, than GC. If ARC can call destructor, so can GC. Where's the difference? The GC will only call destructors when it deletes an object, i.e. when it runs a collection. There's no guarantee that a collection will happen. With ARC, as soon as a reference goes out of scope it's decremented. If the reference count then goes to zero it will call the destructor and delete the object. -- /Jacob Carlborg
Re: borrowed pointers vs ref
On 13/05/14 15:36, Dicebot wrote: There are 2 `scope` uses to think about. One is storage class and in that context `scope` is more of owned / unique pointer. Other is parameter qualifier and that one is closer to ref / borrowed pointer. Main problem about making `ref` borrowed pointer is that you will need to prohibit storing it in function transitively. This will need to become invalid code: struct A { int* ptr; } int* gptr; void foo(ref A a) { gptr = a.ptr; // error, can't leak borrowed a.ptr into global context } This feels like too much of a breakage, this is why `scope` (or `scope ref`) feels more appropriate. I always though scope would behave like that. -- /Jacob Carlborg
Re: More radical ideas about gc and reference counting
On 2014-05-13 15:56, Dicebot wrote: Judging by http://static.rust-lang.org/doc/0.6/tutorial-macros.html those are not full-blown AST macros like ones you have been proposing, more like hygienic version of C macros. Hmm, I haven't looked at Rust macros that much. -- /Jacob Carlborg
Re: borrowed pointers vs ref
On 2014-05-13 19:52, Dicebot wrote: It has to be transitive to be useful as borrowed pointer. Consider this example: { scope A a; // has some internally managed resources foo(a); } It is not safe to destruct a in the end of the scope here because foo may have stored references to a owned resources. But if foo signature is `foo(scope ref A a)` then compiler can statically verify that it is safe which is the very point of borrowing guarantees. It must be transitive to guarantee anything of course. What is scope ref supposed to do in this example, compared to just scope? -- /Jacob Carlborg
Re: borrowed pointers vs ref
On 2014-05-14 15:00, Dicebot wrote: To be a reference ;) But yeah, it is not important in this example, plain scope should behave the same if transitive. I though that A was a class in the previous example, but now I see that it was a struct. -- /Jacob Carlborg
Re: More radical ideas about gc and reference counting
On 14/05/14 23:47, Dmitry Olshansky wrote: This is curious: http://burntsushi.net/rustdoc/regex/ It seems they have compile time regular expressions too. -- /Jacob Carlborg
Re: initialization immutable array
On 15/05/14 18:13, AntonSotov wrote: DMD 2.065 I do not know much English. sorry. need to initialize immutable array _items //--- module main; import std.stdio; class Zond { this() { foreach (i; 1..4) { _items ~= i; // is expected ERROR } } immutable(int[]) _items; This might not bet what you were asking for, but alternativly you could use iota: import std.algorithm; import std.range; immutable(int[]) _items = 1.iota(4).array; -- /Jacob Carlborg
Re: D to ASM.js vs D to Dart (VM)
On 16/05/14 00:16, Etienne wrote: Templates are compile-time, a D compiler always takes care of all its compile-time duties =) Unfortunately it does not. It causes unnecessary bloat. Take this for example: void foo (T) (T t); foo(new Foo); foo(new Bar); This will generate two functions, even though the machine code is exactly the same for both. -- /Jacob Carlborg
Re: initialization immutable array
On 16/05/14 10:32, monarch_dodra wrote: UFCS iota :puke: Yeah, it would make more sense if it would be called upto: 1.upto(4) -- /Jacob Carlborg
Re: Optional monitors suggestion
On 18/05/14 07:01, Walter Bright wrote: While I agree with Andrei's agreements (!), the rationale for the current approach is to make it relatively straightforward to translate existing Java code into D. There was a fair amount of this in the early days of D, I'm not sure how much of that lately. DWT is still around. Although, I don't have any memory of seeing the monitor being used. -- /Jacob Carlborg
Re: Optional monitors suggestion
On 19/05/14 08:29, Jacob Carlborg wrote: DWT is still around. Although, I don't have any memory of seeing the monitor being used. The synchronized statement is used in DWT. -- /Jacob Carlborg
Re: Mass-enabling D = License question
On 21/05/14 02:16, Max Barraclough wrote: The DMD frontend is licensed under the GPL, which is 'viral': if your code links against it, you'll have to release your code as GPL. There's no need to link with DMD. Strictly, John is right in that the GPL doesn't prevent you from charging for your code, but seeing as that code will be GPL'ed, anyone who buys it will then be free to share it publicly free of charge. (You're also required to provide source.) John's idea of having the user provide DMD, rather than bundling it, may or may not be against the letter of the GPL (I'm unsure, but I don't think it's exactly safe ground - your code is still written to the DMD ABI, after all), but it's certainly against the spirit. It's not against the GPL license [1]. Many companies do this, Apple for example. They've created Xcode which comes (did come) bundled with GCC. Xcode is absolutely not open source. It doesn't need to because it doesn't link with GCC. It uses invokes GCC as an external process to build projects. The code produce by GPL compiler does not fall under the GPL license [2], if that were the case GCC would be useless for many users and companies. [1] https://www.gnu.org/licenses/gpl-faq.html#GPLCompatInstaller [2] https://www.gnu.org/licenses/gpl-faq.html#CanIUseGPLToolsForNF -- /Jacob Carlborg
Re: Mass-enabling D = License question
On 21/05/14 09:50, Joakim wrote: Yes, but they moved to the UIUC-licensed (basically the BSD license) llvm eventually, partially because they wanted Xcode to directly link against it. I think it's that kind of integration that Andre and Max have in mind, though as John noted, they're not particularly precise about what they want. That's a completely different thing. I would like to see someone try doing that with DMD ;). I assume they didn't want to do that since that feels quite unrealistic at this stage, DMD is not really meant for this type of integration. -- /Jacob Carlborg
Re: Mass-enabling D = License question
On 21/05/14 11:59, Max Barraclough wrote: I assumed we were talking about using the frontend as a means to enable syntax-highlighting and such, rather than simple invocation of the DMD compiler, which of course wouldn't be a problem. I assumed we weren't, since it's not really made for that. It would take a lot of work to make DMD useable as a library. XCode uses its own C/C++/Objective-C/Objective-C++ parser then, I take it? Yes, now days it uses libclang. It still compiles the code by invoking the compiler in an external process. Which could be GCC or Clang. -- /Jacob Carlborg
Re: Mass-enabling D = License question
On 21/05/14 12:02, John Colvin wrote: Also, note that linking to GPL licenced shared libraries/dlls/dylibs or whatever you use doesn't necessarily mean the GPL has got you wrapped in it's rather fuzzy web. AKAIK it's a matter of debate and has never been tested in court As far as I know, if you link dynamically with a GPL library you're library/application need to be GPL as well. That's why LGPL exists, where it's allowed. , but it's enough for many current creators/distributors of closed source software for linux who call various GPL system libs via the shared library interfaces. GPL (and LGPL) has a exception for linking with system libraries. -- /Jacob Carlborg
Re: try to install Tango+D2 but compile with error symbol undefined (Window)
On 21/05/14 15:18, JJDuck wrote: I try to use Tango and Phobo together in D2 and I downloaded the package from link(https://github.com/SiegeLord/Tango-D2 and follow its installation process(https://github.com/SiegeLord/Tango-D2/wiki/Installation#linux-gdc). But it has only Linux installation but not windows. This is what I do. 1. Visual-D and DMD already installed. link 2. I save the file to c:\Tango-D2-d2port 3. modify my C:\D\dmd2\windows\bin\sc.ini as followed [Version] version=7.51 Build 020 ; environment for both 32/64 bit [Environment] DFLAGS= -IC:\Tango-D2-d2port\ -L-LC:\Tango-D2-d2port\ -I%@P%\src\phobos -I%@P%\src\druntime\import ; optlink only reads from the Environment section so we need this redundancy ; from the Environment32 section (bugzilla 11302) LIB=%@P%..\lib [Environment32] LIB=%@P%..\lib LINKCMD=%@P%\link.exe [Environment64] LIB=%@P%..\lib64 DFLAGS=%DFLAGS% -L/OPT:NOICF LINKCMD=%VCINSTALLDIR%\bin\link.exe 4. I compile my code using following shell script file and I use dmd2\windows\bin\shell.exe to execute. DMD=C:\D\dmd2\windows\bin\dmd DFLAGS= $(DMD) Main.d -debug -L+C:\Tango-D2-d2port\libtango-dmd Shouldn't the library have a file extension, like .lib. -- /Jacob Carlborg
Re: Including Dub with D
On 22/05/14 21:11, Nick Sabalausky wrote: Is there anything blocking actual adoption of SDL? I'm not holding anything up am I? Sonke: If there's anything you need done/dealt-with regarding SDLang-D, let me know. Do we want/need the SDL parser/writer to be included into Phobos first? -- /Jacob Carlborg
Re: Including Dub with D
On 23/05/14 08:33, Suliman wrote: what it the reason to change json to SDL? Less verbose. -- /Jacob Carlborg
Re: Thank you Kenji
On 23/05/14 08:57, Ali Çehreli wrote: There is word out there that Kenji Hara and bearophile are the same person. (I think it is the same AI running on a powerful server farm. :p) I don't care, as long as the pull requests keep coming :) -- /Jacob Carlborg
Re: The GC and performance, but not what you expect
On 2014-05-29 12:09, Atila Neves wrote: The GC is preventing me from beating Java, but not because of collections. It's the locking it does to allocate instead! I don't know about the rest of you but I definitely didn't see that one coming. Doesn't the runtime know how many threads currently exist? If it's only one, could the GC avoid the locking? -- /Jacob Carlborg
Re: The GC and performance, but not what you expect
On 2014-05-29 13:01, Robert Schadek via Digitalmars-d wrote: properly, but collections is not atomar and you have to prevent threads that are created during collection from collecting. so you still need to lock The GC already stops the world, can a thread then be created during a collection? -- /Jacob Carlborg
Re: The GC and performance, but not what you expect
On 2014-05-29 14:18, Shammah Chancellor wrote: I was under the impression that the D gc does move objects around on the heap and then update the pointers. It does not. It would require barriers (read or write, don't remember which) and my people here are against that. -- /Jacob Carlborg
Re: D Users Survey: Primary OS?
On 2014-05-30 00:13, Kiith-Sa wrote: Or if you're working on tools, don't make them for $OS, make them cross-platform. (I boycott non-crossplatform tools by default) That's not so easy, depending on what you're doing. Some things are done in completely different ways depending on the operating system. If you're luck you can code two versions, one for Windows and one for Posix. Low level stuff is usually platform dependent, even if it fall under one of the above categories. For example, getting the full path to the currently running executable looks completely different on Windows, OS X, Linux and FreeBSD. -- /Jacob Carlborg
Re: D Users Survey: Primary OS?
On 2014-05-29 17:53, Tom Browder via Digitalmars-d wrote: Has anyone done a survey of the primary OS of D users? I (a D newbie) use Debian Linux (64-bit), but I get the feeling that many (if not most) users are on some version of Windows. OS X. -- /Jacob Carlborg
Re: D Users Survey: Primary OS?
On 2014-05-30 19:15, Benjamin Thaut wrote: I seem to be one of the few people who actually use D under windows. And I can confirm that linux support is far better then windows support. I'm one of the even fewer users that uses OS X. The biggest reason D is working on OS X is because it happens to work the same on Linux (mostly). Things that don't work the same as Linux, don't work, i.e. shared libraries. -- /Jacob Carlborg
Re: [OT] Extra time spent
On 2014-05-30 18:17, Ary Borenszweig wrote: No. You open a pull request. Or reopen and redefine the wrong code ;-) The beauty of Ruby, just monkey patch the bug :) -- /Jacob Carlborg
Re: std.experimental – DConf?
On 30/05/14 12:53, w0rp wrote: It's always, always easier to experiment by releasing a dub package. Including a module in the standard library requires the approval of a commity. You can always release a dub package, no one is going to stop you. std.experimental is probably best used for things that are 90% of the way into being included in std. We could find out how to address the remaining 10% then by seeing how people actually use the modules. I agree. In my opinion std.experimental would be for modules that have already passed the standard review process and are put in std.experimental for a couple of releases to battle test the API's. -- /Jacob Carlborg
Re: D Users Survey: Primary OS?
On 30/05/14 16:07, Chris wrote: Mind you, D doesn't need omnipotent toolchains. A text editor and command line will do. I now use DUB, but you can still get away with $ dmd app.d ... or shell script. Toolchains and IDE's should not be a criterion for evaluating a language. Oh, D doesn't have an IDE / proper toolchain, that doesn't mean the language is bad. It actually means that the language is so good, it doesn't need them. It's a nice-to-have but not a must have. Tool chain includes the compiler (and linker), which D needs both to be usable. -- /Jacob Carlborg
Re: D Users Survey: Primary OS?
On 30/05/14 13:20, Chris wrote: But the basic code should compile. We've just had the case when a coworker tried my code on Windows (I develop on Linux). It compiled with the latest version of dmd. No questions asked. When it comes to system stuff it's: version (Windows) { // some odd shit } version (OS X) { // some other odd shit } version (POSIX) { // normal stuff } But these are little things like the tmp directory and so on. D usually compiles on all the major platforms. Of course, but not everything work out of the box. Some stuff is inherently different and one needs to take that in to account. Hopefully the D standard library has already done that and you don't need to know/care about it :) -- /Jacob Carlborg
Re: 1st Call for Ideas for Google Summer of Code 2015
On 01/06/14 14:25, Joakim wrote: The only bigger piece I can think of is maybe pushing through the Objective-C integration for iOS, but I don't know much about that. If you referring to making D ABI compatible with Objective-C [1] then that's mostly done. I'm currently updating to latest master, then it need some minor refactoring. Of course, then there's the definition of done. This won't include blocks, categories (class extensions) or ARC. [1] http://wiki.dlang.org/DIP43 -- /Jacob Carlborg
Re: Redesign of dlang.org
On 31/05/14 21:49, w0rp wrote: After watching Andrei's keynote where he was asking for help, and noticing that there wasn't any proof of someone working on this, I took charge. http://w0rp.com:8010/ I kind of like it. It would be nice to see examples of a couple of other pages as well. The menus are removed when the width of the page gets too small. I assume they're supposed to become a collapsed drop down menu like this: http://getbootstrap.com/examples/starter-template/ That's the design in the form of a single page website running on my Linode. The source is available here. https://github.com/w0rp/new-dlang.org I would like to keep going with this and just redesign the whole website. A few points worth noting. * This is entirely a vibe.d website. (See the source.) * For pages, DDoc is replaced with diet templates. Yes, thank you, finally. Those seconds in between making a change and seeing the results really build up over time. It's probably hard to describe without trying it yourself, but trust me, it matters. This is the kind of thing I have recently fought against at work, and it was well worth it. I replaced a Compass filesystem monitor with an even slightly broken libsass CPython compiler which compiled SCSS based on modification times. The couple seconds of difference has definitely improved the day-to-day life of myself and the web designer I work with. Try that with livereload as well. For CSS it doesn't need to reload the whole page, it just inserts the new CSS. -- /Jacob Carlborg
Re: Redesign of dlang.org
On 01/06/14 07:50, Russel Winder via Digitalmars-d wrote: Contrast level is still a bit high though. The current dlang.org also has this problem because of the use of white. I am not pushing dark grey on light grey with spot colour (which is how Apple started out and still use a lot) but something with less contrast might lead to a nice brand imagery. Red, brown and black are clearly the base for a D brand, so maybe washed out red-brown background rather than white. I haven't tried this, it's just an idea – which may turn out to be rubbish. I tried and changed the background color of the #page-wrapper element to #CC. I think that looks good, although I usually prefer lighter themes. -- /Jacob Carlborg
Re: Redesign of dlang.org
On 01/06/14 21:56, w0rp wrote: You just reminded me to put in a query string version hack at some point. I typically use something like ?v=epoch_of_server_start or similar. That's not reliable. It's usually assets that are the problem, CSS, JS, images and so on. They should have a unique hash based on the content appended to the filename. Then you can have really long cache timeout (or what it's called) on those files. -- /Jacob Carlborg
Re: Performance of std.json
On 02/06/14 13:36, w0rp wrote: In terms of API, I wouldn't go completely for an approach based on serialising to structs. Having a tagged union type is still helpful for situations where you just want to quickly get at some JSON data and do something with it. I have thought a great deal about writing data *to* JSON strings however, and I have an idea for this I would like to share. I think there should be quite a minimal API, then a proper serialization module can be built on top of that. -- /Jacob Carlborg
Re: Redesign of dlang.org
On 2014-06-02 16:45, Dicebot wrote: If this will happen, I will actually start to contribute to documentation :) Agree. This would also make a reason for me to learn vibe.d. -- /Jacob Carlborg
Re: Performance of std.json
On 02/06/14 21:13, Sean Kelly wrote: I'm starting to wonder if I should just try and get permission from work to open source my parser so I can submit it. That would be awesome. Is it written in D or was it C++ ? -- /Jacob Carlborg
Re: Performance of std.json
On 02/06/14 21:13, Sean Kelly wrote: The vibe.d parser is better, but it still creates a DOM-style tree of objects, which isn't acceptable in some circumstances. I posted a performance comparison of the JSON parser I created for work use with std.json a while back, and mine is almost 100x faster than std.json in a simple test and allocates zero memory to boot: http://forum.dlang.org/thread/cyzcirslzcgnyxbyz...@forum.dlang.org#post-gxgeizjsurulklzftfqz:40forum.dlang.org I haven't tried it vs. the vibe.d parser, but I suspect it will still beat it by an order of magnitude or more because of the not allocating thing. I've said this a bunch of times, but what I want to see is a SAX-style parser as the bottom layer with an optional DOM-style parser built on top of it. Then people who want the tree generated can get it, and people who want performance or don't want allocations can get that too. I'm starting to wonder if I should just try and get permission from work to open source my parser so I can submit it. Parsing JSON really isn't terribly difficult though. It shouldn't take more than a few days for one of the more parser-oriented people here to produce something comparable. Yes, exactly. -- /Jacob Carlborg
Re: [OT] Extra time spent
On 02/06/14 20:26, Ary Borenszweig wrote: In my opinion, even though this seems ugly, when you need to ship code and the library you are using is fine except for a small issue, and you don't have time to send a pull request and wait for it to get fixed, that is a very handy solution. Another one is forking the project and pointing your dependency to it, which lately I'm doing more and more. Yeah, but the advantage of monkey patching is that it can be done in the same project that uses it. -- /Jacob Carlborg
Re: [OT] Extra time spent
On 02/06/14 20:19, Nick Sabalausky wrote: One of the main reasons I had gotten this thing was to have internet access on the go, but regardless of connection speed, I find it's usually *FAR* quicker to just wait until I get home and use a REAL computer. I prefer using a real computer as well but I like having a smart phone to have something to do when I go to and from work on the subway. Like reading these newsgroups or reading Adam's new book. Although I never post on the newsgroups using the phone. I'm also listening to music on the phone. It's also nice to be able to check the timetable for buses and the subway when you're on the go. Or have access to a map when necessary. -- /Jacob Carlborg
Re: Performance of std.json
On 03/06/14 09:15, Johannes Pfau wrote: I'd probably prefer a tokenizer/lexer as the lowest layer, then SAX and DOM implemented using the tokenizer. This way we can provide a kind of input range. I actually used Brian Schotts std.lexer proposal to build a simple JSON tokenizer/lexer and it worked quite well. But I don't think std.lexer is zero-allocation yet so that's an important drawback. If I recall correctly it will allocate strings instead of slicing the input. The strings are then reused. If the input is sliced the whole input is retained in memory even if not all of the input is used. -- /Jacob Carlborg
Re: [OT] Extra time spent
On 2014-06-03 17:23, Adam D. Ruppe wrote: Monkey patching can be done in D too if you're crazy enough to try it :P Sure, but it's a lot easier and more convenient to do in Ruby. use pragma(mangle) to replace library functions with your own versions... Can you call the original function somehow if pragma(mangle) is used? There was also an old D1 library, flectioned [1], that could do something similar, if I recall correctly. Although, it only worked for Windows and Linux, which I don't use. [1] http://flectioned.kuehne.cn/ -- /Jacob Carlborg
Re: D's gui controls need a cool control for DataBase Programming
On 2014-06-03 17:08, FrankLike wrote: Can you recommend a good IDE For DWT? Thank you! If it's ok,I will use the DWT to work. There's no GUI builder for DWT, if that's what you're looking for. But there is a plugin for Eclipse called WindowBuilder [1]. That will output Java code for SWT (which DWT is a port of). [1] http://www.eclipse.org/windowbuilder/ -- /Jacob Carlborg
Re: [OT] Apple introduces Swift as Objective-C sucessor
On 2014-06-03 15:18, Byron Heads wrote: Use .. to make a range that omits its upper value, and use ... to make a range that includes both values. That is going to be a source of a lot of bugs, so easy to type 3 when you ment 2 Same as with Ruby ... but the other way around :) -- /Jacob Carlborg
Re: [OT] Apple introduces Swift as Objective-C sucessor
On 2014-06-03 17:27, Paulo Pinto wrote: You need to provide an Objective-C or C wrapper. Or a D wrapper ;) -- /Jacob Carlborg
Re: [OT] Apple introduces Swift as Objective-C sucessor
On 2014-06-03 01:01, deadalnix wrote: How do they do error handling ? Objective-C does support exceptions, but libraries like Cocoa avoids throwing exceptions and leave those to the user (developer). Instead it usually returns a bool to indicate success or failure and then provides an NSError instance via an out parameter. -- /Jacob Carlborg
Re: [OT] Extra time spent
On 03/06/14 20:14, Walter Bright wrote: I've damaged my ears from years of loud engines. I've read that most hearing damage comes from gunshots, rock concerts, and earphones. When using earphones in public, one tends to turn up the volume to drown out the ambient noise. Worrying about that, I just don't use earphones in public. I avoid turning up the volume. I basically have the same volume I would have in a room without any other noises, just a bit louder. The music is on 24/7 at home, so I don't miss not having it elsewhere. I can't have music on at work and I don't like to wear headphones any longer periods. Although I do have music on a home, as long as I don't disturb anyone. But having an ereader has made traveling far more pleasant. Even long airline flights are much less of an endurance test when I've got my library with me. Absolutely. When I go on any longer trips, when I have a baggage anyway, I usually bring my tablet along as well. -- /Jacob Carlborg
Re: SurveyMonkey for D users OS - Results
On 03/06/14 18:54, Nick Sabalausky wrote: By using Java, HTML5 or Node.js ;) I'm sure that way it'd be very easy to get your memory usage up that high! Use Flash instead, then it will eat the CPU as well :) -- /Jacob Carlborg
Re: D's gui controls need a cool control for DataBase Programming
On 04/06/14 04:02, FrankLike wrote: Will add it to VisualD? If do it,very cool. Thank you. No, will not happen. It's too much integrated with Eclipse. -- /Jacob Carlborg
Re: D's gui controls need a cool control for DataBase Programming
On 04/06/14 04:09, FrankLike wrote: Several years ago,there was a simple IDE ,that named 'Entice',it could do for DFL and DWT.Will you want to continue it? I don't know. As far as I can remember that only worked on Windows. I do have long term plans to create a GUI builder for DWT, sometime in the future. -- /Jacob Carlborg
Re: Concurrent GC (for Windows)
On 03/06/14 09:35, Rainer Schuetze wrote: Hi, more GC talk: the last couple of days, I've been experimenting with implementing a concurrent GC on Windows inspired by Leandros CDGC. Here's a report on my experiments: http://rainers.github.io/visuald/druntime/concurrentgc.html tl;dr: there is a working(?) partially concurrent GC here: https://github.com/rainers/druntime/tree/concurrent_gc2 but it eats a whole lot of memory. How does other GC's handle these memory problems? I'm thinking of Java and C#, or do they have some advantage of being run in a virtual machine? -- /Jacob Carlborg
Re: D's gui controls need a cool control for DataBase Programming
On 2014-06-04 13:55, Bruno Medeiros wrote: Personally, I think GUI builders are likely a bit overrated nowadays. I do a lot of work with SWT, and I am a big fan of rich IDE toolchains, but I never felt much compelled to use an SWT GUI builder. I think Xcode/Interface Builder is very good. -- /Jacob Carlborg
Re: Concurrent GC (for Windows)
On 2014-06-04 09:14, Paulo Pinto wrote: Note that there are native compilers for Java and C#. My question still remains :) -- /Jacob Carlborg
Re: Swift is based LLVM,what will the D's LDC do?
On 2014-06-04 11:27, FrankLike wrote: Apple's swift comes on,but only use on iOS,so D should develop the LDC,let D keep the superiority. LDC continues to use LLVM, adds support for Objective-C [1] [2] and lives happily ever after. [1] http://wiki.dlang.org/DIP43 [2] https://github.com/jacob-carlborg/dmd/tree/d-objc -- /Jacob Carlborg
Re: Swift is based LLVM,what will the D's LDC do?
On 2014-06-04 18:25, Iain Buclaw via Digitalmars-d wrote: This likewise gdc too. All you need to do is look at the downloads page on dlang.org ! Awesome, but where's the binary for OS X? -- /Jacob Carlborg
Re: [OT] Extra time spent
On 2014-06-04 18:30, Walter Bright wrote: I understand that. But can you have it on at a barely perceptible volume at your desk? That's usually enough for me. I don't know, I haven't tried that. I don't know what they others will think. -- /Jacob Carlborg
Re: [OT] Extra time spent
On 2014-06-04 09:42, Kagamin wrote: After staring at the monitor for 8 hours, I prefer to keep my eyes closed on my way home, and it seems I always have thoughts pending processing, which doesn't require internets. To me it feels like the time goes a lot faster when I have something to do on the way home. -- /Jacob Carlborg
Re: Concurrent GC (for Windows)
On 2014-06-04 22:37, Rainer Schuetze wrote: All more sophisticated GCs have write or read barriers. That makes it much easier to keep track of modifications during concurrent collection. Right, now I start to remember. -- /Jacob Carlborg
Re: Swift is based LLVM,what will the D's LDC do?
On 2014-06-04 21:34, David Nadlinger wrote: On Wednesday, 4 June 2014 at 18:06:08 UTC, Mattcoder wrote: I think it would be a nice for learning experience and contributing more with community. It's always great to see new people interested in helping out with compiler development. Just follow your natural curiosity and don't let the task intimidate you (compilers are not rocket science), and it will almost certainly become a nice learning experience. If you get stuck at any point, or struggle to find a nice bug to work on, please don't hesitate to create a thread on the LDC mailing list (http://forum.dlang.org/digitalmars.D.ldc, or via the mailing list interface at lists.puremagic.com). We are always happy to help out newcomers, and I'm sure the same applies to GDC too. I found it quite easy to start by implementing a new __traits feature. It's usually quite small and confined. -- /Jacob Carlborg
Re: Swift is based LLVM,what will the D's LDC do?
On 2014-06-04 21:25, Iain Buclaw via Digitalmars-d wrote: I have an OSX box to start porting. But there's a couple druntime related problems I need to have a proper sit down about. These are mostly TLS-related problems. DMD insists on doing something wildly different for each target. I insist on having a common way of doing everything. Yeah, TLS seems to be a recurring problem. I would prefer to have native support. I think it's ok to drop the support for 10.6 now. Once builds start succeeding, they will come. Great. BTW, is http://gdcproject.org/downloads/ a reliable source for downloading GDC? Eventually I would like to add support for GDC to DVM and I need a reliable source to download from, both the latest compiler and older versions. [1] https://github.com/jacob-carlborg/dvm -- /Jacob Carlborg
Re: [OT] Extra time spent
On 2014-06-04 21:02, H. S. Teoh via Digitalmars-d wrote: It's strange, I find that even ambient music distracts me, yet the loud noise of an occasional passing train doesn't. Similarly, even whispers will distract me, but birds chirping, trees rustling, etc., don't. It's something about intelligible sounds that engage my brain somehow, that non-intelligible sounds don't have. So far, I haven't found anybody else who experiences the same thing. Then you have now problem listening to modern pop music ;) -- /Jacob Carlborg
Re: [OT] Apple introduces Swift as Objective-C sucessor
On 2014-06-05 11:04, Russel Winder via Digitalmars-d wrote: This is very much the Java model: exceptions are for exceptional events that can be handled or not. In Python of course exceptions are just control flow. Ruby has both raise, for exceptions, and throw, for control flow. But I suspect they're both implemented exactly the same. -- /Jacob Carlborg
Re: [OT] Apple introduces Swift as Objective-C sucessor
On 2014-06-04 23:21, Walter Bright wrote: On 6/3/2014 2:44 PM, Remo wrote: No exceptions (!) so this is at least something that this language do better as C++ and D :D Not everyone think that exceptions are necessary or there is no other way to handle errors. Exceptions make ARC expensive, so this may be a reasonable decision for Swift. I'm wondering how they'll handle exceptions thrown from Objective-C code which Swift calls. -- /Jacob Carlborg
Re: Swift is based LLVM,what will the D's LDC do?
On 2014-06-05 12:27, Iain Buclaw via Digitalmars-d wrote: I haven't tried hammering the server - it's a VM hosted on linode. But if you mean if the compiler builds are reliable, then that answer is yes. I know that the Native Linux and ARM builds are passing the testsuite/library unittests (as of the time they were built). I was referring to if I can expect the links to continue to work in the future, say a year from now. -- /Jacob Carlborg
Re: [OT] Apple introduces Swift as Objective-C sucessor
On 2014-06-05 19:14, Remo wrote: Exceptions make a lot of other thing expensive and complicated. IMHO Exceptions should only be used in really really exceptional cases and not all the way and for control flow. Fortunately it is not really necessary to use Exceptions in C++. A great example for this is LLVM and Clang code base. Even if you don't have to use exceptions, the language (Objective-C) does support them and someone will use them. -- /Jacob Carlborg
Re: D Grammar in BNF Text Form?
On 2014-06-07 00:40, Brian Schott wrote: On Friday, 6 June 2014 at 22:25:16 UTC, Tom Browder via Digitalmars-d wrote: Now I'm confused--the three files I've found have differences in production rules--it looks like I'll have to look at what the compiler is actually doing--I'm putting that off for a while unless someone has another idea . Use the HTML version. I haven't updated the ANTLR one in a while. (You may not have noticed the line in the readme that says The file that you're probably looking for is grammar.html.) Right now there are four parsers for D: Mine, which is used by DCD and D-Scanner: https://github.com/Hackerpilot/Dscanner/blob/master/std/d/ DParser2, which powers Mono-D: https://github.com/aBothe/D_Parser/tree/master/DParser2/Parser LibD which is used by SDC: https://github.com/deadalnix/libd/tree/master/src/d/parser The DMD front-end which is used by DMD, LDC, and GDC: https://github.com/D-Programming-Language/dmd/blob/master/src/parse.c There's DIL [1] as well. [1] https://github.com/azizk/dil -- /Jacob Carlborg
Re: D Grammar in BNF Text Form?
On 2014-06-07 13:41, Tom Browder via Digitalmars-d wrote: Again, my interest is in creating D bindings for a large C library and to do it auto-magically, and this discussion is very enlightening and gives me some confidence that it is feasible. There's already a tool for that [1]. It uses the JSON output from the compiler. [1] https://github.com/D-Programming-Language/tools/blob/master/dtoh.d -- /Jacob Carlborg
Re: D Grammar in BNF Text Form?
On 2014-06-07 19:45, Tom Browder via Digitalmars-d wrote: And Jacob, when I try your dstep on a header preprocessed with gcc -E I don't get very far: Could you try without preprocessing the file first? It shouldn't crash regardless but just to see what happens. Could you also please file a bug, including the input source you used. If possible, a reduce test case. -- /Jacob Carlborg
Re: D Grammar in BNF Text Form?
On 2014-06-07 19:05, Tom Browder via Digitalmars-d wrote: Didn't you mean htod? It doesn't work on Linux. No, but I see now that I read your comment wrong. So yes, htod or DStep would be the appropriate tool for what you need. I just though you want to create C bindings for a D library, since you asked about the D grammar. -- /Jacob Carlborg
Re: D Grammar in BNF Text Form?
On 2014-06-07 23:16, Tom Browder via Digitalmars-d wrote: That's another itch! That's what the dtoh tool is for. It might create bindings for C++, I'm not sure. -- /Jacob Carlborg
Re: D Grammar in BNF Text Form?
On 2014-06-07 23:15, Tom Browder via Digitalmars-d wrote: Ditto. It might be a while, though. You can start by filing an issue, including the input source used. If you then manage to reduce the test case that's even better. I just don't want the issue to get lost. -- /Jacob Carlborg
Re: D Grammar in BNF Text Form?
On 2014-06-08 10:33, Dicebot wrote: AFAIR `gcc- E` output is not a valid C on its own, no wonder libclang chokes on it. Using llvm/clang toolchain with dstep results in much more pleasant experience (not surprisingly as dstep is implemented on top of it) Hmm, it adds a bunch of lines looking like this: # 1 foo.c Except for those it seems valid. If I recall correctly, there's a way to tell Clang that it's a preprocessed file, probably with the -x flag. -- /Jacob Carlborg
Re: enum scope
On 2014-06-08 01:58, deadalnix wrote: I'm not sure why it is usually done that way in D binding. This is idiotic (and all Deimos exhibit this). enum UITableViewRowAnimation { Fade, Right, Left, Top, Bottom, None, Middle, Automatic = 100 } Here you go. You gain type safety (well kind of) and you don't need to increase verbosity. You can even use the with statement for code that use the enum intensively, for instance : final switch(myvar) with(UITableViewRowAnimation) { case Fade: // Do fading... case Right: // That's right... case Left: // That's not right.. // And so on... } That is superior to the idiotic C copy pasta in all aspects. In Swift you don't have to specify the full enum name if the compiler can infer that it's an value of specific enum that is needed: void foo (UITableViewRowAnimation); foo(Fade); Actually in Swift you would append a dot to the enum value: foo(.Fade); -- /Jacob Carlborg
Re: Need review: explicit package protection
On 2014-06-08 17:37, Dicebot wrote: Finally got to cleanup and submit this PR: https://github.com/D-Programming-Language/dmd/pull/3651 While proposed change is very small (and backwards-compatible) and not worth separate DIP, it is still a language change and needs community approval. Copy of description: Currently there is no way to use package protection attribute with deeply nested package hierarchy, forcing to either use flat one or public protection. This is one of blocking issues for further usage of package.d in Phobos and one of reasons why namespace hacks are so popular. For example, if helpers in std.internal will be marked as package, only std.internal will be able to access those, but not rest of std. This PR fixes it by allowing package(pkgname) syntax to explicitly define owning package. This new syntax will work: --- module std.internal.mod1; package(std) void foo() {} module std.mod2; --- import std.internal.mod2; void bar() { foo(); } Exact semantics can are described by added protection tests to test/compilable (last commit in this PR). Plain package behavior is unchanged and thus no breaking changes introduced. Is the idea that anything nested in the specified package has access to the symbol? -- /Jacob Carlborg
Re: enum scope
On 2014-06-08 19:50, Walter Bright wrote: Does that apply to all symbols in Swift, or just enums? I'm not sure if it applies to all symbols but it's not limited to enums. The reference documentation [1] says: An implicit member expression is an abbreviated way to access a member of a type, such as an enumeration case or a class method, in a context where type inference can determine the implied type. It has the following form: .member name For example: var x = MyEnumeration.SomeValue x = .AnotherValue [1] https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Expressions.html#//apple_ref/swift/grammar/implicit-member-expression -- /Jacob Carlborg
Re: enum scope
On 2014-06-08 19:51, Walter Bright wrote: That use of with never occurred to me! It's cool. It's very nice. I use it quite heavily in a project where I need to access enum members often. It's mostly useful when you need to access many enum members in the same scope. -- /Jacob Carlborg
Re: enum scope
On 08/06/14 21:53, Walter Bright wrote: I see, so it is using the type of the lvalue to guide the symbol resolution of the rvalue. Andrei had proposed something like this a few years ago, but I talked him out of it :-) (I felt it would play havoc with overload resolution.) I'm pretty sure Swift doesn't support function overloading. They use mandatory named parameters, like Objective-C instead. -- /Jacob Carlborg
Re: pyd - continuous integration
On 10/06/14 00:37, Ellery Newcomer wrote: So pyd is at the point where it really needs some sort of test suite runner. It's kind of complicated since I need to test against * multiple versions of dmd/ldc/gdc * multiple versions of python (2.4 - 3.4, but I'm thinking of dropping 2.4 and 2.5 this year) * redhat, ubuntu, osx, windows, etc Does anyone have any suggestions on how or where to set this up? I had a peek at atlassian bamboo, but it looks like it only plays with ec2, which I don't know anything about. Travis CI supports multi-platform, currently Linux (Ubuntu) and OS X. There's also a similar service which uses Windows. -- /Jacob Carlborg
Re: Redesign of dlang.org
On 10/06/14 10:12, Sönke Ludwig wrote: But yes, it's definitely not what you want to have for D. I'm not sure how much can be done about that, though - except from rewriting the CTFE engine with performance in mind (maybe even using a JIT compiler). Or maybe it's possible to be more liberal with algorithmic optimizations when the CTFE memory usage brought to a reasonable level. Can the templates be compiled in a separate phase, not using CTFE but as a regular compiler? -- /Jacob Carlborg
Re: Redesign of dlang.org
On 10/06/14 13:09, Dicebot wrote: DDOC was promoted because of dog-fooding rationale but I believe it has unacceptable learning curve and negatively impacts documentation contribution. I think Ddoc is fine for API documentation, but not for designing a web site. -- /Jacob Carlborg
Re: Redesign of dlang.org
On 10/06/14 16:06, Andrei Alexandrescu wrote: I think ddoc is a lot more flexible than markdown, and I'm baffled by the claim that ddoc is difficult to learn. That said I do agree it's a turnoff for first-time website contributors. IMHO if we switch away from ddoc we should switch to something better, not something just different. Something better/more powerful would be something backed by a proper programming language. -- /Jacob Carlborg
Re: Getting an access violation before main starts
On 11/06/14 02:00, Matt wrote: I was wondering if anyone could help with a problem I'm having. My program compiles properly, and has all up-to-date files and DLLs (SDL2, SDL2-image, SDL2-ttf, all the other DLLs that are required by these). However, when I run it, I get object.Error: Access Violation, which, of course, means something isn't getting created. Run it through a debugger to get a stack trace. -- /Jacob Carlborg
Re: pyd - continuous integration
On 10/06/14 23:32, Ellery Newcomer wrote: Another thing I was envisioning is a web page that shows test results for each combination so that it is easy for a casual user to determine pyd's status. Does buildbot have this sort of thing? Travis CI does have that. But it currently doesn't support Windows. -- /Jacob Carlborg
Re: Internal linkage - equivalent of C++ global static and anonymous namespaces
On 12/06/14 11:48, Kagamin wrote: Why private members can't have internal linkage? It's currently possible to access private symbols through pointers. -- /Jacob Carlborg
Re: Strange issue on OSX
On 13/06/14 07:26, Tolga Cakiroglu wrote: In the download page, table shows for which CPU type they are available. dmd.2.065.0.zip shows i386 and x86_64. So, this should run on 32 and 64-bits. dmd.2.065.0.dmg shows only x86_64 which is for 64-bit CPU only. That's not correct. The zip file only contains 64bit. DMD for OS X has only been released as 64bit for quite a while now. Just run the file command on the dmd executable to see which platforms it supports. -- /Jacob Carlborg
Re: foreach
On 12/06/14 21:21, Nick Sabalausky wrote: - I rarely need to do that. Most of my N times loops exist *because* I want to use the index. I use the n.times in Ruby for testing quite a lot. When I need to create x instances of a class and it doesn't matter what values they have. Although I usually use that together with a map. @foos = 3.times.map{ Foo.new } -- /Jacob Carlborg
Re: foreach
On 12/06/14 17:00, Manu via Digitalmars-d wrote: I often find myself wanting to write this: foreach(; 0..n) {} In the case that I just want to do something n times and I don't actually care about the loop counter, but this doesn't compile. You can do this: for(;;) {} If 'for' lets you omit any of the loop terms, surely it makes sense that foreach would allow you to omit the first term as well? I see no need to declare a superfluous loop counter when it is unused. The only reason I can see to make this change is to make it more consistent with for. But I don't know if it's for that is inconsistent with everything else or if it's foreach that is inconsistent with for. -- /Jacob Carlborg
Re: foreach
On 13/06/14 11:28, Marc Schütz schue...@gmx.net wrote: Would be nice if we could elide the parentheses and semicolons: 10.times! { writeln(Do It!); } 10.times! (uint n) { writeln(n + 1, Round); } Yeah, that has been suggested before. -- /Jacob Carlborg
Re: UFCS overloaded property getters/setters
On 2014-06-13 20:16, H. S. Teoh via Digitalmars-d wrote: I think this is starting to show itself as an anti-pattern, or at least, one of those obscure dark corners of D infested with complex interactions between unexpected features and possible compiler quirks. Probably the best thing to do is to make both getter and setter final, and add an overloadable onPropSet() method that the derived class can use to customize the property. I don't think this is the case here. It is as Jonathan described it. A base class and a subclass have different overload sets [1]. [1] http://dlang.org/hijack.html search for Derived Class Member Function Hijacking -- /Jacob Carlborg
Re: foreach
On 2014-06-13 20:03, H. S. Teoh via Digitalmars-d wrote: On Fri, Jun 13, 2014 at 10:46:17AM -0700, Jonathan M Davis via Digitalmars-d wrote: [...] for(;;) is a special case with no real benefit IMHO. It's a loop whose condition is implicitly true rather than actually having a condition in it. IMHO, it should required to be at least for(;1;) or for(;true;), since those don't require a special case. I disagree, it's not a special case. It's simply a logical consequence of each part of the for-loop being optional. Prohibiting for(;;) would *be* a special case, because then you're saying that each component of the for-loop is optional, *except* when all of them are omitted. (Not to mention, for(;1;) is truly an eyesore, far worse than for(;;).) And if that's what you're doing, you might as well just use while(1), since there's no point in using for over while if you're not doing anything in the other two parts of the for loop. Again I disagree. Using for(;;) is completely natural, because the definition of for() says that each of the 3 parts are optional. Since an infinite loop loops *unconditionally*, it doesn't have any loop conditions, so the most natural thing to do is to use a construct where the loop condition can be omitted -- i.e., for(;;). On the contrary, using while() here is unnatural because while() expects a loop condition, but since an infinite loop doesn't have one, you have to artificially invent a constant value to stick into the loop condition in order to satisfy the syntax of the while-loop. I find this to be quite unnatural. I don't agree. How many other statements allow their parts to be optional. while does not, if does not. -- /Jacob Carlborg
Re: Strange issue on OSX
On 2014-06-14 04:12, Jeremy DeHaan wrote: I agree. Also, this page (http://dlang.org/dmd-osx.html) says that the base requirement is a 32 bit OSX. Why is the DMD version that is released 64 bit? That seems very counter intuitive. Technically you can run 64bit applications on 32bit OS X if you have a 64bit CPU. -- /Jacob Carlborg
Re: write(f)ln style exception factory
On 2014-06-15 11:40, Dmitry Olshansky wrote: No, normal exceptions print just fine. e.g. writeln(new Exception(abc)); I'm wondering what's wrong the one I defined, the error message seems to indicate that it doesn't have toString. It's wrong as there is one derived from Exception. Workaround was to use alias toString = Base.toString; Is this because writeln tries to use the one without parameters? If you override one method, which as overloads, you need to override all overloads or bring them into the same overload set with an alias, as you've done above. A base class and subclass have different overload sets [1]. [1] http://dlang.org/hijack.html search for Derived Class Member Function Hijacking. -- /Jacob Carlborg
Re: A Perspective on D from game industry
On 17/06/14 06:44, H. S. Teoh via Digitalmars-d wrote: String mixins? Auto-completion? I dunno, that sounds like a stretch to me. How would an IDE handle autocompletion for things like like: string generateCode() { string code = int x=; if (solveFermatsLastTheorem()) { code ~= 1; } else { code ~= 2; } code ~= ;; return code; } int func() { mixin(generateCode()); } That would require semantic analysis. Basically evaluate the string mixin and to autocomplete on the resulted code. -- /Jacob Carlborg
Re: Swift does away with pointers == pervasive ARC
On 16/06/14 17:16, Manu via Digitalmars-d wrote: What say you to that, Walter? Apple have committed to pervasive ARC, which you consistently argue is not feasible... Have I missed something, or is this a demonstration that it is actually practical? I think Swift is only intended for high level application development. It doesn't feel like a true systems or general purpose language. -- /Jacob Carlborg
Re: Swift does away with pointers == pervasive ARC
On 17/06/14 05:18, Walter Bright wrote: Note that Swift seems to not do exceptions (I may be wrong, again, I know little about Swift), which is one way to avoid that problem. It does not support exceptions. -- /Jacob Carlborg
Re: Is D production-ready?
On 16/06/14 12:24, John Petal wrote: Does D have a mature and cross-platform GUI library? I would recommend DWT [1], although it currently doesn't work on OS X (I'm working on that). [1] https://github.com/d-widget-toolkit/dwt -- /Jacob Carlborg
Re: Constant relationships between non-constant objects
On 2014-06-18 08:35, Daniel Murphy wrote: I think D used to have this in the form of the 'final' storage class for variables. I'm not sure why we got rid of it. If I recall correctly it was also how const worked in D1. -- /Jacob Carlborg
Re: Adding the ?. null verification
On 2014-06-18 17:46, Kapps wrote: C# is getting the same syntax, and I remember there being some discussion about it here. It's somewhat useful I suppose, though I think it's made significantly more useful in C# with 'a ?? b' (a if a is not null, else b). And a ??= b, assigne b to a, only if a is null. -- /Jacob Carlborg
Re: Compiler generated assertion error message
On 2014-06-19 19:52, Dicebot wrote: On a related topic: Feature like this is extremely convenient for unit tests. However using assertions in unit test blocks does not fit well with any custom test runner that does not immediately terminate the application (because AssertionError is an Error). There's an assert handler in druntime [1], but that expects the implementation to be nothrow, so you cannot throw an exception. I'd personally love some way to get such formatted expression for any library function. What is the official stance on this? [1] https://github.com/D-Programming-Language/druntime/blob/master/src/core/exception.d#L374 -- /Jacob Carlborg