Re: Building a wasm library, need to override .object._d_newitemT!T
On Sunday, 24 December 2023 at 10:50:41 UTC, Johan wrote: _d_newitemT!T is fairly new, what compiler version are you using? -Johan Nevermind, I managed to get it working but I had to compile without including druntime and phobos and move everything into the library. I'm using ldc 1.36.0-beta1
Building a wasm library, need to override .object._d_newitemT!T
Hello, I've been developing a library[1] based on spasm for which I've implemented the druntime and currently it compiles web apps properly with TypeInfo, no GC, and it even uses diet templates. I'm having a problem implementing the `new` keyword, so that I can start importing more libraries with minimal change. However, LDC calls .object._d_newitemT!T from the original druntime - which I need for compile-time function execution, but my implementation in `module object` doesn't override it in the compiler and the original implementation tries import core.stdc.time which errors out in wasm (with good reasons). Is there a compiler flag than I can use to override module templates? Thanks in advance. [1] https://github.com/etcimon/libwasm
Re: Lazy and GC Allocations
On Monday, 20 February 2023 at 19:58:32 UTC, Steven Schveighoffer wrote: On 2/20/23 1:50 PM, Etienne wrote: On Monday, 20 February 2023 at 02:50:20 UTC, Steven Schveighoffer wrote: See Adam's bug report: https://issues.dlang.org/show_bug.cgi?id=23627 So, according to this bug report, the implementation is allocating a closure on the GC even though the spec says it shouldn't? The opposite, the delegate doesn't force a closure, and so when the variable goes out of scope, memory corruption ensues. I've been writing some betterC and the lazy parameter was prohibited because it allocates on the GC, so I'm wondering what the situation is currently It shouldn't. Now, lazy can't be `@nogc` (because that's just what the compiler dictates), but it won't actually *use* the GC if you don't allocate in the function call. I just tested and you can use lazy parameters with betterC. -Steve The @nogc issue might be what might be why it didn't work for me. I use it because it's easier to work with betterC but perhaps I should avoid writing @nogc code altogether Thanks for the info! Etienne
Re: Lazy and GC Allocations
On Monday, 20 February 2023 at 02:50:20 UTC, Steven Schveighoffer wrote: See Adam's bug report: https://issues.dlang.org/show_bug.cgi?id=23627 -Steve So, according to this bug report, the implementation is allocating a closure on the GC even though the spec says it shouldn't? I've been writing some betterC and the lazy parameter was prohibited because it allocates on the GC, so I'm wondering what the situation is currently Etienne
Lazy and GC Allocations
Hello, I'm wondering at which moment the following would make an allocation of the scope variables on the GC. Should I assume that the second parameter of enforce being lazy, we would get a delegate/literal that saves the current scope on the GC even if it's not needed? I'm asking purely for a performance perspective of avoiding GC allocations. ``` void main() { int a = 5; enforce(true, format("a: %d", a)); } ``` Thanks Etienne
Re: Any usable SIMD implementation?
On Thursday, 31 March 2016 at 08:23:45 UTC, Martin Nowak wrote: I'm currently working on a templated arrayop implementation (using RPN to encode ASTs). So far things worked out great, but now I got stuck b/c apparently none of the D compilers has a working SIMD implementation (maybe GDC has but it's very difficult to work w/ the 2.066 frontend). https://github.com/MartinNowak/druntime/blob/arrayOps/src/core/internal/arrayop.d https://github.com/MartinNowak/dmd/blob/arrayOps/src/arrayop.d I don't want to do anything fancy, just unaligned loads, stores, and integral mul/div. Is this really the current state of SIMD or am I missing sth.? -Martin Not sure if it's been mentioned, but I've made a best effort to implement GCC's in here: https://github.com/etcimon/botan/tree/master/source/botan/utils/simd
Re: Ddb needs a maintainer
On Tuesday, 12 April 2016 at 09:58:22 UTC, Suliman wrote: On Tuesday, 12 April 2016 at 09:52:53 UTC, Rory McGuire wrote: On Tue, Apr 12, 2016 at 11:30 AM, Suliman via Digitalmars-d-announce < digitalmars-d-announce@puremagic.com> wrote: [...] Would need to see the full exception stack trace that was printed out. Could you perhaps have an infinite recursion bug in there somewhere? You should be able to see if you are getting the right type out of the Variant by using something like: writeln(row[1].type); I am getting Out of memory exception even on this code: writeln(row[0].type); writeln(row[0]); // -- works fine writeln(row[0]) is fine. However, you need to close the result set and destroy the PGCommand. result.close(); cmd.destroy();
Re: Wannabe contributor frustrations
On Wednesday, 10 February 2016 at 23:30:03 UTC, Márcio Martins wrote: My expectation was that given I followed the official "tutorial" closely, everything was going to just work, instead I spent about 2 hours on this and got nowhere... It took me way more than 2 hours to grasp how this build process works. It wasn't until I had read through the whole source code actually.
Re: vibe.d benchmarks
On Wednesday, 6 January 2016 at 08:24:10 UTC, Atila Neves wrote: On Tuesday, 5 January 2016 at 14:15:18 UTC, rsw0x wrote: On Tuesday, 5 January 2016 at 13:09:55 UTC, Etienne Cimon wrote: On Tuesday, 5 January 2016 at 10:11:36 UTC, Atila Neves wrote: [...] The Rust mio library doesn't seem to be doing any black magic. I wonder how libasync could be optimized to match it. Have you used perf(or similar) to attempt to find bottlenecks yet? Extensively. I optimised my D code as much as I know how to. And that's the same code that gets driven by vibe.d, boost::asio and mio. Nothing stands out anymore in perf. The only main difference I can see is that the vibe.d version has far more cache misses. I used perf to try and figure out where those came from and included them in the email I sent to Soenke. Perf is a bit hard to understand if you've never used it before, but it's also very powerful. Oh, I know. :) Atila It's possible that those cache misses will be irrelevant when the requests actually do something, is it not? When a lot of different requests are competing for cache lines, I'd assume it's shuffling it enough to change these readings
Re: vibe.d benchmarks
On Wednesday, 6 January 2016 at 08:21:00 UTC, Atila Neves wrote: On Tuesday, 5 January 2016 at 13:09:55 UTC, Etienne Cimon wrote: On Tuesday, 5 January 2016 at 10:11:36 UTC, Atila Neves wrote: [...] The Rust mio library doesn't seem to be doing any black magic. I wonder how libasync could be optimized to match it. No black magic, it's a thin wrapper over epoll. But it was faster than boost::asio and vibe.d the last time I measured. Atila You tested D+mio, but the equivalent would probably be D+libasync as it is a standalone library, thin wrapper around epoll
Re: vibe.d benchmarks
On Tuesday, 5 January 2016 at 14:45:18 UTC, Nikolay wrote: On Tuesday, 5 January 2016 at 14:15:18 UTC, rsw0x wrote: Have you used perf(or similar) to attempt to find bottlenecks yet? I used perf and wrote my result here: http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/1670/?page=2 As Sönke Ludwig said direct epoll usage can give more then 200% improvements over libevent. libasync is the result of an attempt to use epoll directly
Re: vibe.d benchmarks
On Tuesday, 5 January 2016 at 10:11:36 UTC, Atila Neves wrote: On Thursday, 31 December 2015 at 08:23:26 UTC, Laeeth Isharc wrote: [...] vibe.d _was_ faster than Go. I redid the measurements recently once I wrote an MQTT broker in Rust, and it was losing to boost::asio, Rust's mio, Go, and Java. I told Soenke about it. I know it's vibe.d and not my code because after I got the disappointing results I wrote bindings from both boost::asio and mio to my D code and the winner of the benchmarks shifted to the D/mio combo (previously it was Rust - I figured the library was the cause and not the language and I was right). I'd've put up new benchmarks already, I'm only waiting so I can show vibe.d in a good light. Atila The Rust mio library doesn't seem to be doing any black magic. I wonder how libasync could be optimized to match it.
Re: vibe.d benchmarks
On Monday, 4 January 2016 at 10:32:41 UTC, Daniel Kozak wrote: V Sat, 02 Jan 2016 03:00:19 + Etienne Cimon via Digitalmars-d <digitalmars-d@puremagic.com> napsáno: On Friday, 1 January 2016 at 11:38:53 UTC, Daniel Kozak wrote: > On Thursday, 31 December 2015 at 18:23:17 UTC, Etienne Cimon > wrote: >> [...] > > ? With libasync, you can run multiple instances of your vibe.d server and the linux kernel will round robin the incoming connections. Yes, but I speak about one instance of vibe.d with multiple workerThreads witch perform really bad with libasync Yes, I will investigate this.
Re: vibe.d benchmarks
On Sunday, 3 January 2016 at 22:16:08 UTC, Nick B wrote: can someone tell me what changes need to be commited, so that we have a chance at getting some decent (or even average) benchmark numbers ? Considering that the best benchmarks are from tools that have all the C calls inlined, I think the best optimizations would be in pragma(inline, true), even doing inlining for fiber context changes.
Re: vibe.d benchmarks
On Saturday, 2 January 2016 at 10:05:56 UTC, Sebastiaan Koppe wrote: That is nice. Didn't know that. That would enable zero-downtime-updates right? Yes, although you might still break existing connections unless you can make the previous process wait for the existing connections to close after killing it. I use docker a lot so normally I run a proxy container in front of the app containers and have it handle ssl and virtual hosts routing. I haven't needed to migrate out of my linux server yet (12c/24t 128gb) but when I do, I'll just add another one and go for DNS round robin. I use cloudflare currently and in practice you can add/remove A records and it'll round robin through them. If your server application is capable of running as multiple instances, it's only a matter of having the database/cache servers accessible from another server and you've got a very efficient load balancing that doesn't require any proxies.
Re: vibe.d benchmarks
On Friday, 1 January 2016 at 11:38:53 UTC, Daniel Kozak wrote: On Thursday, 31 December 2015 at 18:23:17 UTC, Etienne Cimon wrote: On Thursday, 31 December 2015 at 13:29:49 UTC, Daniel Kozak wrote: On Thursday, 31 December 2015 at 12:09:30 UTC, Etienne Cimon wrote: [...] When I use HTTPServerOption.distribute with libevent I get better performance but with libasync it drops from 2 req/s to 80 req/s. So maybe some another performance problem I launch libasync programs as multiple processes, a bit like postgresql. The TCP listening is done with REUSEADDR, so the kernel can distribute it and it scales linearly without any fear of contention on the GC. My globals go in redis or databases ? With libasync, you can run multiple instances of your vibe.d server and the linux kernel will round robin the incoming connections.
Re: vibe.d benchmarks
On Thursday, 31 December 2015 at 08:51:31 UTC, yawniek wrote: On Thursday, 31 December 2015 at 08:23:26 UTC, Laeeth Isharc wrote: Isn't there a decent chance the bottleneck is vibe.d's JSON implementation rather than the framework as such ? We know from Atila's MQTT project that vibe.D can be significantly faster than Go, and we also know that its JSON implementation isn't that fast. Replacing with FastJSON might be interesting. Sadly I don't have time to do that myself. this is not the same benchmark discussed elsewhere, this one is a simple echo thing. no json. it just states that there is some overhead around on various layers. so its testimony is very limited. from a slightly more distant view you can thus argue that 50k rps vs 150k rps basically just means that the framework will most probably not be your bottle neck. none the less, getting ahead in the benchmarks would help to attract people who are then pleasantly surprised how easy it is to make full blown services with vibe. the libasync problem seem seems to be because of TCP_NODELAY not being deactivated for local connection. That would be the other way around. TCP_NODELAY is not enabled in the local connection, which makes a ~20-30ms difference per request on keep-alive connections and is the bottleneck in this case. Enabling it makes the library competitive in these benchmarks.
Re: vibe.d benchmarks
On Thursday, 31 December 2015 at 13:29:49 UTC, Daniel Kozak wrote: On Thursday, 31 December 2015 at 12:09:30 UTC, Etienne Cimon wrote: That would be the other way around. TCP_NODELAY is not enabled in the local connection, which makes a ~20-30ms difference per request on keep-alive connections and is the bottleneck in this case. Enabling it makes the library competitive in these benchmarks. When I use HTTPServerOption.distribute with libevent I get better performance but with libasync it drops from 2 req/s to 80 req/s. So maybe some another performance problem I launch libasync programs as multiple processes, a bit like postgresql. The TCP listening is done with REUSEADDR, so the kernel can distribute it and it scales linearly without any fear of contention on the GC. My globals go in redis or databases
Re: LDC with Profile-Guided Optimization (PGO)
On Tuesday, 22 December 2015 at 14:49:51 UTC, Johan Engelen wrote: On Tuesday, 15 December 2015 at 23:05:38 UTC, Johan Engelen wrote: Hi all, I have been working on adding profile-guided optimization (PGO) to LDC [1][2][3]. At this point, I'd like to hear your input and hope you can help with testing! Unfortunately, to try it out, you will need to build LDC with LLVM3.7 yourself. PGO should work on OS X, Linux, and Windows. Would it help if binaries are available? Or is general interest low? -Johan Sorry I don't read the forums often. This is definitely going to be a game changer for me, I need PGO to help with Botan performance issues and I'm going to be developing an embedded server on Intel Edison with vibe.d/botan/http2 soon, this compiler could make quite the difference. I'll be testing it one I get my prototype!
Re: DMD is slow for matrix maths?
On Monday, 26 October 2015 at 20:30:51 UTC, rsw0x wrote: On Monday, 26 October 2015 at 11:37:17 UTC, Etienne Cimon wrote: On Monday, 26 October 2015 at 04:48:09 UTC, H. S. Teoh wrote: On Mon, Oct 26, 2015 at 02:37:16AM +, Etienne Cimon via Digitalmars-d wrote: If you must use DMD, I recommend filing an enhancement request and bothering Walter about it. T I'd really like the performance benefits to be available to DMD users as well. I think I'll have to write it all with inline assembler just to be sure... dmd will never reach gdc/ldc performance, gcc and LLVM have entire teams of people that actively contribute to their compilers. LDC couldn't inline it either. My only options at this point is to write the assembly or link to a C library.
Re: DMD is slow for matrix maths?
On Tuesday, 27 October 2015 at 18:18:36 UTC, Etienne Cimon wrote: On Monday, 26 October 2015 at 20:30:51 UTC, rsw0x wrote: On Monday, 26 October 2015 at 11:37:17 UTC, Etienne Cimon wrote: On Monday, 26 October 2015 at 04:48:09 UTC, H. S. Teoh wrote: [...] I'd really like the performance benefits to be available to DMD users as well. I think I'll have to write it all with inline assembler just to be sure... dmd will never reach gdc/ldc performance, gcc and LLVM have entire teams of people that actively contribute to their compilers. LDC couldn't inline it either. My only options at this point is to write the assembly or link to a C library. Btw, DMD and LDC had similar performance.
Re: DMD is slow for matrix maths?
On Monday, 26 October 2015 at 04:48:09 UTC, H. S. Teoh wrote: On Mon, Oct 26, 2015 at 02:37:16AM +, Etienne Cimon via Digitalmars-d wrote: If you must use DMD, I recommend filing an enhancement request and bothering Walter about it. T I'd really like the performance benefits to be available to DMD users as well. I think I'll have to write it all with inline assembler just to be sure...
DMD is slow for matrix maths?
I've been playing around with perf and my web server and found that the bottleneck is by far the math module of Botan: https://github.com/etcimon/botan/blob/master/source/botan/math/mp/mp_core.d I'm probably a bit naive but I was wishing for some inlining to happen. I see LOTS of CPU time spent on "pop" instructions to return from a simple multiply function, and the pragma(inline, true) was refused on all of these. So, should I wait for an inline? Should I import another library? Should I rewrite all the maths in assembly manually for each processor? Should I write another library that must be compiled with LDC/release for maths? I think the best option would be for an inline feature in DMD that works, but I'm wondering what the stance is right now about the subject?
Re: Invalid assembler comparison
On Friday, 23 October 2015 at 15:17:43 UTC, Etienne Cimon wrote: Hello, I've been trying to understand this for a while now: https://github.com/etcimon/botan/blob/master/source/botan/math/mp/mp_core.d#L765 This comparison (looking at it with windbg during cmp operation) has these invalid values in the respective registers: rdx: 9366584610601550696 r15: 8407293697099479287 When moving them into a ulong variable with a mov [R11], RDX before the CMP command, I get: RDX: 7549031027420429441 R15: 17850297365717953652 Which are the valid values. Any idea how these values could have gotten corrupted this way? Is there a signed integer conversion going on behind the scenes? I found out that there was an integer conversion going on behind the scenes when using jnl. I had to use jnb http://stackoverflow.com/questions/27284895/how-to-compare-a-signed-value-and-an-unsigned-value-in-x86-assembly
Invalid assembler comparison
Hello, I've been trying to understand this for a while now: https://github.com/etcimon/botan/blob/master/source/botan/math/mp/mp_core.d#L765 This comparison (looking at it with windbg during cmp operation) has these invalid values in the respective registers: rdx: 9366584610601550696 r15: 8407293697099479287 When moving them into a ulong variable with a mov [R11], RDX before the CMP command, I get: RDX: 7549031027420429441 R15: 17850297365717953652 Which are the valid values. Any idea how these values could have gotten corrupted this way? Is there a signed integer conversion going on behind the scenes?
Re: Experience: Developing Cloud Foundry applications with D
On Tuesday, 6 October 2015 at 09:36:42 UTC, Marc Schütz wrote: On Tuesday, 6 October 2015 at 05:45:18 UTC, Andre wrote: vagrant@vagrant-ubuntu-trusty-64:~/projects/tests/vibed_test$ dub Target memutils 0.4.1 is up to date. Use --force to rebuild. Target libasync 0.7.5 is up to date. Use --force to rebuild. Target vibe-d 0.7.25 is up to date. Use --force to rebuild. Building vibed_test ~master configuration "debug", build type debug. Compiling using dmd... Enhanced memory security is enabled. Using Linux EPOLL for events Linking... Running ./bin/app Listening for HTTP requests on :::8080 Listening for HTTP requests on 0.0.0.0:8080 E: Could not mlock 65536 bytes Does it keep running? AFAIK, the last line is just a warning from the botan library that attempts to allocate non-swappable memory for holding secret keys etc. The error is with mlock, the ulimit for locked memory is too low on non-root user accounts, so it falls back to simple zeroize of swappable memory
Re: Experience: Developing Cloud Foundry applications with D
On Monday, 5 October 2015 at 06:24:44 UTC, Andrei Alexandrescu wrote: On 10/5/15 1:34 AM, Rikki Cattermole wrote: Vibe.d has a provider called libasync. Libasync is fully implemented in D. You probably should have tried that at least. Although I still would recommend trying it ;) It's a lot better then what we have in Phobos. Cue choir asking for porting of libasync to phobos. I've first asked this a couple of years ago. -- Andrei To be fair, libasync was release only october last year :) Will work on adding libasync to Phobos once I'm finished adding a few more features to my main project! (3-4 months). Will need to strip memutils, will you have std.allocator ready? Anyone is free to pick up this project and move libasync to phobos if ready before me. I've gotten this all-D web framework (vibe.d, botan-D TLS, D libhttp/2, etc) into production on my end and it works great!
Re: dmd codegen improvements
On Tuesday, 18 August 2015 at 10:45:49 UTC, Walter Bright wrote: So if you're comparing code generated by dmd/gdc/ldc, and notice something that dmd could do better at (1, 2 or 3), please let me know. Often this sort of thing is low hanging fruit that is fairly easily inserted into the back end. I think someone mentioned how other compilers unroll loops at more than 2 levels. Other than that, there was a recent Java vs D thread which showed it orders of magnitude faster on vtable calls. So I think the most amazing feature would be to allow profiling sampling to compile with samples and select which functions to inline or do some magic around vtable pointers like what Java is doing. Finally, I'm going to write this down here and haven't had time to look more into it but I've never been able to compile Botan with optimizations on DMD64 Win64 VS2013 (https://github.com/etcimon/botan), it's really strange having a crypto library that you can't optimize, building -O -g also gives me a ccog.c ICE error. I think it might be something about `asm pure` that uses some locals, does that eliminate the function call parameters?
Re: dmd codegen improvements
On Tuesday, 18 August 2015 at 12:32:17 UTC, Etienne Cimon wrote: a crypto library that you can't optimize, building -O -g also gives me a ccog.c ICE error. I think it might be something about `asm pure` that uses some locals, does that eliminate the function call parameters? Sorry that was cgcod.c Internal error: backend\cgcod.c 2311 FAIL .dub\build\__test__full__-unittest-windows-x86_64-dmd_2068-8073079C502FEEB927744150233D4046\ __test__full__ executa ble I'll try and file a bugzilla about this. I think stability should be first concern.
Re: D fund
On Sunday, 9 August 2015 at 09:15:16 UTC, ref2401 wrote: Does the fund exist? Are there sponsors? How can one donate some money to D? Ask a D developer you appreciate (in private) to give you his paypal/email, and pay him directly like he's a musician on the side of the road. He will be motivated by this simple gesture of receiving the few dollars, his happiness is going to reflect through his open source work, and the D community will benefit as a whole. It would probably help if D developers put a donations paypal link on their README.md, but I think most people have such a grim outlook on making money from the open source work, that they don't even take the time to put that link on there.
Re: Writing/Creating files at compile-time
On Sunday, 9 August 2015 at 21:48:13 UTC, JDemler wrote: On Sunday, 9 August 2015 at 14:00:55 UTC, Rikki Cattermole wrote: On 10/08/2015 1:57 a.m., cym13 wrote: On Sunday, 9 August 2015 at 13:51:21 UTC, Andrei Alexandrescu wrote: On 8/9/15 5:07 AM, JDemler wrote: [...] I think this is an interesting pursuit that closes the circle on a number of issues, such as debuggability and compilation speed of mixin code. -- Andrei The moment this is added to D, we will have two complete languages in one: an interpreted one at compile-time and another at runtime. While I find this interesting, I wonder wether this is a good idea or not. I'm actually at the point where I believe the addition of string import was a bad one. No. I prefer preprocessing into a D file first. It irks me, you have to be pretty careful with them, but at least a preprocessed file you know _exactly_ where all files need to be for CT. Consider vibe.d's diet templates: They are compiled into d code using information of the types provided by the user. Without string imports at compile-time that would either result in a two-step compile process or would rely on run-time type information. Both is nothing I would like to use. Imagine the .dt files could be compiled into .dt.d files and then imported at compile-time. The development process would be much easier (debugging and examining the source files becomes trivial) and the usage would be more transparent (I see what my .dt file gets compiled into) and would have faster compile times (as Andrei mentioned). You cam already do this I believe. You only need to write the string to a file instead of putting it through mixin. You import the module corresponding to the compiled diet template if it exists, or create it if it doesn't (at runtime). This means you get 2 runtimes though... But you also need a way to delete the .d file automatically once the .dt is changed. In the end, this is totally less convenient than writing a custom precompiler but whatever :)
Re: Why Java (server VM) is faster than D?
On Monday, 3 August 2015 at 17:33:30 UTC, aki wrote: On Monday, 3 August 2015 at 16:47:58 UTC, John Colvin wrote: changing two lines: final class SubFoo : Foo { int test(F)(F obj, int repeat) { I tried it. DMD is no change, while GDC gets acceptable score. D(DMD 2.067.1): 2.445 D(GDC 4.9.2/2.066): 0.928 Now I got a hint how to improve the code by hand. Thanks, John. But the original Java code that I'm porting is about 10,000 lines of code. And the performance is about 3 times different. Yes! Java is 3 times faster than D in my app. I hope the future DMD/GDC compiler will do the similar optimization automatically, not by hand. Aki. LLVM might be able to do achieve Java's optimization for your use case using profile-guided optimization. In principle, it's hard to choose which function to inline without the function call counts, but LLVM has a back-end with sampling support. http://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization Whether or not this is or will be available soon for D in LDC is a different matter.
Re: DMD on WIndows 10
On Saturday, 1 August 2015 at 07:56:34 UTC, John Chapman wrote: On Friday, 31 July 2015 at 22:02:13 UTC, Paul D Anderson wrote: I'm waiting to upgrade from Windows 7 to Windows 10 to avoid the inevitable just-released bugs, but does anyone have any info about D on Windows 10? Has anyone tried it? I'm on Windows 10, and my DMD-built programs run just fine. Did you get a sort of freeze on Win10 when trying to open some executables downloaded from the internet? I was annoyed a bit when re-downloading all my apps, the installer just appeared out of nowhere 5 minutes later.
Re: Arrays and struct assignment, pt. 2
On Sunday, 2 August 2015 at 02:49:03 UTC, Jonathan M Davis wrote: On Sunday, 2 August 2015 at 01:50:50 UTC, David Nadlinger wrote: Again, am I missing something obvious here? I can't quite believe that struct lifetime would have been quite as broken for so long. I suspect that what it comes down to is that opAssign doesn't get used all that frequently. Most structs simply don't need it, so code which would hit the bug probably isn't all that common. Obviously, such code exists, but it requires using both opAssign and then putting those structs in arrays - and then catching the resulting bug (which you would hope would happen, but if the difference is subtle enough, it wouldn't necessarily be caught). And if structs with opAssign normally also define a postblit, then it's that much less likely that the problem would be hit. - Jonathan M Davis I couldn't get reference counted types to work as struct members, for some hard-to-track reason, and am actively avoiding it right now as a result. Maybe we've found a cause here? The might be a lot of people like me that gave up trying to track it, and are simply avoiding error-prone uses of structs.
Re: D for Android
On Thursday, 30 July 2015 at 19:38:12 UTC, Joakim wrote: On Monday, 25 May 2015 at 20:08:48 UTC, Joakim wrote: On Monday, 18 May 2015 at 15:47:07 UTC, Joakim wrote: Sure, have fun with your new devices. :) Hopefully, I'll get Android/ARM working before then, but I don't and won't have any AArch64 devices to test. Not that it matters, as 64-bit ARM has even less share than x86 right now. Earlier this week, I stumbled across a way to get TLS working with ldc for Android/ARM, similar to the approach used for Android/x86 so far. Exception-handling on ARM for ldc is currently unfinished (https://github.com/ldc-developers/ldc/issues/489), so if I disable a handful of tests related to that, I get 36 of 42 druntime modules' unit tests and around 31 of 70 phobos modules' unit tests to pass. All tests were run from the command line on my Android tablet. It appears there are issues related to unicode and the GC causing many of the remaining failures. Some good news, I've made progress on the port to Android/ARM, using ldc's 2.067 branch. Currently, all 46 modules in druntime and 85 of 88 modules in phobos pass their tests (I had to comment out a few tests across four modules) when run on the command-line. There is a GC issue that causes 2-3 other modules to hang only when the tests are run as part of an Android app/apk, ie a D shared library that's invoked by the Java runtime. I've compiled an Android/ARM app that will run the remaining majority of tests on Android 5 Lollipop or newer, which you can download and try out on your Android 5 devices: https://github.com/joakim-noah/android/releases/tag/apk All tests run on my Android 5.1 device, while the last two modules tested by this app hang on an Android 5.0 device I tested. All patches used are linked from the above release. Thanks, I didn't remember you were the one working on this. I've been following this and I'm just as eager to start testing my libraries with it. I think Android could also use a cross-platform web plugin framework. I've started to refactor the idea, and just being able to enhance a website with native code on any platform would be great, it would really make up for being forced into doing all-javascript when writing the UI in HTML5/CSS right now.
Re: D Web Services Application Potential?
On Wednesday, 29 July 2015 at 16:55:25 UTC, Laeeth Isharc wrote: On Wednesday, 29 July 2015 at 13:22:43 UTC, Etienne Cimon wrote: There's a really minimal amount of code on web servers nowadays with javascript frameworks and databases doing all the work. I actually use the size of a vibe.d application (2mb) to my advantage to produce a plugin that will overload certain requests on the client's computer (via a windows service or launchd daemon and reverse proxy). This allows much more extensive use of local resources, which is really untapped way of developing web applications at the moment, it really lets your imagination fly. Would you care to give a bit more colour on this? Sounds very interesting. So you have an executable running on client machine that they need to download and install (fine for a corporate internal application, I guess)? And then you serve your application locally, or from a combination of server and local url paths? I can't share source but the idea is simple. You configure a DNS subdomain my.domain.com = 127.0.0.1, and test that address with javascript when a logins to the public website, if it doesn't work you show a message plugin required. The user downloads the plugin and executes it, an elevation request is asked once for the exec to copy itself to program files and to register the service/daemon or open it (the only user interaction required!), and then the page is opened in a new browser window (borderless) or he can also refresh the page. The plugin's reverse proxy delivers the AngularJs app that uses Json models to populate the templates. The important part is this: Any routes registered in the redistributable app will be prioritized over the reverse proxy (if the reverse proxy was registered after them). The reason this works is, vibe.d calls the routes by the order that they were registered, up until the HTTP header is written. This simple but effective architecture is robust even for public applications. If you don't do any code signing, you might have an additional popup before you can open it but that's it. The packed executable can be as low as 2mb You can also have a long polling task to check for file updates and let the executable replace itself / restart itself. It's all around fun and games :)
Re: D Web Services Application Potential?
On Wednesday, 29 July 2015 at 14:30:49 UTC, Sebastiaan Koppe wrote: On Wednesday, 29 July 2015 at 13:22:43 UTC, Etienne Cimon wrote: I actually use the size of a vibe.d application (2mb) to my advantage to produce a plugin that will overload certain requests on the client's computer (via a windows service or launchd daemon and reverse proxy). This allows much more extensive use of local resources, which is really untapped way of developing web applications at the moment, it really lets your imagination fly. That is very interesting. But how do you push those apps to the end-users without interrupting their browser experience? You have to make them download the app and agree to elevate. It's not going to be useful for content-based websites, but it definitely has potential in areas where a download would've/could've been necessary anyways e.g. music/video/image editing, phone calls, file sharing, productivity, games, etc. It really depends on how appealing it makes your application. If your offer beats competition by far, a download won't be regarded as disruptive.
Re: D Web Services Application Potential?
On Thursday, 30 July 2015 at 00:08:52 UTC, Brandon Ragland wrote: A downloaded plugin, would be a man-in-the-middle solution. Users get there google search away and developers get the necessary native speed, flexibility, and components necessary to perform better work. The browser is a stellar user-interface engine. Certainly better than GTK+ or MFC by a long shot. I just don't think the browser is a useful *operating system* for all these web apps that should be native. There's been lots of improvements in the DOM, those slick CSS3 transitions are actually hardware accelerated with OpenGL, lots of GUI front-ends don't event have transitions in the first place. I wouldn't rely on Javascript for crunching data though, the slowness you talk about? Mostly stems from that. Otherwise, for display, it certainly is a great tool with lots of open source components. Just look at this data table with 640k rows: http://ui-grid.info/docs/#/tutorial/404_large_data_sets_and_performance THAT is some good javascript, and it certainly beats what I've seen Excel do with sheets harboring 10x less data. While some are still blaming the hammer, I blame the person trying to hit the nail on the head with his eyes closed.
Re: D Web Services Application Potential?
On Wednesday, 29 July 2015 at 11:06:03 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 29 July 2015 at 10:39:54 UTC, yawniek wrote: sorry typo. i meant we now can have statefull apis. Ok, then I get it. ;) and i disagree on the limited usefulness. do you have REST api in native apps? i don't see much reason why we should not develop web applications the way we develop native apps. The goal should be to keep the server-side simple, robust, transactional and generic. Then push all the fickle special-casing to the client side. Why do work on the server when you can do almost everything on the client, caching data in Web Storage/IndexedDB? There's a really minimal amount of code on web servers nowadays with javascript frameworks and databases doing all the work. I actually use the size of a vibe.d application (2mb) to my advantage to produce a plugin that will overload certain requests on the client's computer (via a windows service or launchd daemon and reverse proxy). This allows much more extensive use of local resources, which is really untapped way of developing web applications at the moment, it really lets your imagination fly.
Re: D Web Services Application Potential?
On Wednesday, 29 July 2015 at 00:12:21 UTC, Brandon Ragland wrote: For actual web applications, and front-end development currently done in your more traditional languages, D could be used, in a style similar to Java's JSP, JSTL, and EL. Just without the notion of scripts in the pages themselves, as this would mean writing an on-the-fly interpreter, or compiling whole pages, which surely isn't an option for a compiled performant language; if we want it to be readily adapted. Apologizes if I jumped around a lot, and misspelled. More difficult than I thought typing from my phone. Most developers nowadays are having a lot of success building web apps with an AngularJS MVC Vibe.d, rather than rendering the page entirely from the back-end. Heck, they can even build android or ios native apps with this architecture (see Ionic framework). So I think this makes more sense than rendering pages in the back-end, even if most legacy web stuff did that.
Re: D Web Services Application Potential?
On Wednesday, 29 July 2015 at 01:23:54 UTC, Etienne Cimon wrote: Most developers nowadays are having a lot of success building web apps with an AngularJS MVC Vibe.d, rather than rendering Sorry, I meant with an AngularJS MVC Web services
Re: std.data.json formal review
On Tuesday, 28 July 2015 at 18:45:51 UTC, Sönke Ludwig wrote: Am 28.07.2015 um 17:19 schrieb Etienne Cimon: On Tuesday, 28 July 2015 at 14:07:19 UTC, Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila This is cool: https://github.com/s-ludwig/std_data_json/blob/aac6d846d596750623fd5c546343f4f9d19447fa/source/stdx/data/json/value.d#L183 I was getting tired of programmatically checking for null, then checking for object type, before moving along in the object and doing the same recursively. Not quite as intuitive as the optional chaining ?. operator in swift but it gets pretty close https://blog.sabintsev.com/optionals-in-swift-c94fd231e7a4#5622 An idea might be to support something like this: json_value.opt.foo.bar[2].baz or opt(json_value).foo.bar[2].baz opt (name is debatable) would return a wrapper struct around the JSONValue that supports opDispatch/opIndex and propagates a missing field to the top gracefully. It could also keep track of the complete path to give a nice error message when a non-existent value is dereferenced. I like it quite well. No, actually, a lot. Thinking about it some more... this could end up being the most convenient feature ever known to mankind and would likely push it towards a new age of grand discoveries, infinite fusion power and space colonization. Lets do it
Re: std.data.json formal review
On Tuesday, 28 July 2015 at 15:07:46 UTC, Rikki Cattermole wrote: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Right now, my view is no. Unless there is some sort of proof that it will work with allocators. I have used the code from vibe.d days so its not an issue of how well it works nor nit picky. Just can I pass it an allocator (optionally) and have it use that for all memory usage? After all, I really would rather be able to deallocate all memory allocated during a request then you know, rely on the GC. I totally agree with that, but shouldn't it be consistent in Phobos? I don't think it's possible to make an interface for custom allocators right now, because that question simply hasn't been ironed out along with std.allocator. So, anything related to allocators belongs in another thread imo, and the review process here would be about the actual json interface
Re: std.data.json formal review
On Tuesday, 28 July 2015 at 14:07:19 UTC, Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila This is cool: https://github.com/s-ludwig/std_data_json/blob/aac6d846d596750623fd5c546343f4f9d19447fa/source/stdx/data/json/value.d#L183 I was getting tired of programmatically checking for null, then checking for object type, before moving along in the object and doing the same recursively. Not quite as intuitive as the optional chaining ?. operator in swift but it gets pretty close https://blog.sabintsev.com/optionals-in-swift-c94fd231e7a4#5622
Re: std.data.json formal review
On Tuesday, 28 July 2015 at 15:55:04 UTC, Brad Anderson wrote: On Tuesday, 28 July 2015 at 15:07:46 UTC, Rikki Cattermole wrote: On 29/07/2015 2:07 a.m., Atila Neves wrote: Start of the two week process, folks. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ Atila Right now, my view is no. Just a reminder that this is the review thread, not the vote thread (in case anyone reading got confused). Unless there is some sort of proof that it will work with allocators. I have used the code from vibe.d days so its not an issue of how well it works nor nit picky. Just can I pass it an allocator (optionally) and have it use that for all memory usage? After all, I really would rather be able to deallocate all memory allocated during a request then you know, rely on the GC. That's a good point. This is the perfect opportunity to hammer out how allocators are going to be integrated into other parts of Phobos. From what I see from std.allocator, there's no Allocator interface? I think this would require changing the type to `struct JSONValue(Allocator)`, unless we see an actual interface implemented in phobos.
Re: D Web Services Application Potential?
On Sunday, 26 July 2015 at 03:04:21 UTC, Brandon Ragland wrote: On Sunday, 26 July 2015 at 02:53:12 UTC, Etienne Cimon wrote: On 2015-07-25 22:35, Brandon Ragland wrote: On Sunday, 26 July 2015 at 00:46:58 UTC, Etienne Cimon wrote: [...] In relation to DDB: Have you seen: https://github.com/buggins/ddbc It's most similar to the JDBC driver in Java. Currently supports MySQL, PostgreSQL and SQLite. That might be a good starting point to expand the SQL driver support for a web framework. I dug around some of your repos, too early to comment but I'll sift through more of it as time allows, see if I can't offer anything towards your current goals in the near future. I fully agree that D would be a great fit for web development. Thanks for the reply. Yes, the goal is to avoid libpq. A typical Vibe.d TCP Connection is based on what you know as Green Threads, it's called Tasks/Fibers in D. It means you have to avoid any library that uses thread-blocking I/O because you're using 1 thread to handle all requests. That would make sense then. Was unaware vibe.d was using green threading. The JVM dropped green threads circa 1.2, a long time ago. I suppose the complexity of asynchronous I/O was never implemented to avoid these blocking issues with fibers/tasks? There's a way to avoid the blocking by spawning more threads (through worker tasks), but it's so much more efficient to use native protocol implementations. After all, this is how D and vibe.d can get the most req/s compared to the other native frameworks. Somebody took the time to write a very elaborate standoff and it shows a pretty accurate picture of it: https://atilanevesoncode.wordpress.com/2013/12/05/go-vs-d-vs-erlang-vs-c-in-real-life-mqtt-broker-implementation-shootout/
Re: D Web Services Application Potential?
On 2015-07-25 18:47, Brandon Ragland wrote: Hi All, Not entirely certain if there is a decent D web applications server implementation as of yet, but if there is a project going on, I'd love to have a gander. On the off-chance there isn't one, who would be interested in going at it, call it, a 'group' project. I've been yearning for a D web app server for a while, as most of my day to day work is done on Java EE containers (think Glassfish, Weblogic, etc. Java Beans, lalala) and the insane system usage has bothered me from day one. There's Wt for C++, although I don't see much coming from that, though the concept is grand. Rust has a few up and coming web server frameworks as well. D could really excel here. -Thoughts? Am I crazy (probably)? Not crazy. I've been working towards exactly that as hard I could (see on https://github.com/etcimon/), seeing how D would be the best language to write any web backend with. I've since worked on writing all the architecture in D: a new TLS library Botan, along with libhttp2 for HTTP/2 support and an async event loop (TCP/UDP/FileSystem/FileWatcher/DNS/Timers) library. I've written all the glue code to have it in the vibe.d framework and tested it as thoroughly as I could. I now consider it an achievement and use it in my web applications. I'm currently concentrating on improving an async postgresql driver called DDB and adding transactions, Json, TLS, Listen/Notify, etc. I think my next priority would be to rewrite the back-end of http://www.cosmocms.org with D and the vibe.web.web Web Interface, and Redis+Postgresql (sessions in redis). It's about 4k-5k LOC I think a good and necessary library would be for cross-platform, async DNS. I've been looking at this one in particular: https://github.com/miekg/dns
Re: D Web Services Application Potential?
On 2015-07-25 22:35, Brandon Ragland wrote: On Sunday, 26 July 2015 at 00:46:58 UTC, Etienne Cimon wrote: On 2015-07-25 18:47, Brandon Ragland wrote: Hi All, Not entirely certain if there is a decent D web applications server implementation as of yet, but if there is a project going on, I'd love to have a gander. On the off-chance there isn't one, who would be interested in going at it, call it, a 'group' project. I've been yearning for a D web app server for a while, as most of my day to day work is done on Java EE containers (think Glassfish, Weblogic, etc. Java Beans, lalala) and the insane system usage has bothered me from day one. There's Wt for C++, although I don't see much coming from that, though the concept is grand. Rust has a few up and coming web server frameworks as well. D could really excel here. -Thoughts? Am I crazy (probably)? Not crazy. I've been working towards exactly that as hard I could (see on https://github.com/etcimon/), seeing how D would be the best language to write any web backend with. I've since worked on writing all the architecture in D: a new TLS library Botan, along with libhttp2 for HTTP/2 support and an async event loop (TCP/UDP/FileSystem/FileWatcher/DNS/Timers) library. I've written all the glue code to have it in the vibe.d framework and tested it as thoroughly as I could. I now consider it an achievement and use it in my web applications. I'm currently concentrating on improving an async postgresql driver called DDB and adding transactions, Json, TLS, Listen/Notify, etc. I think my next priority would be to rewrite the back-end of http://www.cosmocms.org with D and the vibe.web.web Web Interface, and Redis+Postgresql (sessions in redis). It's about 4k-5k LOC I think a good and necessary library would be for cross-platform, async DNS. I've been looking at this one in particular: https://github.com/miekg/dns In relation to DDB: Have you seen: https://github.com/buggins/ddbc It's most similar to the JDBC driver in Java. Currently supports MySQL, PostgreSQL and SQLite. That might be a good starting point to expand the SQL driver support for a web framework. I dug around some of your repos, too early to comment but I'll sift through more of it as time allows, see if I can't offer anything towards your current goals in the near future. I fully agree that D would be a great fit for web development. Thanks for the reply. Yes, the goal is to avoid libpq. A typical Vibe.d TCP Connection is based on what you know as Green Threads, it's called Tasks/Fibers in D. It means you have to avoid any library that uses thread-blocking I/O because you're using 1 thread to handle all requests.
Re: Where will D sit in the web service space?
On Friday, 24 July 2015 at 16:57:04 UTC, Joakim wrote: On Friday, 24 July 2015 at 14:50:23 UTC, Ola Fosheim Grøstad wrote: ART. Of course Metal isn't general-purpose, nobody said it is, but I don't see why you'd say Swift isn't. Swift is clearly designed around Objective-C and Cocoa. Oh, and I didn't respond to this because I didn't even know what you meant, think I got it now. You're now saying Swift isn't general-purpose simply because it's initially designed around Apple's Cocoa OS APIs? Being tied to a single platform doesn't make a language any less general-purpose, and since they announced that they're open-sourcing Swift later this year, it will be ported to other platforms, just as Obj-C has. Apple has become such a taboo subject. They've invested so much on subconscious gratifications that nobody can discuss the company objectively. I mean, Swift is general purpose because the holy masters of computer culture want to open source it, and open source can become general purpose, right? Eh..
Re: Where will D sit in the web service space?
On Thursday, 23 July 2015 at 17:03:31 UTC, Laeeth Isharc wrote: But some of us think general-purpose, native languages are coming back, Yes. Now why do you think this is the case? I tried to articulate it as best I could for now, but Ola has all these _reasons_ why this isn't the case, which may mean he is right, but might not. Native languages are more efficient, they use less power. This is increasingly important to reduce the greenhouse gas emissions, to improve battery duration on mobile devices or to reduce server costs in general. The language design is also more modern, the compile times shorter, the errors more comprehensible, which makes interpreted languages less appealing for those who care about learning the alternatives. The gap in complexity is closing up. Finally, I answered an interview in This week in D about how I thought D in general had an excellent way to bind multiple components together, from other languages, thus making it not only general purpose but also a glue, a centralized hub from which every team can build its interface on top of, whichever technology is used. After all, it was developed very late in the language wars with clear attempts to open itself up to the legacy software left behind by other languages.
Re: Dangular - D Rest server + Angular frontend
On Sunday, 19 July 2015 at 19:54:31 UTC, Jarl André Hübenthal wrote: Hi I have created a personal project that aims to learn myself more about D/vibe.d and to create a simple and easy to grasp example on Mongo - Vibe - Angular. Nice ! I'm also working on a project like this, using some paid angularjs admin template from themeforest, although I'm powering it with Vibe.d / Redis and PostgreSQL 9.4 with its new json type. controllers, but it works as a bootstrap example. I am thinking to create another view that uses ReactJS because its much much more better than Angular. ReactJS has been very promising and I hear a lot of hype around it. However I believe Angular lived through its hype and is now more mature in plenty of areas, for example its Ionic framework for cross-mobile apps is reaching its gold age with seemingly fluid performance on every device! With vibe.d being a cross-platform framework, you'd be even able to build a Web Application that communicates with a client-side OS API, effectively closing the gap between web dev and software dev. So, there is two structs, but I really only want to have one. Should I use classes for this? Inheritance? Vibe.d is famous for its compile-time evaluation, understanding structures like with reflection but producing the most optimized machine code possible. You won't be dealing with interfaces in this case, you should look at the UDA api instead: http://vibed.org/api/vibe.data.serialization/. For example, if your field might not always be in the JSON, you can mark it @optional. struct PersonDoc { @optional BsonObjectID _id; ulong id; string firstName; string lastName; } You can also compile-time override the default serialization/deserialization instructions for a struct by defining the function signatures specified here: http://vibed.org/api/vibe.data.json/serializeToJson or the example here: https://github.com/rejectedsoftware/vibe.d/blob/master/examples/serialization/source/app.d This being said, your questions are most likely to be answered if you ask at http://forum.rejectedsoftware.com
Re: Where will D sit in the web service space?
On Saturday, 18 July 2015 at 14:13:29 UTC, rsw0x wrote: On Saturday, 18 July 2015 at 14:07:30 UTC, Etienne Cimon wrote: We're done with desktop UI. The problem domain has shifted with SPA (single page applications) revolution on the web and angularjs. yep, and it's the reason I can't load a 'modern' web page without it bringing my 16 core xeon server to a 4-5 second stop. we've gone backwards. I've seen a linear search do that in C. I admit that most js coders are bad, but people still find google docs practical. What's your point?
Re: Where will D sit in the web service space?
On Saturday, 18 July 2015 at 11:19:45 UTC, Ola Fosheim Grøstad wrote: StackOverflow has become the de-facto documentation resource for software engineers. It saves me insane amounts of time, many other programmers say the same thing. Google has been known to shut down it's own support-forums in order to get higher activity on StackOverflow. StackOverflow is an excellent resource, I've had trouble finding answers on it for D though because the D.learn forums contain all the QA. I wish we could mirror those on stack overflow or even channel it there instead. We're stuck in the 90's using NNTP+forums. I see basically 4 reasons to use languages like C++/D/Rust: 1. Low level hardware/OS access 2. Throughput 3. Lowered memory usage 4. Detailed control over execution patterns. We're done with desktop UI. The problem domain has shifted with SPA (single page applications) revolution on the web and angularjs. Nothing is as elegant and completely featured like D in the natively compiled world. I say natively, because that's the only way to resolve the interpreter war, seeing your interpreter banned just like firefox did you flash. Other languages have too much legacy to carry or have started with the wrong language design and will be eventually dropped just like lisp and perl. WebRTC, bitcoins and torrenting have only scratched the surface for future web applications. I can guarantee you that there will be an era where desktop applications are p2p downloaded, installed, displayed on in a browser and all resources shared over p2p. Browsers will never be appropriate because it will always have to slow down the applications and filter everything for security. With time, over the years, we will see these primitives being developed and the world will turn to the language that allows them to accomplish this, because it will be the only solution to web neutrality.
Re: Where will D sit in the web service space?
On Saturday, 18 July 2015 at 15:11:30 UTC, Ola Fosheim Grøstad wrote: However, I currently don't see much advantage in having the same language on client and server, so I'll probably stick to TypeScript/Dart, Angular2/Polymer in the near future because of debugging and tooling. I think these are very good choices. I prefer to really invest in learning and developing on D simply because the resulting code is more easily redistributable, because you get more bang for the buck when optimizing it, because the developers are generally better coming from the C++ world and being hobbyists, etc. And also, D is more promising. A lot of things can happen to deprecate Dart, or TypeScript development completely. Nobody/nothing's ever going to deprecate D, if anything you'll only see the smarter devs being less afraid to pick it up and bring it further. over p2p. Browsers will never be appropriate because it will always have to slow down the applications and filter everything for security. IMHO: In the long term time consuming tasks might be offloaded to some simplified replacement for OpenCL. I was talking more about being able to operate a website or web application that has been censored or sabotaged. If something happens in the coming years to the free web as we know it, people will have to turn to custom computer programs and p2p to help open up their web services. I'm not talking about the NSA censoring stuff. I'm talking about companies being anti-competitive. This seems to be becoming more and more likely as they (Godaddy, Google, Mozilla, Facebook, Amazon, Apple, Microsoft, Oracle, ISPs etc) become greedy and start to play rough with each-other and newcomers, using security as an excuse. It can way too easy to flip the switch on a website or technology (eg the flash player incidents over the years). The only solution I see is to stop relying on them so much!
Re: Where will D sit in the web service space?
On Saturday, 18 July 2015 at 18:56:52 UTC, Ola Fosheim Grøstad wrote: On Saturday, 18 July 2015 at 18:51:01 UTC, rsw0x wrote: On Saturday, 18 July 2015 at 18:49:04 UTC, Ola Fosheim Grøstad wrote: On Saturday, 18 July 2015 at 16:55:23 UTC, Etienne Cimon wrote: [...] Btw, just found about this: https://github.com/dart-lang/dev_compiler/blob/master/STRONG_MODE.md Basically a typed subset of Dart that transpiles to clean Javascript (EcmaScript6). Not finished and production ready, but might be interesting to see if there is any help in there for transpiling other languages to Javascript. I thought dart already had a dart-js compiler? Yes, but the output is unreadable. Currently you develop for Dart by using a special version of Chromium with a Dart VM. Then compile to JS for release (with source map support, so you can still debug to some degree). I wanted to develop the front end with dart but the final Js size ended up being too large and I evaluated that grunt and bower with webstorm are relatively more mature environments at the moment. I really do accept that these dev environments might change frequently at that level though, and I'm satisfied by the stability outlooks of D and underlying databases which make up for it.
Re: Where will D sit in the web service space?
On Monday, 13 July 2015 at 12:06:25 UTC, Márcio Martins wrote: D is a great language, but in my opinion, it's ecosystem as a whole is not mature enough for serious development on a large scale. I think it's growing at a fast enough pace now that people can feel safe to invest their time and join/contribute to the ecosystem. Talking for myself, I like to be part of something that grows positively and incrementally where I can make a difference. A lot of other communities have many libraries and many community members but are stuck on performance/efficiency bottlenecks due to language design, nobody has the power to change it, and here we are with the solution in vibe.d, where the D community in general will probably not see this until decades from here.
Re: Where will D sit in the web service space?
On Sunday, 12 July 2015 at 12:14:31 UTC, Ola Fosheim Grøstad wrote: I've been thinking a bit about where languages fit in the web service space. Both mobile app and web services are likely candidates for typed and efficient languages. I'm not at all happy with the prolific choices that are available. Yet, D is currently not in a strong position for mobile apps or web servers. So what does the competition look like? [...] For me at least, D has a lot more to offer because with the recent developments in vibe.d, it's the only language that offers the opportunity to write portable Web applications in the true sense, ie. The user interface being in a browser, the backend being a natively compiled service in the computer. With a 2 megabytes packed PE that is. It may not seem useful, but to me it's revolutionary. Javascript user interfaces on the desktop are a very good replacement for the traditional GUI, and absolutely cross platform. I see nothing I need in other frameworks that I can't offer myself in D. We're already on top and we don't know it yet
Re: Where will D sit in the web service space?
On Sunday, 12 July 2015 at 21:13:35 UTC, Ola Fosheim Grøstad wrote: On Sunday, 12 July 2015 at 20:36:26 UTC, Etienne Cimom wrote: backend being a natively compiled service in the computer. With a 2 megabytes packed PE that is. It may not seem useful, but to me it's revolutionary. What is PE? The idea here is a portable executable (PE), in vibe.d, as a service with daemonize, that compiles packed to 2MB with TLS and a single TCP link using HTTP/2. I haven't tried Golang but I'm sure if I did it would be a close call. The lack of template meta-programming / generics makes it much less convenient to use though, so it's no go for me :) C++ could also do it if a framework existed for it, but even then, the language isn't as safe/convenient. So, I guess D wins here where a simple dub build with the right packages will dump a nice executable with everything you need for a desktop webUI application.
Re: goroutines vs vibe.d tasks
On Wednesday, 1 July 2015 at 18:09:19 UTC, Mathias Lang wrote: On Tuesday, 30 June 2015 at 15:18:36 UTC, Jack Applegame wrote: Just creating a bunch (10k) of sleeping (for 100 msecs) goroutines/tasks. Compilers go: go version go1.4.2 linux/amd64 vibe.d: DMD64 D Compiler v2.067.1 linux/amd64, vibe.d 0.7.23 Code go: http://pastebin.com/2zBnGBpt vibe.d: http://pastebin.com/JkpwSe47 go version build with go build test.go vibe.d version built with dub build --build=release test.d Results on my machine: go: 168.736462ms (overhead ~ 68ms) vibe.d: 1944ms (overhead ~ 1844ms) Why creating of vibe.d tasks is so slow (more then 10 times)??? In your dub.json, can you use the following: subConfigurations: { vibe-d: libasync }, dependencies: { vibe-d: ~0.7.24-beta.3 }, Turns out it makes it much faster on my machine (371ms vs 1474ms). I guess it could be a good thing to investigate if we can make it the default in 0.7.25. I don't benchmark my code frequently, but that's definitely flattering :) I hope we can see a release LDC 2.067.0 soon so that I can optimize the code further. I've given up on 2.066 a while back
Re: Announcing libasync, a cross-platform D event loop
On Sunday, 28 June 2015 at 15:09:25 UTC, Suliman wrote: On Saturday, 27 September 2014 at 18:21:18 UTC, Etienne wrote: On 2014-09-27 2:13 PM, Etienne wrote: engine (I have an ASN1 library in the works as well). It's nearly finished, it will allow BER/DER serialization to take place from UDAs and native types at compile-time: https://github.com/globecsys/asn1.d /// Usage: run() the object, start watching directories, receive an event in your handler, /// read the changes by draining the buffer. Could you show how to use it for monitoring FS? I did import libasync.watcher; So now I need simply call run()? But how to pass folder path to it? void main() { bool run() { return 0; } } It's seems that I missing something... You can see an example in libasync.tests
Re: Announcing libasync, a cross-platform D event loop
On Sunday, 28 June 2015 at 16:32:24 UTC, Suliman wrote: You can see an example in libasync.tests thanks! I have got few questions g_cbCheck = new shared bool[19]; what does it do? AsyncDirectoryWatcher g_watcher = new AsyncDirectoryWatcher(getThreadEventLoop()); Am I right understand that it's run new eventloop inside AsyncDirectoryWatcher function? The g_cbCheck is specific to this unit test, everytime a callback succeeds it will set its index to true in the array. The event loop must be passed to the async object because the watcher will register itself to it when it is run. When you've registered your callback in the watcher and run it through the event loop, you have to run the event loop and events will be pushed to your callback
Re: Announcing libasync, a cross-platform D event loop
On Sunday, 28 June 2015 at 16:57:44 UTC, Suliman wrote: Also next code that I take from example after run absolutely do not do nothing: This code will register a directory watcher in the working directory, on the thread's event loop, and then use timers to create file/folder activity to trigger this directory watcher. The only thing needed to make this work is r/w access to the working directory and a running event loop. So, adding the line: g_evl.run(10.seconds); If you don't have an event loop running, your application is basically not going to receive callback events.
Re: Announcing libasync, a cross-platform D event loop
On Sunday, 28 June 2015 at 17:10:16 UTC, Etienne Cimon wrote: g_evl.run(10.seconds); Hmm, sorry that would be g_evl.loop(10.seconds) or getThreadEventLoop().loop(10.seconds). I use the vibe.d driver most often.
Re: Heisenbug involving Destructors GC - Help Needed
On Tuesday, 30 June 2015 at 17:10:41 UTC, Steven Schveighoffer wrote: On 6/30/15 10:04 AM, Etienne wrote: I don't think there's a problem with destroy in the first place. The problem is that it's being advertised as calling the destructors: It does for value types and for class references. -Steve Yeah well the types that don't get finalized by it need to be listed somewhere
Re: Announcing libasync, a cross-platform D event loop
On Tuesday, 30 June 2015 at 04:38:31 UTC, suliman wrote: Ok, but code still do exit after it's run. Look like loop is not started Yes, you need to watch for the return type which will be false in case of error while(getThreadEventLoop().loop(10.seconds)) continue; writeln(getThreadEventLoop().error);
Re: Heisenbug involving Destructors GC - Help Needed
On Tuesday, 30 June 2015 at 14:04:45 UTC, Etienne wrote: On Tuesday, 30 June 2015 at 13:01:46 UTC, Steven Schveighoffer wrote: [...] I don't think there's a problem with destroy in the first place. The problem is that it's being advertised as calling the destructors: http://dlang.org/library/object/type_info.destroy.html http://dlang.org/library/object/destroy.html The function would need a documentation section itself, since it's being advertised as a replacement for `delete` and expected to do the same wherever there's something to read about it. We probably just need a new page in the `D Reference` about Lifetime. Documenting the general behavior and good practices of anything that manages lifetime, e.g. malloc, free, delete, destroy, new, pointers, classes, base types, etc.
Re: Heisenbug involving Destructors GC - Help Needed
On Tuesday, 30 June 2015 at 13:01:46 UTC, Steven Schveighoffer wrote: On 6/26/15 11:38 PM, Brian Schott wrote: On Saturday, 27 June 2015 at 03:16:35 UTC, rsw0x wrote: calling destroy on a pointer should either be fixed or be an error, that should not be allowed to happen. Completely agreed. Calling destroy() on a pointer has been incorrect EVERY time I've seen it done. I'd say if you want to see cases where it was done correctly, change the behavior and watch the complaints come in ;) Wouldn't destroying the pointer target make an assumption about ownership? Consider a struct that contains a pointer: struct S { T *x; } destroy's algorithm for this struct is to call destroy on all of the members, then set to S.init. But what if S is just *referencing* that T, and doesn't *own* it? Isn't this the wrong thing to do? I agree it's inconsistent with class references. How to make it consistent isn't as easy to decide. For me, it's the class destruction which is incorrect. Consider that destroy is consistent with scope destruction for every type except for classes: class C {} struct S {} { C c = new C; S s; S *s2 = new S; } // calls s.dtor, does not call c.dtor or s2.dtor And what about arrays? Should calling destroy on an array call destroy on all of the elements (it currently doesn't)? If I were to design destroy from scratch, I'd make destroy, and destroyRef (which destroys referenced data via pointer or class). -Steve I don't think there's a problem with destroy in the first place. The problem is that it's being advertised as calling the destructors: http://dlang.org/library/object/type_info.destroy.html http://dlang.org/library/object/destroy.html The function would need a documentation section itself, since it's being advertised as a replacement for `delete` and expected to do the same wherever there's something to read about it.
Re: Announcing libasync, a cross-platform D event loop
On Sunday, 28 June 2015 at 19:34:46 UTC, Suliman wrote: void main() { void dirWatcher() { auto g_watcher = new AsyncDirectoryWatcher(getThreadEventLoop()); g_watcher.run({ DWChangeInfo[1] change; DWChangeInfo[] changeRef = change.ptr[0..1]; while(g_watcher.readChanges(changeRef)){ writeln(change); } }); g_watcher.watchDir(.); getThreadEventLoop(); } dirWatcher(); //destroyAsyncThreads(); } Is this code enough to monitoring folder? If I run it it's terminating, it's seems that eventloop not starting or I placed it in wrong place? You should do getThreadEventLoop().loop(); and it will monitor the changes forever. Try making changes in the filesystem manually :)
Re: Announcing libasync, a cross-platform D event loop
On Sunday, 28 June 2015 at 18:33:28 UTC, Suliman wrote: Hmm, sorry that would be g_evl.loop(10.seconds) or getThreadEventLoop().loop(10.seconds). I use the vibe.d driver most often. I changed paths to hardcoded to prevent issue with them, but next code after run only create hey folder and nothing more. No files in it: Try putting the timers outside the callbacks in the meantime. I'll test it tomorrow when I'm at the office =) -- And how to detect if some there was some manipulation inside monitoring folder? How I can recive name of file that was added to folder? There's a path in the DWFileChange change structure, you can access it with change.path. You'll have to put it in a path parser to access the filename, such as std.path
Re: Announcing libasync, a cross-platform D event loop
On Monday, 29 June 2015 at 20:34:11 UTC, Suliman wrote: Ehm, there is issue on Windows or I am again doing something wrong? void main() { void dirWatcher() { auto g_watcher = new AsyncDirectoryWatcher(getThreadEventLoop()); g_watcher.run({ DWChangeInfo[1] change; DWChangeInfo[] changeRef = change.ptr[0..1]; while(g_watcher.readChanges(changeRef)){ writeln(change); } }); g_watcher.watchDir(.); getThreadEventLoop().loop(); } dirWatcher(); destroyAsyncThreads(); } Without destroyAsyncThreads(); it's fail with exception. Yes that line is required
Re: Question about Walter's Memory DisAllocation pattern
On 2015-06-27 01:06, thedeemon wrote: On Saturday, 27 June 2015 at 03:10:51 UTC, Etienne Cimon wrote: What you're asking for is probably type inference. Notice the auto return type? This keyword is actually very advanced and bleeding edge in natively compiled languages. Inference of return type was in ML since 1973. Such bleeding, so edge. ;) Is there some other natively compiled language that implemented the auto keyword before? Or are you only talking about the theory?
Re: Heisenbug involving Destructors GC - Help Needed
On Saturday, 27 June 2015 at 12:28:26 UTC, Kagamin wrote: On Friday, 26 June 2015 at 18:27:34 UTC, Maxime Chevalier-Boisvert wrote: I seem to have run into a heisenbug involving destructors and the GC. I'm kind of stuck at this point and need help tracking down the issue. BTW, how GC performance is doing? Etienne is experimenting with thread local GC: http://forum.dlang.org/post/nfuzudyoatryapcwx...@forum.dlang.org which also proved to be faster. But only if single-threaded GC is good enough for you, which normally should be given single-threaded model of javascript. The new keyword can leverage the shared keyword to place certain objects in a shared GC, which can coexist with the local GC without fundamental changes. ie std.concurrency already requires that you pass shared objects, but casting won't cut it anymore you'll actually have to duplicate the object on the shared GC with .sdup or create it there with new shared. I don't need a shared GC right now so I'm not pushing too much for it, I'm satisfied with keeping a pointer of the object alive in the thread it was created and that's all a thread local GC really requires for concurrency to work
Re: Heisenbug involving Destructors GC - Help Needed
On 2015-06-26 14:27, Maxime Chevalier-Boisvert wrote: I seem to have run into a heisenbug involving destructors and the GC. I'm kind of stuck at this point and need help tracking down the issue. I put the broken code in a branch called heisenbug on github: https://github.com/higgsjs/Higgs/tree/heisenbug The problem manifests itself on runs of `make test` (my unittests), but only some of the time. I wrote a script to run `make test` repeatedly to try and find a solution: https://github.com/higgsjs/Higgs/blob/heisenbug/source/repeatmaketest.py The problem usually manifests itself after 5 to 15 runs on my machine. I get a segmentation fault, not always in the same place. The randomness seems to stem from address space randomization. It seems the issue is caused by my freeing/reinitializing the VM during unit tests. More specifically, commenting out this line makes the problem go away: https://github.com/higgsjs/Higgs/blob/heisenbug/source/runtime/vm.d#L741 Higgs can run all of my benchmarks without ever failing, but restarting the VM during `make test` seems to be causing this problem to happen. It's not impossible that there could be another underlying issue, such as the JITted code I generate corrupting some memory location, but it would seem that if this were the case, the issue would likely show up outside of unit tests. Any help would be appreciated. This might come as a surprise to you as much as it did to me at the time, but when you have GCRoot* root; where GCRoot is a struct, if you destroy(root), you're setting your local pointer to null. You're not actually calling the destructor on the struct. Also, I would avoid throwing of any type in a destructor. https://github.com/higgsjs/Higgs/blob/0b48477120c4acce46a01b05a1d4b035aa432550/source/jit/codeblock.d#L157
Re: Question about Walter's Memory DisAllocation pattern
On 2015-06-26 22:45, Parke via Digitalmars-d wrote: Hi, I have a question about Walter's DConf keynote and the Memory DisAllocation pattern. http://dconf.org/2015/talks/bright.html The following example is from the slides of Walter's talk. auto toString(uint u) { static struct Result { this(uint u) { idx = buf.length; do { buf[--idx] = (u % 10) + '0'; u /= 10; } while (u); } @property bool empty() { return idx == buf.length; } @property char front() { return buf[idx]; } void popFront() { ++idx; } char[uint.sizeof * 3] buf; size_t idx; } return Result(u); } import std.stdio; void main() { writeln(toString(28)); } My question is: Does use of this pattern in D require that the size of the Result struct be known by the compiler at compile time? Or, perhaps more precisely: Does the caller of toString need to know the size of the struct that toString will return? In the above example, buf's length is uint.sizeof * 3. But what if buf's length was a function of u (and therefore only known at run-time), rather than a function of uint.sizeof? Thanks! -Parke What you're asking for is probably type inference. Notice the auto return type? This keyword is actually very advanced and bleeding edge in natively compiled languages. Internally, when the function is processed by the compiler, all types are evaluated before the instructions are even looked at, and the final size of all types are compiled and automatically put in place. Afterwards, the instructions must obey consistency, ie. the caller can't use anything but auto or ReturnType!toString to accept an auto type because there's no way you can guess the mangling/size/etc otherwise. This also means you can choose a ridiculous name or you can change the size of a stack allocated object any time without breaking an interface. e.g. you could change this without breaking the API to something like: auto toString(T)(T u) if (isNumeric!T) { static struct GenericResult { this(T u) { ... char[T.sizeof * 3] buf; ... }
Re: Heisenbug involving Destructors GC - Help Needed
On 2015-06-26 23:44, Temtaime wrote: Disagree. Destroy on a pointer calls dtor of a struct. Why it should be an error ? Exactly what I assumed too. Can you imagine all of the random errors that stem from such a basic, low-level assumption? I carry a scar for every day I've spent in the debugger, and this bug has given me its load of torments. Of course, I'm the only one to blame, I didn't know: import std.stdio; void main() { struct A { ~this() { writeln(Dtor); } } A* a = new A; destroy(a); writeln(Done); } output: Done
Re: PHP verses C#.NET verses D.
On Wednesday, 24 June 2015 at 05:34:08 UTC, Nick B wrote: On Tuesday, 23 June 2015 at 11:22:40 UTC, Etienne Cimon wrote: Nick I don't have current performance results because I've been focused on adding features, but these results were taken on a previous version: https://atilanevesoncode.wordpress.com/2013/12/05/go-vs-d-vs-erlang-vs-c-in-real-life-mqtt-broker-implementation-shootout/ Etienne Thanks for the responses and your details replies. I'm going to talk to the CEO of the company described, at the beginning of this long thread, and find out they are willing to consider a proof of concept web site based on your work. This could take a couple of weeks. What is the best way to get in touch with you if I have more questions ? Nick Skype: Etcimon or gmail the same username
Re: PHP verses C#.NET verses D.
On Tuesday, 23 June 2015 at 06:26:39 UTC, Nick B wrote: On Thursday, 18 June 2015 at 03:44:08 UTC, Etienne Cimon wrote: So now I can build a full web application/server executable in less than 2mb packed, and it runs faster than anything out there. Etienne Do you have an performance numbers, as to how fast your web application/server is, or is this based on your personal experience ? Nick I don't have current performance results because I've been focused on adding features, but these results were taken on a previous version: https://atilanevesoncode.wordpress.com/2013/12/05/go-vs-d-vs-erlang-vs-c-in-real-life-mqtt-broker-implementation-shootout/
Re: PHP verses C#.NET verses D.
On Monday, 22 June 2015 at 06:32:31 UTC, Nick B wrote: On Thursday, 18 June 2015 at 03:44:08 UTC, Etienne Cimon wrote: Etienne Would you like to detail what still needs to be completed/on the to-do list ? What would be the best way to learn it ? Does it need documentation as well ? Nick The docs should be the same as the ones on vibed.org As for the todo list, It's a little long to detail it. Depends also on where you want to go. Urgent: - Update libhttp2 and botan with recent changes from the original repos (nghttp2, botan). No stability issues, only new algorithms mostly. - Write a Windows/Mac/linux daemon utility with rights elevation to have support for desktop application development (currently finishing up windows) - The Mac daemon requires launchd, which compiles only with DMD pull request to be merged: https://github.com/D-Programming-Language/dmd/pull/4321 - Uses the http://diveframework.com/ to elevate - Test the live debugging features with third party applications (similar to packet-capturing but server-side). - This is completed and available on my fork of vibe.d and a reverse proxy request looks like this: http://htmlpreview.github.io/?https://github.com/etcimon/vibe.d/blob/master/views/capture.html = http://pastebin.com/raw.php?i=E51RXyt2 - Also includes json req/response or call stack in builds compiled with release - Try running with LDC and debug the libraries until everything completely compiles with it (2.067+) - Find a way to add a thread-local GC in druntime or at least make dub compile the projects with it. Less urgent: - Implement administration interface for the new redis 3.0 clustering feature - Write a DNS server with A-record scheduling for distribution - Adapt VibeDist to send requests to worker tasks - Add support for runtime loading of DLL plugins that auto-register/unregister to the router. - Test lua bindings to develop runtime themes I also have private application development on the todo list which ends up testing the library. Lots of testing is still needed but I think the server exceeds what I could make any other server do. It compiles in a single portable executable 2mb packed after all.
Re: Future(s) for D.
On Monday, 22 June 2015 at 19:45:57 UTC, Jacob Carlborg wrote: On 22/06/15 14:46, Etienne wrote: [...] [...] Seems I need to actually make a try on using these libraries. [...] In general I feel it hard to justify when everything is already implemented in Ruby. At some point I just want to use a language and the libraries without needing to reinvent the wheel. Back in 2006 when I started with D I had some idea for an application I wanted to build. But there were a lot of missing components (many still are), I still haven't started building that application. I can't really know how it would've been like back then. Today it looks like there might be a future in web dev for D, I'd think people are willing to invest their name on a library to be part of it.
Re: Future(s) for D.
On Monday, 22 June 2015 at 11:29:50 UTC, Jacob Carlborg wrote: On 22/06/15 01:43, Nick Sabalausky wrote: Curiosity, what libraries do you feel a lack of? For work, that would be: * Database drivers for Postgres and SQLite https://github.com/etcimon/d2sqlite3 async with vibe.d : https://github.com/pszturmaj/ddb/blob/master/examples/basic.d#L7 * ORM https://github.com/buggins/hibernated * Unit test framework. I want something like RSpec I always got around fine with unittest { } and some imagination * RabbitMQ and ActiveMQ C=D binding and register sockets in libasync? * Some way to interface with Selenium and PhantomJS You need to write the javascript to a file and use executeShell or pipeShell. I wanted to write a forward proxy in vibe.d though so that we can actually handle the headers/cookies and analyze the contents over the wire. I'm not sure if there's a language that does that already For non work related things it would also be: * Sass https://github.com/Lodin/sassed * CoffeeScript https://github.com/MartinNowak/diet-coffee/blob/master/source/diet_coffee.d#L23 * I would prefer HAML over that templates used in vibe.d but I guess there' close enough http://blog.seancarpenter.net/2013/05/24/using-haml-from-the-command-line/ You seem to be active member of the community. Why not attempt to solve those? Doesn't seem like it would take that long (all the primitives are there). @rikki I really do want to fix this. Unfortunately writing everything from a an actual webserver to the template live reloading is a lot harder then you'd think. Which is unfortunate. You should have everything you need to write a D version of Wordpress using its code as a reference. Maybe with vibe.d, putting the data in Redis and using some lua scripting for themes or configuration files. It would take some imagination but it's not at all impossible to achieve it.
Re: Future(s) for D.
On Monday, 22 June 2015 at 14:03:47 UTC, Laeeth Isharc wrote: On Monday, 22 June 2015 at 11:29:50 UTC, Jacob Carlborg wrote: On 22/06/15 01:43, Nick Sabalausky wrote: Curiosity, what libraries do you feel a lack of? For work, that would be: * Some way to interface with Selenium and PhantomJS It's not pretty, but for what I want to do I have found embedding Python calls to phantomjs code within a D program works quite well. The SQLite stuff looks okay, although I haven't used for a big project yet. This is how I use it as a persistent storage for property get/setters. Takes some imagination at first, but it saves a huge amount of time/headaches on the long run. /// Opens the SQLite database from the data folder. The user must call .close() when finished! Database openDB(bool read = true) { // DB is always created in static ctor return Database(DATA_FOLDER_PATH() ~ my.db, read ? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); } private T get(T)(string name, lazy T default_value = T.init) { Database sqlite = openDB(READ); scope(exit) sqlite.close(); T ret; try { auto results = sqlite.execute(SELECT value FROM config WHERE name=' ~ name ~ ';); auto val = results.oneValue!string; ret = val.to!T; } catch { ret = default_value; } return ret; } private void set(T)(string name, T value) { Database sqlite = openDB(WRITE); scope(exit) sqlite.close(); bool exists; try { ResultRange res = sqlite.prepare(SELECT value FROM config WHERE name=?;).bind(1, name).execute(); string val = res.oneValue!string; // will throw if the value is not there // Update the existing value. auto prep = sqlite.prepare(UPDATE TABLE config SET value=? WHERE name=?;).bind(1, name).execute(); prep.bind(1, value.to!string); res = prep.execute(); } catch { exists = false; } if (!exists) { auto res = sqlite.prepare(INSERT INTO config (name, value) VALUES (?, ?);).bind(1, name).bind(2, value.to!string).execute(); } } // usage: @property Duration created() { return get!ulong(created, 120).dur!seconds; } @property void created(Duration val) { set(created, val.total!seconds); }
Re: PHP verses C#.NET verses D.
On Sunday, 21 June 2015 at 03:16:31 UTC, Nick B wrote: On Friday, 19 June 2015 at 11:28:30 UTC, Etienne Cimon wrote: On Thursday, 18 June 2015 at 05:23:25 UTC, Nick B wrote: On Thursday, 18 June 2015 at 03:44:08 UTC, Etienne Cimon wrote: Will you explain how it is different to Vibe.d ? It has HTTP/2, a new encryption library, it uses a native TCP event library, lots of refactoring. In short, the entire thing is in D rather than linking with OpenSSL and libevent. Etienne Can you explain the benefits of writing these libraries in D, as against just linking to these libraries. Is it for faster execution, or better debugging, or some other reason ? When writing bindings, you need to write unit tests for your bindings and an interface. You're adding a layer of software with its own propensity for errors. You also don't have access to the underlying implementation in the IDE. You also can't add features to facilitate your own programs unless you control the repository. Honestly, I can't stand having layers and layers of garbage to make up for language differences. I like the cleanliness of it all and it probably ended up taking me half the time because I avoided debugging new code.
Re: Future(s) for D.
On Sunday, 21 June 2015 at 19:08:47 UTC, Jacob Carlborg wrote: On 20/06/15 16:00, Etienne wrote: Yep, looks like we already have better. I don't understand how D hasn't fully picked up in Web Dev at this point. Are they expecting an e-commerce/blogging/cms platform to go with it? My biggest reason is the lack of libraries. There's probably a lack of a Joomla/Wordpress/Magento platform in D with plugin support. Libraries would pour into D if there was a similar tool.
Re: Future(s) for D.
On Saturday, 20 June 2015 at 13:33:34 UTC, Dragos Carp wrote: On Saturday, 20 June 2015 at 12:35:11 UTC, weaselcat wrote: I recently read this facebook post on their future implementation in their Folly library. https://code.facebook.com/posts/1661982097368498 This made me slightly envious. Thoughts on a D implementation? Even if the callbacks are sequentially listed, the callback hell is still there. A better solution is to use fibers. You can take a look at a fibers[1] and tasks[2] implementation in asynchronous library[3]. [1] - https://github.com/dcarp/asynchronous/blob/master/src/asynchronous/futures.d [2] - https://github.com/dcarp/asynchronous/blob/master/src/asynchronous/tasks.d [3] - http://code.dlang.org/packages/asynchronous Yep, looks like we already have better. I don't understand how D hasn't fully picked up in Web Dev at this point. Are they expecting an e-commerce/blogging/cms platform to go with it?
Re: Future(s) for D.
On Saturday, 20 June 2015 at 22:42:23 UTC, Ellery Newcomer wrote: On 06/20/2015 07:00 AM, Etienne wrote: On Saturday, 20 June 2015 at 13:33:34 UTC, Dragos Carp wrote: On Saturday, 20 June 2015 at 12:35:11 UTC, weaselcat wrote: [...] Even if the callbacks are sequentially listed, the callback hell is still there. A better solution is to use fibers. You can take a look at a fibers[1] and tasks[2] implementation in asynchronous library[3]. [1] - https://github.com/dcarp/asynchronous/blob/master/src/asynchronous/futures.d [2] - https://github.com/dcarp/asynchronous/blob/master/src/asynchronous/tasks.d [3] - http://code.dlang.org/packages/asynchronous Yep, looks like we already have better. I don't understand how D hasn't fully picked up in Web Dev at this point. Are they expecting an e-commerce/blogging/cms platform to go with it? A while back I was bored and curious to see how vibe would fare in the web framework benchmarks (http://www.techempower.com/benchmarks/) so I started adding vibe to it (https://github.com/ariovistus/FrameworkBenchmarks). Chose to go with ddb. Postgresql+asynchronous, sounds great. It didn't compile with the latest dmd at the time. So I fixed it up, made a PR, and it worked fine. It looked like I was getting results close to netty (in json serialization) without much effort, but ultimately, I set it aside to wait for my PR to be merged. what is the deal with ddb, anyways? Is it dead? Hm, ddb doesn't have an asynchronius driver so you're probably going through std.socket which is thread blocking. I think the author isn't very active, but you shouldn't make it a habit to wait for a merge before continuing, or else you'll never be productive. Worst case your fork will be more up to date and you can become the maintainer I guess
Re: PHP verses C#.NET verses D.
On Friday, 19 June 2015 at 11:29:58 UTC, Etienne Cimon wrote: On Friday, 19 June 2015 at 11:28:30 UTC, Etienne Cimon wrote: On Thursday, 18 June 2015 at 05:23:25 UTC, Nick B wrote: On Thursday, 18 June 2015 at 03:44:08 UTC, Etienne Cimon wrote: [...] Also, the HTTP client has a cookiejar and more settings. hmm, I think I can mention the capture debugger. I'm still developing it but it's becoming quite complete. It's a runtime tool shows the HTTP client/server request/response headers, form files/fields, json input/output, for specific request paths, and works in builds without debug info. The trace library that's used for it also maintains custom call stack trace that works in builds withoutu debug info. https://htmlpreview.github.io/?https://github.com/etcimon/vibe.d/blob/master/views/capture.html
Re: PHP verses C#.NET verses D.
On Thursday, 18 June 2015 at 05:23:25 UTC, Nick B wrote: On Thursday, 18 June 2015 at 03:44:08 UTC, Etienne Cimon wrote: On Wednesday, 17 June 2015 at 18:40:01 UTC, Laeeth Isharc wrote: Any idea how far away it might be from being something that someone could use in an enterprise environment simply, in the same kind of way that vibed is easy? I appreciate that making it broadly usable may not be what interests you, and may be a project for someone else. I would say 3 months. So it'll probably be a year considering how off my last estimates were. Etienne - Interesting back story. Will this be under a Boost licence ? Will you provide a link ? Even the vibe.d library was much more advanced than what I could find with an open source license that allowed static compilation at the time (1 yr 1/2 ago), so I went forward with that and worked my way through. [snip\] So now I can build a full web application/server executable in less than 2mb packed, and it runs faster than anything out there. It's standalone, works cross-platform, etc. Will you explain how it is different to Vibe.d ? It has HTTP/2, a new encryption library, it uses a native TCP event library, lots of refactoring. In short, the entire thing is in D rather than linking with OpenSSL and libevent. It's MIT licensed. I have it here: https://github.com/etcimon/vibe.d The dub.json uses relative paths though while I'm developing. You're free to adjust the file and try it, we can consider it stable.
Re: PHP verses C#.NET verses D.
On Friday, 19 June 2015 at 11:28:30 UTC, Etienne Cimon wrote: On Thursday, 18 June 2015 at 05:23:25 UTC, Nick B wrote: On Thursday, 18 June 2015 at 03:44:08 UTC, Etienne Cimon wrote: [...] Etienne - Interesting back story. Will this be under a Boost licence ? Will you provide a link ? [...] [snip\] [...] It has HTTP/2, a new encryption library, it uses a native TCP event library, lots of refactoring. In short, the entire thing is in D rather than linking with OpenSSL and libevent. Also, the HTTP client has a cookiejar and more settings.
Re: PHP verses C#.NET verses D.
On Friday, 19 June 2015 at 11:35:07 UTC, Suliman wrote: It has HTTP/2, a new encryption library, it uses a native TCP event library, lots of refactoring. In short, the entire thing is in D rather than linking with OpenSSL and libevent. It's MIT licensed. I have it here: https://github.com/etcimon/vibe.d Cool! 1. Do you plain to merge it's with original dub? Work is in progress, it will be gradual over the next year to avoid merge conflicts with existing users: https://github.com/rejectedsoftware/vibe.d/tree/http2-botan-cleanup Don't expect that branch to build though. 2. new encryption library does it's written entirely in D and do all that do OpenSSL? Botan does everything that OpenSSL does, but also in a more convenient way. If you need something for anything crypto, chances are it's going to do it. https://github.com/etcimon/botan 3. Do you any plan to add some futures from net.curl? I really dislike to use it, I would like native lib. Vibe.d tasks are one level further from my point of view. You can write procedural TCP read/write and the thread will not block.
Re: PHP verses C#.NET verses D.
On Friday, 19 June 2015 at 15:31:19 UTC, Nick Sabalausky wrote: On 06/19/2015 07:28 AM, Etienne Cimon wrote: The dub.json uses relative paths though while I'm developing. You're free to adjust the file and try it, You may want to consider just using dub's (add|remove)-local for that instead. You can rip those path elements out of dub.json completely, then just do: $ dub add-local ../botan $ dub add-local ../libasync And it will use those paths on your machine only, without mucking up the dub.json. Then when you're done (or if you want to change paths): $ dub remove-local ../botan $ dub remove-local ../libasync I don't know why so many people take it personal, I love being corrected. Thanks so much for the tip :)
Re: Workaround for typeid access violation
On Thursday, 18 June 2015 at 11:43:18 UTC, ketmar wrote: On Wed, 17 Jun 2015 22:35:12 +, Etienne Cimon wrote: e.g. __gshared MyObj g_obj1; Thread 1: g_obj1 = new MyObj; Thread 2: g_obj1.obj2 = new MyObj; Thread 3: write(g_obj1.obj2); -- access violation (probably) so no way to anchor the whole object tree by assigning it to __gshared root? sure, this will never make it into mainline. __gshared is a little sketchy. We can have TLS GC by default by piping `new shared` to a shared GC. It's even safer, because then we have the type system helping out. e.g. shared MyObj g_obj1; Thread 1: g_obj1 = new shared MyObj; Thread 2: g_obj1.obj2 = new shared MyObj; Thread 3: write(g_obj1.obj2); -- success!
Re: Martin Nowak is officially MIA
On Thursday, 18 June 2015 at 20:58:38 UTC, ketmar wrote: On Thu, 18 Jun 2015 14:45:26 +, Etienne wrote: My point is, we need to be able to extend it to build and link an application with a custom druntime/phobos/dmd version from source. exactly what you can do with Reggae. now Reggae needs a good package manager, which dub isn't. I'm not sure how you put 2 and 2 together to come up with Reggae. It seems to be an executable generator with a build configuration. It leaves it up to the user to come up with D code to figure out the build. I'm talking about cloning phobos/druntime/dmd github repositories and automatically building them. No messing around with environment variables and such.
Re: Workaround for typeid access violation
On Thursday, 18 June 2015 at 14:11:42 UTC, ketmar wrote: On Thu, 18 Jun 2015 12:08:10 +, Etienne Cimon wrote: On Thursday, 18 June 2015 at 11:43:18 UTC, ketmar wrote: On Wed, 17 Jun 2015 22:35:12 +, Etienne Cimon wrote: e.g. __gshared MyObj g_obj1; Thread 1: g_obj1 = new MyObj; Thread 2: g_obj1.obj2 = new MyObj; Thread 3: write(g_obj1.obj2); -- access violation (probably) so no way to anchor the whole object tree by assigning it to __gshared root? sure, this will never make it into mainline. __gshared is a little sketchy. We can have TLS GC by default by piping `new shared` to a shared GC. It's even safer, because then we have the type system helping out. e.g. shared MyObj g_obj1; Thread 1: g_obj1 = new shared MyObj; Thread 2: g_obj1.obj2 = new shared MyObj; Thread 3: write(g_obj1.obj2); -- success! besides, wouldn't it break `std.concurrency`? (ketmar have to dig into code instead of asking...) If it does, we fix it. I've never seen druntime/phobos mismatched versions (2.067 2.066) compiled together successfully, we shouldn't allow a necessary change to be blocked because of this alone. As a workaround, you can also do __gshared MyObj g_obj1 = cast() new shared MyObj;
Re: Workaround for typeid access violation
On Thursday, 18 June 2015 at 15:43:10 UTC, Wyatt wrote: On Thursday, 18 June 2015 at 15:19:19 UTC, Etienne wrote: On Thursday, 18 June 2015 at 15:09:46 UTC, Wyatt wrote: This comes to mind, along with the citations: http://research.microsoft.com/en-us/um/people/simonpj/papers/parallel/local-gc.pdf -Wyatt That's exactly what we're talking about, but we do the work that was done by the globalisation policy by using the `new shared` keyword. Maybe I misunderstood. My interpretation was you were disallowing references from shared heap to local heap and Exactly, unless you cast(shared) before you copy into the global heap - the local object must be kept trackable in the local heap or space. In any case, the shared is recursive and disallows this, so it's perfectly suitable to keep a shared GC consistent. obviating the whole globalisation problem. No migrations; just explicit marking of global objects with new shared. (Though I'm curious how you handle liveness of the global heap; it seems like that depends on information from each thread's allocator?) The global heap and every thread will be scanned in stop the world setting just like the current GC. However, the idea is to use it less by making it exclusively for objects that were created with `new shared` `new immutable` `.idup` or `.sdup` (so that we can duplicate local objects into the shared GC conveniently) In all of my security library (Botan) or TCP library (libasync) or even the vibe.d implementation at https://github.com/etcimon/vibe.d I haven't encountered a single instance of an object that was moved to another thread. The shared GC will be known to be very rarely useful.
Re: Martin Nowak is officially MIA
On Thursday, 18 June 2015 at 14:37:08 UTC, ketmar wrote: dub is a build tool with an automatic dependency solver, it really shouldn't be called a package manager. and it's not a build tool too. or, it's a build tool in the sense of bash is a build tool -- it can call external commands. Reggae is a build toold. dub is not a build tool. It doesn't matter. Even if everything is locked into code.dlang.org or if you're using a custom shell in the dub.json to clone a git and use that path in the options, or if you're programming shell scripts for every OS. Any interface works as long as it does what it's supposed to do for the said package. My point is, we need to be able to extend it to build and link an application with a custom druntime/phobos/dmd version from source. These libraries are the backbone of every application.
Re: Workaround for typeid access violation
On Thursday, 18 June 2015 at 15:09:46 UTC, Wyatt wrote: On Wednesday, 17 June 2015 at 22:21:21 UTC, Laeeth Isharc wrote: Do you have any links to reading material on this type of GC? This comes to mind, along with the citations: http://research.microsoft.com/en-us/um/people/simonpj/papers/parallel/local-gc.pdf -Wyatt That's exactly what we're talking about, but we do the work that was done by the globalisation policy by using the `new shared` keyword. We end up with a language that support the very foundation of what I'd say is the most solid Garbage Collection model. To summarise these results, it seems that although the local heap collector performs many fewer young- generation collections and fewer synchronisations, the benefits are offset to some extent by the extra work being done by the col- lector to maintain the global-heap invariant. Globalising the entire transitive closure was on average 93% slower, and results ranged from 7% faster to 577% slower. A garbage collector with local per-processor heaps can outperform a stop-the-world parallel garbage collector in raw parallel through- put, and exhibits more robust performance through having fewer all-core synchronisations.
Re: Martin Nowak is officially MIA
On Thursday, 18 June 2015 at 14:08:31 UTC, ketmar wrote: On Thu, 18 Jun 2015 13:51:05 +, Etienne wrote: On Thursday, 18 June 2015 at 12:37:15 UTC, Dragos Carp wrote: On Thursday, 18 June 2015 at 02:22:13 UTC, Vladimir Panteleev wrote: I would like to ask, what can we improve in our tooling and infrastructure to lessen the burden on release czars? Merge dmd, druntime, phobos repos. If I was release Czar, even DMD would just be a dub package. Let them be managed packages that can be selected by version, with many options! That, my friends, is the way. but there is still no package manager, though. dub is not a package manager. and it's impossible to write one without scraping code.dlang.org too, as there is no API to get package list, or packages that was updated since the date. Not every package manager has to provide binaries. We simply build the packages through dub. dub+dmd is a good source package manager in itself, we need to write a dub.json for dmd/druntime/phobos and make it possible to compile them through dub, then all is good
Re: Martin Nowak is officially MIA
On Thursday, 18 June 2015 at 12:37:15 UTC, Dragos Carp wrote: On Thursday, 18 June 2015 at 02:22:13 UTC, Vladimir Panteleev wrote: I would like to ask, what can we improve in our tooling and infrastructure to lessen the burden on release czars? Merge dmd, druntime, phobos repos. If I was release Czar, even DMD would just be a dub package. Let them be managed packages that can be selected by version, with many options! That, my friends, is the way.
Re: Workaround for typeid access violation
On Wednesday, 17 June 2015 at 18:41:13 UTC, Laeeth Isharc wrote: On Wednesday, 17 June 2015 at 02:35:40 UTC, Etienne Cimon wrote: On Tuesday, 16 June 2015 at 22:31:38 UTC, Etienne Cimon wrote: Yeah, I'm going to make a personal branch and develop a GC thread-local, and ensure memory/vtbl is left intact during collection/finalization, it's a good experiment and I believe it will be a way to solve the issue in the near future. Of course, no support for moving shared objects in a foreign thread anymore.. like that was any useful in the first place :P My libraries run fine on a TLS GC so far: https://github.com/etcimon/druntime/commit/7da3939637bd1642400dbed83e3b0ff2844386ac Only error was with a signal handler trying to allocate on the GC. I think it'll be worth it for me to use this from now on. There's no locking and possibly no stop the world. why 'possibly' ? I hadn't tested it when I wrote that message. I committed the changes today and my tests were successful in a thread-local GC, however I'm still scanning the other thread contexts. The only limitation is that you can't move objects between threads, a pointer must remain in the thread that created it if the object is used in another thread. https://github.com/etcimon/druntime/commit/78a2bca1356e0514c516e5261649ca0bf686b4cb
Re: Martin Nowak is officially MIA
On Wednesday, 17 June 2015 at 23:47:26 UTC, deadalnix wrote: On Wednesday, 17 June 2015 at 18:35:48 UTC, Andrei Alexandrescu wrote: [...] There is a very important difference with an actual job: an actual job with a salary. You just can't expect the same level of commitment from a volunteer than an employee. I understand the feeling, but that seems unnecessarily harsh to demote Martin, since he is the one that have done the most for release, and it yielded actual results. Someone paid $100,000/yr gets 1 mo of vacation. At $35,000/yr you get 2 weeks of vacation. $10/h gets 1 week of vacation. See where I'm getting at? ^^