Re: Swift is coming, Swift is coming
On Mon, 2015-12-07 at 07:22 +, Joakim via Digitalmars-d wrote: > […] > When we spoke with developers about the first year of Swift back > in June, Swift’s teachability was definitely a major selling > point. As useful as Swift might be to communicate programming > ideas, it’s ultimately more useful to be able to take that > knowledge and use it in multiple places." > http://arstechnica.com/apple/2015/12/craig-federighi-talks-open-sourc > e-swift-and-whats-coming-in-version-3-0/ They could at least have fully recognized that Python has shown them the way on this. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: How does D compare to Go when it comes to C interop?
On Friday, 11 December 2015 at 09:28:03 UTC, deadalnix wrote: No, I just like you to explain me how to serve web request at scale, because I have zero clue how that works. Only well behaved kids get presents for xmas.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 12:00:41 UTC, Ozan wrote: Hi, all the TIOBE Index for December 2015 lists D in rank 23. Not bad, with room for improvements. Regards Ozan It's interesting that D dominates Go and Rust on TIOBE, while lagging Swift, but those others seem talked about more on online forums. Btw, D was once in the top 20, only to drop out.
Re: How does D compare to Go when it comes to C interop?
On Friday, 11 December 2015 at 09:10:42 UTC, Ola Fosheim Grøstad wrote: On Friday, 11 December 2015 at 06:36:47 UTC, deadalnix wrote: Yeah tell me more about having web servers with many persistent connections, I don't have the opportunity to see to many of these t work. There is a point in this statement? No, I just like you to explain me how to serve web request at scale, because I have zero clue how that works.
Re: Very very noobie question about how imports work.
On Friday, 11 December 2015 at 03:51:35 UTC, tcak wrote: In D, directory structure doesn't matter. What matters is module names. Actually, it does matter sometimes. // src/foo/bar.d module foo.oops; // main.d import foo.oops; void main() {} Compile: dmd -Isrc main.d Result: main.d(1): Error: module oops is in file 'foo\oops.d' which cannot be read Compiling them together works: dmd main.d src/foo/bar.d When you pass multiple source modules on the command line, the compiler will determine the name of each module. If there is no module statement, it is the file name (but without the path -- it's in the default package). Otherwise, it's whatever is specified by the module statement. This name will be added to the list of available modules. When compilation begins, each import statement is checked against the list of available modules. If the imported module is not found, the compiler will look for it on the import path. It will convert the fully qualified name of the imported module into a file path. In the first command line above, when bar.d is not passed along, the compiler finds import foo.oops and searches the import path for foo/oops.d. Since that file does not exist, we get the error. Change the module statement in bar.d to 'module foo.bar' and the compiler will find it, since the src directory is added to the import path with -I. In the second case, when foo.bar.d is passed to the command line, the compiler finds its module statement, 'module foo.oops' and adds 'foo.oops' to the list of available modules. In this case, the file name is irrelevant and compilation succeeds. Because it is logical to match directory structure and module name, it is done in that way mostly, but there are times you might not want this. Module names should *always* match the file path unless you have a very compelling reason not to do so. As shown above, it's not just because it's logical, but because compilation can break when modules are compiled separately.
Re: How To Call D Code from Objective C?
On 2015-12-11 10:18, Mike McKee wrote: Well, part of it was that I needed to do -shared on Linux instead of -dynamiclib. On OSX, I have to use -dynamiclib. It compiles now on the C code, but when I created a cmain.c to test the library, it gave me a segmentation fault when trying to run this compiled program, even though I copied gfunc.o and cfunc.o to /usr/lib on Linux. // cmain.c #include extern char * c_dfunc(char *s); void main() { printf("%s\n",c_dfunc("request")); } There are several issues: 1. The D function needs to use C compatible types, see my answer to your previous post 2. You need to initialize the D runtime from the C side 3. If you allocate data in D using the GC and pass it to the C side, you need to make sure there's a reference to it on the D side. Otherwise the GC could collect the memory 4. Dynamic libraries are not yet supported on OS X I recommend asking these question in the learning forum. As a first step you need to learn how to interact between D and C. You can get a lot of answers for that on the learning forum, tutorials, documentation, books and so on. -- /Jacob Carlborg
Re: Microsoft to contribute to Clang and LLVM project
On Thu, 2015-12-10 at 15:25 +, Jack Stouffer via Digitalmars-d wrote: > […] > > Please no. > > Not everything has to be in Phobos; this just puts unnecessary > pressure on Phobos maintainers to work on vibe.d as well, and it > will slow down vibe.d development DRASTICALLY due to the extra > scrutiny for Phobos PRs. Not to mention that breaking changes > will no longer be able to happen with vibe.d. Also, vibe.d seems > to be doing just fine as it is. The days of "batteries included" in language distributions are well over. Something Python is having to come to terms with and not doing too well as yet. (Though Continuum Analytics are driving one possible future forward very well.) The core distribution, here Druntime and Phobos, should only be that which is consciously in integral and required part of the language. Everything else should be in packages. Ceylon + Herd, Rust + Cargo + crates.io, Go + (Git|Mercurial), etc. My feeling is that Ceylon is a bit restrictive in that it only has a central curated repository. Go is being over libertarian in having no central repository but great support for DVCS repositories. Rust may be taking the best middle path, there is a curated central repository but also, easy access to Git and Mercurial repositories. Clearly D has a package system, but in this it is like Ceylon. I think it needs to be more like Rust. So in this sense Dub needs to be more like Cargo. (It is already very like, in fact may have influenced.) -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: %s not producing string representation of enum?
Ali Çehreli wrote: > http://ddili.org/ders/d.en/enum.html#ix_enum.EnumMembers,%20std.traits Ali that's great! Thank you! -- Shriramana Sharma, Penguin #395953
Re: "is not callable using a non-shared object"
On Thursday, 10 December 2015 at 22:07:48 UTC, Entity325 wrote: Usually the DMD compiler errors are very helpful, but I guess nothing can be perfect. In this case, I have a class I'm trying to declare. The class is intended to be a transport and storage medium, to allow information to be passed and updated asynchronously between two threads. One of the threads will periodically update, add to, or remove from the data. The other thread periodically checks the data. Both threads need to be able to run asynchronously themselves, so message passing using std.concurrency isn't an option. Both threads need to run in a loop, so the tools in std.parallelism don't work either. If you can't have either of these two threads own the data, then you can have third "server" thread that will own the data and these two "client" threads will communicate with the server thread through std.concurrency.
D is on his way to Top 20 in Tiobe
Hi, all the TIOBE Index for December 2015 lists D in rank 23. Not bad, with room for improvements. Regards Ozan
Re: Microsoft to contribute to Clang and LLVM project
On Thu, 2015-12-10 at 17:36 +, jmh530 via Digitalmars-d wrote: > […] > Like how rdmd simplifies using dmd, you would want something that > simplifies things further? Like so that when you run something > from rdmd, it doesn't just compile things and then run, it starts > running and then JITs what is needed. > > I think there definitely would be something convenient about a > language that you could easily compile or use like a scripting > language without changing the syntax at all. But isn't rdmd just a compiler and executor? It is not an interpreter. This is AOT with no role for JIT. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: Wishlist for D
On Tuesday, 1 December 2015 at 16:48:00 UTC, Suliman wrote: Right place is write here My wishes: - Less flamewars. - A heavy template-based image manipulation library (like antigrain for c++)
Re: How does D compare to Go when it comes to C interop?
On Thu, 2015-12-10 at 20:17 +, Ola Fosheim Grøstad via Digitalmars- d wrote: […] > > Go has a more advanced, memory efficient and secure runtime than > D fibers. So when calling C Go has to do extra work. E.g. Ensure > that the stack is large enough for C etc. Goroutines are great. They are the single thing that makes Go usable. Fibres are for cooperative coroutines, they are a very long way from being the equivalent of goroutines. std:parallelism has tasks and a scheduler. This is much more like goroutines, but they are not publicly available. A good thing to do would be to build an asynchronous task pool system for D as exists for Java (Quasar), Rust (Eventual), Groovy (GPars) that is available for all. Fibres are not that system, and should not be coerced to fill that role. Fibres are for cooperative coroutines and should stay that way. What is needed is a task pool that can then harness kernel threads exactly as goroutines do. And Erlang actors for that matter. And GPars dataflow/actors/CSP. […] In the new year, it may be possible for me to join in an activity on this rather than just waffling about it. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
[Issue 15432] Win64: bad code offset in debug line number info
https://issues.dlang.org/show_bug.cgi?id=15432 yazan.dab...@gmail.com changed: What|Removed |Added CC||yazan.dab...@gmail.com --- Comment #1 from yazan.dab...@gmail.com --- I understand that you are talking about the debug symbols, right? If so, the following is not the cause of this bug. This bug reminded me of a change I made in the stack trace addresses generation (https://github.com/D-Programming-Language/druntime/commit/8822115bc8d52fa61c15cef38fe77349f18747b9) that I did not test the effect of on Windows. I made this change so that the addresses coming from the stack trace point before the return address (i.e. to point at the call instruction even though it most probably won't point at the start of it). I don't know if the address to line handler on Windows produces correct mappings for such addresses. --
Re: How does D compare to Go when it comes to C interop?
On Friday, 11 December 2015 at 05:05:29 UTC, Chris Wright wrote: 1. Kill caches and TLB Which only affects efficiency, not correctness. That's true, but when you have fibers or coroutines as a paradigm, you do it because it is a convenient way of preserving statefulness. So you want to be able to use it where it makes your code more maintainable. If you only care about efficiency for a very limited scenario, then you don't pick coroutines, you use events. But having many, also short lived coroutines makes it easier to write code that is evolving, like simulations. That makes requiring syscalls like mmap for instantiation way too expensive, although if all your stacks are the same size, you can just use a freelist pool, and avoid the syscalls. But that is not a good generic solution. That's a special case. memory all together. If that's your usage pattern, it doesn't matter whether you're on a native thread stack or you're storing things on the heap or you're using a memory-mapped fiber stack; you're going to have a bad time. It matters if you keep wiping caches/tlb by hammering the page tables with changes, it matters if you need to use small pages because you need to use a guard page at the bottom of the stack in order to avoid checking stack size. It matters if page tables grow in size because you fragment memory deliberately. And you also need to make sure that code probe the guard page before addressing something beyond a potential guard page etc (e.g. if you put a large array on the stack). You have to consider the same things in Go because memory is a limited resource. Sometimes you can address them in different ways. Yes, it is a limited resource, especially in typical Go scenarios where you run on shared instances with a fixed small memory size. Which basically makes small default stacks that grow a decent solution, although it does make GC questionable as it leads to significant memory overhead. 1. Allocate all activation records on the heap (Simula/Beta) Or rather, allow a fragmented stack, in both physical and virtual memory. Don't even bother giving the kernel any hints about probable access patterns. This has an obvious negative impact on performance, and that applies to the common case as well as unusual ones. This is basically the model most high level languages take on the conceptual level, then you do optimizations under the hood. Basically having the same model for objects, functions, lambdas and coroutines is a big win in many ways. You can still have a LIFO allocator under the hood for "stack-like-allocation". New features in C++ is taking the everything-is-an-object approach. Lambdas are objects. Coroutines are objects. Is it more difficult to get the highest performance, yes, but it is memory efficient and conceptually elegant. In order to keep the stack contiguous, Go *reallocates and copies your entire stack*, then walks through it to fix up Yes, but one can easily think of optimizations, e.g. leave open slots so that you statistically often can just extend the stack. Or the opposite, over-allocate and shrink when you know what the stack will be like. One problem with Go there could be the focus on separate compilation, smart behaviour here probably require full analysis of possible call-chains. If you want to make this work from D, you would have to do something a bit more awkward. One general problem for D is that you can call D from C. If you knew that C code only could be called at the leaves (or rather keep state at the bottom of the stack), then you also would get more creative freedom. 3. Require no state on stack at yield. (Pony / C++17) Which limits their utility immensely. Not really, it may affect execution speed, but the basic idea is that you establish what state is to be retained in the heap object by static analysis, the rest is put on the regular thread stack.
Re: Microsoft to contribute to Clang and LLVM project
On Thursday, 10 December 2015 at 08:43:21 UTC, Ola Fosheim Grøstad wrote: On Thursday, 10 December 2015 at 05:20:26 UTC, Joakim wrote: I don't see why others are so concerned about it. A better use of their time would be to chip in themselves, on documentation or whatever else they're capable of contributing. I think the primary concern is "what is the plan?". Without a clear plan it really doesn't matter what you do or not do as an individual with just a few hours per week. I agree that a plan needs to be articulated. I hoped to get something like that from the vision statement, but broad goals like improving quality or fostering participation are pretty useless. It should have gone into concrete detail on how they favored accomplishing those broad aims, say by better integrating Panteleev's Digger and other tools into the build process or improving the documentation about getting started on developing D itself. Perhaps they've been burnt in the past by putting time into writing out concrete plans for D and nobody taking up those tasks- I don't know- but at the very least there should be a central place where others can see the core team's prioritized TODO lists. Martin has done great work getting some of the core team on trello, but Walter and Andrei do not seem to use it: https://trello.com/b/XoFjxiqG/active Anyway, even without a plan, we can see from past commits on the backend alone that it's not a time suck. It's like voting or volunteering for a party with the right ideas, but no clear strategy for getting into position. The second concern is that people evaluate performance based on the official compiler. They evaluate Go, not gccgo, and they evaluate dmd, not ldc with an older frontend. This happens repeatedly when people write about these languages. Hopefully, the recent change to the Downloads page to point out that dmd is faster to compile while gdc and ldc produce faster code will change that. I think you underestimate how much of a selling point dmd's speed is, even if I personally will not be able to use it on Android/ARM. sweet spot in every market. Perhaps those are better tools for those markets, while D will hit different segments of those markets and new markets altogether. That required a strategy. Like, I am now likely to pick up C again, just to be able to build tight asm.js. WebGL is now becoming mature and asm.js is becoming a massive target, but it takes a focused group to do better than emscripten... So you need a central strategy in order to organize something like that. Personally, I think that entire web platform is stupid, so I don't care that D doesn't target it. Mobile and embedded is a _much_ more important target and we're making headway there. Dan recently got the D tests running on the Apple tvOS and watchOS simulators: soon you'll be able to run D on your TV or watch! :) I agree that Swift is a strong competitor, as I've been saying, but it is currently way behind D in platform support, ie currently just iOS, OS X, and largely done linux/Glibc. Each has their pros and cons and will garner their own adherents. Swift may need 1-2 more years, but if people can replace two languages with one, then they have a strong adoption card. But I am not sure if Swift will be able to gain C speeds consitently, though I would not bet on it. Well, right now, D is on far more platforms, so it has a head start, though alpha quality on mobile. I'm sure Swift will try to compete, but Apple is not going to port it to Android and it'll be interesting to see how much outside contribution they get, considering Apple is the largest company on earth and people don't really want to do their work for them. D, without large corporate support, actually doesn't have that problem, ie a giant company pushing an OSS project is a double-edged sword. The first time Apple tried to spur an OSS community with Darwin and their base OSS tools, it never took off, with Apple only providing open-source code dumps ever since. It's only later efforts like WebKit, now forked by google for Chrome and Android, and llvm that have built OSS communities. While Swift has a better chance, since it comes from the llvm group, it will be interesting to see how much outsiders contribute to it. But it is rather obvious that being similar to Swift is not a good strategy. If languages get too close, then the better ecosystem wins. You assume that they're very similar and that Swift will have a better ecosystem eventually. They are _somewhat_ similar but different enough to attract different devs, and I pointed out above why they might not be able to grow their community much larger.
Re: How To Call D Code from Objective C?
On 2015-12-11 09:20, Mike McKee wrote: I found a way to call C from in Objective C. The big trick is to rename a .m file to a .mm file. .mm means Objective-C++. That is, combining C++ and Objective-C in the same file. Objective-C can call C functions directly with no problems. A global function in a .m file is a C function. NSLog, for example is a regular C function. So, I think there's probably a way for me to link a compiled C dylib into Objective C and then load its .h header file so that Objective C can call those C functions. I'll be using GCC to statically combine the D's .o code in with the C code. So, I'm thinking the process is like this: 1. Create a D function d_test() that takes a string input, concatenates on "-response", and returns the result. Compile as dtest.o with "dmd -c dtest.d". 2. Create a C function c_test() that takes a string input, calls d_test() and passes it the string, and then returns the response from d_test() out of c_test() as a string result. Compile as ctest.dylib with "gcc -dynamiclib -o ctest.dylib ctest.c dtest.o -L/usr/local/lib -lphobos2 -lpthread -lm". This step is not necessary. You can call the D function directly without needing a wrapper. 3. In Xcode IDE, add this ctest.dylib linked library. Then, create a ctest.h for the function declaration. 4. In Objective C, import ctest.h in my main.mm file and then call with something like NSLog("RESULT=%s",c_test("request")); That should create a debugger line that reads: RESULT=request-response. The problem is that I don't know the entire way that I should create dtest.d and ctest.c. -- /Jacob Carlborg
Re: Using std.math: FloatingPointControl.enableExceptions
rumbu wrote: > Constant folding: a is evaluated at compile time to + infinity. Hmm... I guess the compiler figures that if someone is hardcoding that expression then they don't want to see an exception. Thanks for the explanation. -- Shriramana Sharma, Penguin #395953
Re: Microsoft to contribute to Clang and LLVM project
On Friday, 11 December 2015 at 10:22:18 UTC, Joakim wrote: I agree that a plan needs to be articulated. I hoped to get something like that from the vision statement, but broad goals like improving quality or fostering participation are pretty useless. It should have gone into concrete detail on how they favored accomplishing those broad aims, say by better integrating Panteleev's Digger and other tools into the build process or improving the documentation about getting started on developing D itself. Well, my main issue with D is that there is no plan for making things simpler in order to add more advanced clean features based on modern static analysis at the next stage. New features are added, like hacking in C++ support or multiple-alias-this, that just adds more complexity. Although I still have some hope that a refactored codebase could make "simplification" possible as a side project by an independent group. But making a cleaner version of that language doesn't seem to be on the map by the core developers. As such, D is in the same tarpit as Go. "We are done". Ok, but then these languages will remain in a very small niche that most likely will shrink, not grow. To me, both Go and D are stuck a little bit in the past and I think both languages will need to move one step back in order to make a leap forward. C++14 would have been great if they had bothered to clean up the language before adding even more to it. I think C++ is a good example of what happens when one doesn't take a step back and clean up in time. I think you underestimate how much of a selling point dmd's speed is Even so, the best performing compiler ought be the official one and released first. Go also is acclaimed for great compilation speed, yet people complain about execution and say they switch to Rust over it etc. And Rust is known to be slow at compilation. Personally, I think that entire web platform is stupid, so I don't care that D doesn't target it. This is the big problem. It is an open target that is available, and you only compete with C/C++. Yet it isn't prestige among language devs to target it, and it isn't established, so people ignore it. In 5 years people will curse because they didn't actively target it before other languages got established on it. If you want to grow that is exactly the kind of target you want. People switch if you are the only alternative. That is exactly when they switch to smaller niche products. People adopted Perl, it was the only real alternative for prototyping like transforms of text. People adopted Php, it was the only real alternative for embedding code into html. People thought those application areas were so boring compared to "a general purpose language". It was not "serious" programming areas. So these languages owned those domains for many years, and grew big. Dan recently got the D tests running on the Apple tvOS and watchOS simulators: soon you'll be able to run D on your TV or watch! :) That's great fun! But it isn't a business-plan with Swift being there already. Well, right now, D is on far more platforms, so it has a head start, though alpha quality on mobile. I'm sure Swift will try to compete, but Apple is not going to port it to Android and I think they are going to make some core libraries available. I think that has been announced. The first time Apple tried to spur an OSS community with Darwin and their base OSS tools, it never took off, with Apple only providing open-source code dumps ever since. It's only later There is a lot demand for an easy path from iOS to Android that does not involve hacks like C#. There was actually a Swift compiler made by another company for that purpose. But with Apple backing this approach it becomes much more attractive. Android, and llvm that have built OSS communities. While Swift has a better chance, since it comes from the llvm group, it will be interesting to see how much outsiders contribute to it. There are some speculations on whether Apple might want to compete with AWS, Google and Microsoft and use Swift as the platform. (iCloud) You assume that they're very similar and that Swift will have a better ecosystem eventually. They are _somewhat_ similar but different enough to attract different devs, and I pointed out above why they might not be able to grow their community much larger. I assume that some people _might_ bother to weed out the efficiencies in Swift that are related to staying compatible with Objective-C and turn it into a reasonable high level system level language for those that don't need that compatibility. It won't compete directly with Rust or C++, but it might compete fiercely with other languages that go the ARC route.
Re: Microsoft to contribute to Clang and LLVM project
On Thu, 2015-12-10 at 15:17 +, Jack Stouffer via Digitalmars-d wrote: > […] > > Is PyPy not really Python? Yes it is. All Python compilers do though is generate bytecodes (as do all Java compilers). Then there is the question whether to AOT or JIT. PyPy JITs (as does CPython, sort of). Jython also JITs but this is on JVM bytecodes. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
How do I properly use std.net.curl onSocketOption hook?
Here is my original SO question: http://stackoverflow.com/questions/34218692/how-do-i-properly-set-socket-options-on-std-net-curl any ideas? thx!
Replacing .tupleof
Given that TypeTuple is replaced by AliasSeq (though many don't like the new name), it seems that .tupleof should be replaced by .fieldvalues like std.traits is proposed to have FieldIdentifiers and FieldTypes in https://github.com/D-Programming-Language/phobos/pull/3756. Thoughts? -- Shriramana Sharma, Penguin #395953
How is `auto` and not `alias` appropriate for alias sequences?
Hello. I just found that the following code compiles without any problem: struct Foo { int val; string name; } Foo foo = {1, "one"}; auto t = foo.tupleof; Trying to use `alias` i.o. `auto` above fails. Now IIUC, trying to take the address of t fails, so it's still a compile- time-only construct without "real" i.e. runtime existence. The tuple is in fact an AliasSeq, no? In which case, I would have thought that `alias` (for compile-time symbols) and not `auto` (for runtime variables) would be the appropriate choice. Can someone please explain this situation? Thanks. -- Shriramana Sharma, Penguin #395953
[Issue 15434] New: object.d imports from rt (breaking inline builds)
https://issues.dlang.org/show_bug.cgi?id=15434 Issue ID: 15434 Summary: object.d imports from rt (breaking inline builds) Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: yazan.dab...@gmail.com void main() { ModuleInfo m; foreach (_; m) {} } Errors: /usr/include/dmd/druntime/import/object.d(1500): Error: module minfo is in file 'rt/minfo.d' which cannot be read import path[0] = /usr/include/dmd/phobos import path[1] = /usr/include/dmd/druntime/import The code above doesn't compile with -inline because ModuleInfo.opApply imports from rt. Pull request incoming. --
[Issue 15435] New: std.numeric FFTs are not nothrow @nogc
https://issues.dlang.org/show_bug.cgi?id=15435 Issue ID: 15435 Summary: std.numeric FFTs are not nothrow @nogc Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: alil...@gmail.com Makes it unavailable in @nogc code. --
Re: How To Call D Code from Objective C?
On 2015-12-11 09:51, Mike McKee wrote: So I'm having trouble figuring out the D and C code. Created dfunc.d with this: extern (C) string dfunc(string s) { return s ~ "response"; } Then compiled: $ dmd -c dfunc.d This created dfunc.o without error. Next, I created C code like so: extern char * dfunc(char *); char * c_dfunc(char *s) { return dfunc(s); } "string" in D is not the same as "char*" in C. "string" is an alias to an array of immutable characters. An array in D consists of the length of the array and a pointer to the data. The interface of the function needs to only contain C types. Something like this: extern (C) char* dfunc(char* s); If you want to use the D string operations, like ~, you need to convert it to a D string, do the concatenation, and then convert it back to a C string [2] [3]. See [3] for more information. [1] http://dlang.org/phobos/std_string.html#.toStringz [2] http://dlang.org/phobos/std_string.html#.fromStringz [3] http://dlang.org/spec/interfaceToC.html -- /Jacob Carlborg
Re: Wishlist for D
On Friday, 11 December 2015 at 10:04:22 UTC, Andrea Fontana wrote: On Tuesday, 1 December 2015 at 16:48:00 UTC, Suliman wrote: Right place is write here My wishes: - Less flamewars. - A heavy template-based image manipulation library (like antigrain for c++) As forums go this one is very calm and reasonable. A long thread disagreeing on an issue isn't a flamewar.
Re: How is `auto` and not `alias` appropriate for alias sequences?
On Friday, 11 December 2015 at 11:18:39 UTC, Shriramana Sharma wrote: Hello. I just found that the following code compiles without any problem: struct Foo { int val; string name; } Foo foo = {1, "one"}; auto t = foo.tupleof; Trying to use `alias` i.o. `auto` above fails. Now IIUC, trying to take the address of t fails, so it's still a compile- time-only construct without "real" i.e. runtime existence. The tuple is in fact an AliasSeq, no? In which case, I would have thought that `alias` (for compile-time symbols) and not `auto` (for runtime variables) would be the appropriate choice. Can someone please explain this situation? Thanks. alias can refer to types, templates, template argument lists and compile-time expressions. It can't refer to run-time variables. auto can refer only to run-time values. foo is run-time value. foo.tupleof is also run-time value, like an object of some template instance of std.typecons.Tuple. The template arguments list of std.typecons.Tuple is a compile-time sequence that you can put in AliasSeq. typeof(foo.tupleof) is a type list to which you can only refer with alias or use as template arguments for some template. For example you can put typeof(foo.tupleof) in AliasSeq: alias FooFieldTypes = AliasSeq!(typeof(foo.tupleof)); http://dpaste.dzfl.pl/decbc38e6e71
Re: Nullable condition operator
On Friday, 11 December 2015 at 08:30:21 UTC, Martin6265 wrote: But the syntax of it will be like calling template func, and its not desirable. The trick is in the simplicity of the pattern not only in functionality. No, by using UFCS and IFTI, the syntax of `maybe` becomes even better than C#'s `?.`. See: // http://dlang.org/glossary.html // UFCS: https://dlang.org/spec/function.html#pseudo-member // IFTI: https://dlang.org/spec/template.html#variadic-templates (search for "implicit") struct Node { int val; Node* left, right; } void main() { import std.stdio; auto tree = new Node(1, new Node(2), new Node(3, null, new Node(4) ) ); writeln(tree.maybe.right.right.val); writeln(tree.maybe.left.right.left.right); writeln(tree.maybe.left.right.left.right.val); } // Full source: http://dpaste.dzfl.pl/8b5dcec7aaf3 Look, Im developing multiplatform GUI framework (based on .NET conventions and Cocoa) & ID. I'm interested to know more about the multiplatform GUI framework you are developing. What are the main features, goals and design ideas, architecture and programming model? I can make my custom version of D (anyway, Ill distribute it as a one package product) but Im not happy to make new, uncompatibile version. What do you miss the most in D? What would you change to be worthwhile the effort to distribute a custom version of D? Before learning about D, I worked on UI components with C#/WPF|SL so I can understand that in the beginning it seems that C# is better in some stuff than D. However now I would never go back to C# and .NET, because I would miss so much of D's features and I don't remember anything that I miss from C# and .NET.
Re: How is `auto` and not `alias` appropriate for alias sequences?
On 12/11/2015 12:18 PM, Shriramana Sharma wrote: Hello. I just found that the following code compiles without any problem: struct Foo { int val; string name; } Foo foo = {1, "one"}; auto t = foo.tupleof; Trying to use `alias` i.o. `auto` above fails. ... The alias should compile. This is a compiler bug. Workaround: import std.stdio; alias Seq(T...)=T; void main(){ struct Foo{int val;string name;} Foo foo={1,"one"}; alias t=Seq!(foo.tupleof); } However, this still might not do what you want. The above alias is the same as alias t=Seq!(Foo.tupleof);. This is a general and arbitrary limitation of alias declarations. Now IIUC, trying to take the address of t fails, so it's still a compile- time-only construct without "real" i.e. runtime existence. The tuple is in fact an AliasSeq, no? In which case, I would have thought that `alias` (for compile-time symbols) and not `auto` (for runtime variables) would be the appropriate choice. Can someone please explain this situation? Thanks. The line auto t=foo.tupleof; declares two variables and aliases them into a Seq of name 't'. (It is the same as Seq!(int,string) t=foo.tupleof; ) t[0] and t[1] are two distinct variables. This is also why you were not able take the address of t.
Re: Microsoft to contribute to Clang and LLVM project
On Friday, 11 December 2015 at 11:42:31 UTC, Ola Fosheim Grøstad wrote: There is a lot demand for an easy path from iOS to Android that does not involve hacks like C#. There was actually a Swift compiler made by another company for that purpose. But with Apple backing this approach it becomes much more attractive. For those interested, this is the alternative Swift compiler I was referring to. I haven't tried it though, but it seems to mix with Java/C#: http://www.elementscompiler.com/elements/silver/
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:32:38 UTC, JohnCK wrote: You know what: for a language that is about 14 years old I was expecting more by now. D programmers are too busy being exceedingly productive to brag about how great their language is on reddit every other day :) But the age thing is kinda misleading because D has gone through several major iterations and hasn't had a concerted marketing effort. My amazing novel is like 16 years old now... but nobody has read it because it isn't actually published yet! It is still just going through the process in my brain and amongst a circle of select friends. I said on IRC recently that D has genius programmers in it, but mediocre managers and marketers. I think that has always been true... genius programmers write genius programs, but it is management and marketing that makes something explode in mainstream popularity, just like the greatest novel ever written will never be on the NYT best sellers list until some publisher arranges to sell it to book stores (well, with very rare exceptions). It isn't about features anymore at this point.
Re: How is `auto` and not `alias` appropriate for alias sequences?
On 12/11/2015 03:12 PM, ZombineDev wrote: alias can refer to types, templates, template argument lists and compile-time expressions. It can't refer to run-time variables. Yes it can. void main(){ int x=0; alias y=x; y=2; assert(x==2) } It cannot refer to a field or method of a runtime variable though (it still compiles, but the 'this' reference is just thrown away).
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 12:00:41 UTC, Ozan wrote: the TIOBE Index for December 2015 lists D in rank 23. You know what: for a language that is about 14 years old I was expecting more by now. I think D maybe lost it momentum, because for what I've been seeing, C++ for example is integrating some D features, other languages are growing[1] like Go or will be used actively like Rust on Servo engine. Unfortunately I think D will remain like a niche. [1] - When I'm say "growing", I'm basing on what I'm seeing on internet. JohnCK.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:32:38 UTC, JohnCK wrote: On Friday, 11 December 2015 at 12:00:41 UTC, Ozan wrote: the TIOBE Index for December 2015 lists D in rank 23. You know what: for a language that is about 14 years old I was expecting more by now. I think D maybe lost it momentum, because for what I've been seeing, C++ for example is integrating some D features, other languages are growing[1] like Go or will be used actively like Rust on Servo engine. Unfortunately I think D will remain like a niche. [1] - When I'm say "growing", I'm basing on what I'm seeing on internet. JohnCK. Don't believe everything you read on the internets! :)
Re: How is `auto` and not `alias` appropriate for alias sequences?
On Friday, 11 December 2015 at 14:12:16 UTC, ZombineDev wrote: [...] In short, the current D terminology calls: compile-time lists -> AliasSeq (http://dlang.org/phobos/std_meta#AliasSeq) run-time values of type lists -> Tuple (http://dlang.org/phobos/std_typecons#.Tuple) Another example: Tuple!(int, string)(3, "apples") obj; obj is a run-time tuple of the integer 3 and the string "apples". The template arguments int and string are a type list (and a special case of an alias sequence). alias Point2D = Tuple!(int, "x", int, "" ~ 'y'); auto point_a = Point2D(3, 4); auto point_b = Point2D(1, -7); Point2D is an alias to the type Tuple!(int, "x", int, "" ~ 'y'), which is a template instance of the Tuple(Specs...) template. The (int, "x", int, "" ~ 'y') template arguments have both types and compile-time expressions among them and that's why we call it an alias sequence and not just a type list. point_a and point_b are tuples of two ints and are run-time values. You can put the template arguments used for Point2D in a AliasSeq: alias Point3DTemplateArgs = AliasSeq!(float, "x", int, "y", double, "z"); And you can use those template args to make a new instance of the Tuple template: alias Point3D = Tuple!(Point3DTemplateArgs); Some runtime values can also be computed at compile-time and you can use them for enums. http://dpaste.dzfl.pl/a05cf181331d (I think that only the output of "2:" is inconsistent.) Also I found this article, which maybe helpful: http://dlang.org/ctarguments.html
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 15:29:52 UTC, Ola Fosheim Grøstad wrote: D/PowerNex 29 stars D/DMD 27 stars D/dlangui 13 stars Surprised to see dlangui in top.
Re: How is `auto` and not `alias` appropriate for alias sequences?
On Friday, 11 December 2015 at 14:25:45 UTC, Timon Gehr wrote: On 12/11/2015 03:12 PM, ZombineDev wrote: alias can refer to types, templates, template argument lists and compile-time expressions. It can't refer to run-time variables. Yes it can. void main(){ int x=0; alias y=x; y=2; assert(x==2) } It cannot refer to a field or method of a runtime variable though (it still compiles, but the 'this' reference is just thrown away). Yeah, I forgot to add that it can refer to symbols. Using this featue, you can implement a pass by name function (in addition to pass by value and pass by reference / address).
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:39:10 UTC, wobbles wrote: Don't believe everything you read on the internets! :) I don't but go tell this to every user. :) Matheus.
Re: Microsoft to contribute to Clang and LLVM project
On Friday, 11 December 2015 at 07:40:55 UTC, Jacob Carlborg wrote: I'm not sure how related rdmd is to the above mentioned features. If one would use rdmd for the above, it would require to compile the code as a dynamic library and the load that. I guess that could be possible. I was really trying to get a handle on what their point was. rdmd provides an immediacy that is similar to using some scripting languages. For me, rdmd is better to use when prototyping something than C++, but I'm still more productive prototyping something with R or Matlab. Nevertheless, while I think there is value in an REPL-like environment for D, I would also give it a low, low priority. Some people have said things like D is an AOT compiled language. Fine. But imagine you had a scripting language with the exact same syntax and semantics as D, but this language can be used with an REPL. Maybe there would be a few differences, but for the most part a program written in this language could also be compiled with dmd. Consider the relationship between C and Ch. It provides an REPL interactive shell for C along with some other changes. While there are some differences, you're still basically using an interpreted version of C. Let's suppose there's a Dh that is to D as Ch is to C. Would some people find value in Dh? I think yes. Would there be some overlap between implementing this hypothetical language and dmd/rdmd? I would suspect quite a bit (though I don't know enough of the technical details). Would it be possible to use a JIT in the implementation? I don't see why not. Should smart people work on creating Dh? I'm guessing other priorities are more important.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:32:38 UTC, JohnCK wrote: On Friday, 11 December 2015 at 12:00:41 UTC, Ozan wrote: the TIOBE Index for December 2015 lists D in rank 23. You know what: for a language that is about 14 years old I was expecting more You know what ? That's this "marginal" / "looser" aspect that led me to D. As for the 14 years, two interesting links: https://web.archive.org/web/20110629120936/http://www.dlang.org/ then https://web.archive.org/web/20111014012905/http://dlang.org/ I'm not from the NG generation, I'm not from the social media generation, I'm between the two. From my point of view it's started in 2011/2012, even if, factually, D is 14 year old.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:32:38 UTC, JohnCK wrote: On Friday, 11 December 2015 at 12:00:41 UTC, Ozan wrote: the TIOBE Index for December 2015 lists D in rank 23. You know what: for a language that is about 14 years old I was expecting more by now. Python was released in '91 and didn't reach the mainstream until 2004-ish. Ruby was released in '95 and didn't catch mainstream attention until rails was picked up by many companies in 2006-2007. Programming languages taking a while to get adoption is very common. It takes a lot of investment from companies and programmers to learn a new language and build something in it. This is especially true when your language is a systems language, which takes much more effort to learn and use than a scripting language like the two examples above.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:39:10 UTC, wobbles wrote: On Friday, 11 December 2015 at 14:32:38 UTC, JohnCK wrote: On Friday, 11 December 2015 at 12:00:41 UTC, Ozan wrote: the TIOBE Index for December 2015 lists D in rank 23. You know what: for a language that is about 14 years old I was expecting more by now. I think D maybe lost it momentum, because for what I've been seeing, C++ for example is integrating some D features, other languages are growing[1] like Go or will be used actively like Rust on Servo engine. Unfortunately I think D will remain like a niche. [1] - When I'm say "growing", I'm basing on what I'm seeing on internet. JohnCK. Don't believe everything you read on the internets! :) "You can't believe everything you read on the internet" - Abe Lincoln, 1868
Re: Nullable condition operator
On Friday, 11 December 2015 at 08:30:21 UTC, Martin6265 wrote: But the syntax of it will be like calling template func, and its not desirable. The trick is in the simplicity of the pattern not only in functionality. I guess it's somewhat subjective, as while I liked the ?. syntax at first I now find it very noisy. You?.have?()?.a?.million?.question?.marks?()?.cluttering?.your?.code I find the D syntax much cleaner, because it's just regular function call syntax. maybe(You).have().exactly.zero.question.marks().cluttering.your.code
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 15:32:34 UTC, Wild wrote: Wow, I didn't think my kernel would top any list. Take that as a confirmation of project greatness, I would! Seems I forgot Crystal: https://github.com/trending?l=crystal=monthly crystal/crystal 210 stars crystal/kemal 97 stars crystal/kamber 71 stars Wow, I didn't know Crystal was doing so well. 30% of Rust. Seems like their Ruby-likeness pays off. Julia is doing well too: julia/julia 233 stars julia/DeepNeuralClassifier 188 stars julia/DSGE.jl 160 stars
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:51:19 UTC, Adam D. Ruppe wrote: ... But the age thing is kinda misleading because D has gone through several major iterations and hasn't had a concerted marketing effort ... Well maybe, but you know, C# is about 15 years old and it's in fifth place. Yes, I know... there is a Big corporation behind it and so on. But anyway it's an example. I don't want to be harsh and I hope I'm wrong... but I really think if nothing very very relevant happen in the near future, the trend is that D go down on that list. Matheus.
Dynamic cartesianProduct()
Have anybody put together a lazy variant of cartesianProduct() that operates on a range of ranges: Sample call cartesianProductDynamic([["2", "3"], ["green", "red"], ["apples", "pears"]]) should return [["2", "green", "apples"], ["3", "green", "apples"], ["2", "red", "apples"], ["3", "red", "apples"], ["2", "green", "pears"], ["3", "green", "pears"], ["2", "red", "pears"], ["3", "red", "pears"]] ? Lazyness would of course be a plus.
Re: Replacing .tupleof
On Friday, 11 December 2015 at 11:36:38 UTC, Shriramana Sharma wrote: Given that TypeTuple is replaced by AliasSeq (though many don't like the new name), it seems that .tupleof should be replaced by .fieldvalues like std.traits is proposed to have FieldIdentifiers and FieldTypes in https://github.com/D-Programming-Language/phobos/pull/3756. Thoughts? Incorrect. Tuple is the correct term in this case, because value.tupleof is still a run-time value. AliasSeq is for template arguments. TypeTuple was renamed to AliasSeq to avoid confusion with actual run-time tuples like .tupleof or std.typecons.Tuple.
Re: D is on his way to Top 20 in Tiobe
On 12/11/2015 07:00 AM, Ozan wrote: Hi, all the TIOBE Index for December 2015 lists D in rank 23. Not bad, with room for improvements. Regards Ozan Thanks for the heads-up. As usual such rankings should be taken with a boulder of salt and at best used as one of several signals. That said, I do believe that generally an improved rank for a given language is a good sign. D's Tiobe rank was 28 in Dec 2014. -- Andrei
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 15:05:34 UTC, JohnCK wrote: On Friday, 11 December 2015 at 14:39:10 UTC, wobbles wrote: Don't believe everything you read on the internets! :) I don't but go tell this to every user. :) I use github trending for figuring out where the "open source" trends are: https://github.com/trending?l=d=monthly This months top 3: D/PowerNex 29 stars D/DMD 27 stars D/dlangui 13 stars Nim/Nim 69 stars Nim/pymod 32 stars Nim/nimx 7 stars Rust/notty 500 stars Rust/rust 447 stars Rust/leaf 359 stars Go/fasthttp 1288 stars Go/docker 932 stars Go/ vuvuzela 1094 stars C#/OpenLiveWriter 1108 stars C#/Google-play... 417 stars C#/roslyn 309 stars Swift/Perfect 3679 stars Swift/swift-package-manager 2760 stars Swift/netfox 1462 stars C++/swift 22580 stars C++/tensorflow 6357 stars C++/openalpr 1939 stars ... Nim and D seems to be equally popular. Then there is a significant leap to Rust Go seems to be twice as popular as Rust. Swift twice as popular as Go. And C++ twice as popular as Swift. (maybe)
Re: Formal Review of std.range.ndslice
On Friday, 11 December 2015 at 19:31:14 UTC, Stefan Frijters wrote: Today I've made an abortive attempt at replacing my code's [1] dependence on unstd.multidimarray [2] with ndslice. I'm guessing it's just me being stupid, but could anyone supply with some hints on how to do the conversion with a minimum of fuss? Basically I have an N-dimensional array (N is known at compile time) of type T wrapped in a struct to carry some additional information. I then address it using size_t[N] fixed-size arrays, and loop over it a lot with foreach, which also uses size_t[N] as index. So it looks something like this: struct Field(T, uint N) { alias arr this; MultidimArray!(T, N) arr; // is there any way to supply the correct type here with ndslice? I cannot use auto, right? Slice!(N, T*) arr; this (in size_t[N] lengths) { arr = multidimArray!T(lengths); // compute length // more flexible construtors would be added after // allocatrs support for ndslice size_t len = 1; foreach(l; lengths) len *= l; arr = new T[len].sliced(lengths); } } and then things like foreach(immutable p, ref pop; someField) { pop = foo(someOtherField[bar(p)]); ... } std.experimental.ndslice.selection: indexSlice, byElement; foreach(p; someField.shape.indexSlice.byElement) { someField[p] = foo(someOtherField[bar(p)]); ... } where p is of type size_t[N]. I tried using ndarray in conjunction with the std.experimental.allocator, but I don't particularly care about memory management; these are large arrays that are allocated once and kept around for the duration of the program. Any help would be appreciated. [1] https://github.com/SFrijters/DLBC [2] https://bitbucket.org/SFrijters/unstandard See also updated docs: http://dtest.thecybershadow.net/artifact/website-13cbdcf17d84fc31328c3f517a56bea783c418d6-d9c63e815273f0906309088334e7dfb1/web/phobos-prerelease/std_experimental_ndslice.html Ilya
Re: How to check if result of request to DB is empty?
On 11.12.2015 22:05, Suliman wrote: I am using https://github.com/buggins/ddbc string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what happens when the user enters an apostrophe in the username field. Also, are you using LIKE when authenticating the user? O_O How I can check if SQL request returned empty result? When the result is empty, then rs.next() returns false on the first call, I presume.
Re: Formal Review of std.range.ndslice
On Friday, 11 December 2015 at 22:56:15 UTC, Ilya wrote: On Friday, 11 December 2015 at 19:31:14 UTC, Stefan Frijters wrote: Today I've made an abortive attempt at replacing my code's [1] dependence on unstd.multidimarray [2] with ndslice. I'm guessing it's just me being stupid, but could anyone supply with some hints on how to do the conversion with a minimum of fuss? Basically I have an N-dimensional array (N is known at compile time) of type T wrapped in a struct to carry some additional information. I then address it using size_t[N] fixed-size arrays, and loop over it a lot with foreach, which also uses size_t[N] as index. So it looks something like this: struct Field(T, uint N) { alias arr this; MultidimArray!(T, N) arr; // is there any way to supply the correct type here with ndslice? I cannot use auto, right? Slice!(N, T*) arr; this (in size_t[N] lengths) { arr = multidimArray!T(lengths); // compute length // more flexible construtors would be added after // allocatrs support for ndslice size_t len = 1; foreach(l; lengths) len *= l; arr = new T[len].sliced(lengths); } } and then things like foreach(immutable p, ref pop; someField) { pop = foo(someOtherField[bar(p)]); ... } std.experimental.ndslice.selection: indexSlice, byElement; foreach(p; someField.shape.indexSlice.byElement) { someField[p] = foo(someOtherField[bar(p)]); ... } faster version: std.experimental.ndslice.selection: byElement; for(auto r = someField.arr.byEleemnt; r.popFront) { r.front = foo(someOtherField[bar(r.index)]); ... } where p is of type size_t[N]. Ilya
How to check if result of request to DB is empty?
I am using https://github.com/buggins/ddbc string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); auto rs = db.stmt.executeQuery(query_string); string dbpassword; string dbuser; while (rs.next()) { dbuser = rs.getString(1); dbpassword = rs.getString(2); writeln(dbuser); writeln("Place seems unreachable"); // if SQL result is empty ... How I can check if SQL request returned empty result?
Re: https everywhere update - dlang.org gets an "A" now!
On Friday, 11 December 2015 at 21:22:06 UTC, Basile B. wrote: On Wednesday, 2 December 2015 at 22:17:20 UTC, Walter Bright wrote: Dlang.org gets an "A" now! Thanks to Jan Knepper's efforts. https://www.youtube.com/watch?v=OqkYr5uIreg=youtu.be=49s we're safe...
Re: https everywhere update - dlang.org gets an "A" now!
On Wednesday, 2 December 2015 at 22:17:20 UTC, Walter Bright wrote: Dlang.org gets an "A" now! Thanks to Jan Knepper's efforts. https://www.youtube.com/watch?v=OqkYr5uIreg=youtu.be=49s
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 15:22:11 UTC, Basile B. wrote: You know what ? That's this "marginal" / "looser" aspect that led me to D. I am afraid Go is winning both in the adoption and the looser department, it even has a curated list of articles about how bad it is... https://github.com/ksimka/go-is-not-good
Re: https everywhere update - dlang.org gets an "A" now!
On Friday, 11 December 2015 at 21:24:07 UTC, Basile B. wrote: On Friday, 11 December 2015 at 21:22:06 UTC, Basile B. wrote: On Wednesday, 2 December 2015 at 22:17:20 UTC, Walter Bright wrote: Dlang.org gets an "A" now! Thanks to Jan Knepper's efforts. https://www.youtube.com/watch?v=OqkYr5uIreg=youtu.be=49s we're safe... I hope you get the irony...
Re: MurmurHash3
On Friday, 11 December 2015 at 01:51:09 UTC, Ilya wrote: http://dpaste.dzfl.pl/1b94ed0aa96e#line-222 - seed is uint, can it be ulong? Done Mutmur hash has three stages: 1. Computation of hash for blocks (32bit or 128bit) 2. Compitation of hash for tail (remainder) 3. Finalization. I will be very happy, if step 1 will be represented as an output range. Then it can be used directly like reduce aggregator for ranges and multidimensional slices. Done Not thoroughly tested but updated for range and taking an ulong seed for MurmurHash3_x64_128: http://dpaste.dzfl.pl/1b94ed0aa96e Not sure I got what you meant about the optimized version. For the return value ? I haven't done any benchmarking yet.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 15:29:52 UTC, Ola Fosheim Grøstad wrote: On Friday, 11 December 2015 at 15:05:34 UTC, JohnCK wrote: [...] I use github trending for figuring out where the "open source" trends are: [...] Github heavily favors anything related to web programming and is skewed by this. e.g, do you really think Ruby is more popular than C++?
Re: DConf 2016 news: 20% sold out, book signing
On Friday, 11 December 2015 at 19:59:54 UTC, Russel Winder wrote: On Tue, 2015-12-08 at 15:50 -0800, Walter Bright via Digitalmars-d- announce wrote: 2. Load up a tablet with lots of books. Or a real laptop so you can do Real Programming – which of course must be in FORTRAN. I know you're joking, but I've been using my tablet for programming for the last couple weeks and it's surprisingly great. Using the excellent and free Termux Android app for common OSS packages (https://play.google.com/store/apps/details?id=com.termux=en) and a bluetooth keyboard (the somewhat dated Rapoo E6100), I've been able to get ldc built natively on Android (http://forum.dlang.org/thread/ycvtkeiyffhaixxpz...@forum.dlang.org). The tablet display is only 8.4" but so high-resolution, at 359 ppi, that it doesn't matter, particularly for a shell prompt. Its Exynos 5420 octa-core CPU is surprisingly fast, building llvm-optimized phobos in just over a minute. I prop the tablet up against something on my desk, and if I want to read a webpage, I can simply pick it up and hold it in my hands while reading. I'm living in the future! Just thought I'd share. :)
Re: DConf 2016 news: 20% sold out, book signing
On Saturday, 12 December 2015 at 05:46:15 UTC, Walter Bright wrote: On 12/11/2015 8:28 PM, Joakim wrote: and a bluetooth keyboard Just to nit pick, using an external keyboard makes it more of a laptop than a tablet. A nitpick for a nitpick is fair game. :) However, there are distinct differences with this setup. For one, the tablet and keyboard combined weigh just under 1.5 lbs, which is much lighter than almost any laptop. And you'd have to compare it to one of the new detachable laptops, as you can't just pick up most laptop screens and read them in one hand, as I can with this tablet. Of course, it's all about trade-offs: I find myself surprisingly comfortable with this small 8.4" diagonal screen, others may not be. The bluetooth keyboard repeatedly loses a couple keystrokes when starting typing after a minute's break, which appears to be a known Android problem. Chrome on Android will annoyingly not save your zoom level for various websites, as the desktop version does, which is particularly needed for this high-resolution display, meaning I repeatedly have to Ctrl-+ or pinch-zoom on sites over and over again to get the right text zoom back. I do have split-screen multi-window for many apps, as it's a flagship Samsung tablet. Desktop Android's certainly not there yet for everybody, but it is for my admittedly low demands, and soon will be for everybody, as google has said they're working on built-in multi-window for the next version of Android.
Re: check variable for undefinedness
On Saturday, 12 December 2015 at 07:39:47 UTC, Suliman wrote: if(a is null) How to check if variable "is not null" ? a !is null or !(a is null)
Re: log(n) amortized growth for containers
On 12/11/15 9:02 PM, Timon Gehr wrote: On 12/11/2015 04:55 AM, Andrei Alexandrescu wrote: Here's a quick thought on growth schedule for arrays. The classic approach is to grow by a geometric schedule. For example: 1, 2, 4, 8, 16, etc. That way, n memory moves are necessary for achieving a capacity equal to n, so on average we spend a constant amount of time per appended element. The main disadvantage with this growth schedule is there are on average n/2 slack memory slots. Also, a growth factor of 2 is unfriendly to the memory allocator (long discussion) so a smaller one (such as the golden cut or less) would be better. Anyhow, I was thinking why O(1) amortized growth and not O(log n)? The latter is considered scalable all right and the hope is to get a corresponding reduction in the slack memory space. ... E.g. the following sequence of capacities leads to amortized Θ(log n). c(0) = 0, c(k+1) = c(k)+c(k)/⌊log₂(c(k)+2)⌋+1. How do you prove that? -- Andrei
Re: log(n) amortized growth for containers
I've been using the same mechanism as jemalloc in SDC's runtime and it bucket basically by keeping 2 bits of precision + shift. It goes as : 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, ... It work quite well in practice.
Re: How is `auto` and not `alias` appropriate for alias sequences?
ZombineDev wrote: >>struct Foo { int val; string name; } >>Foo foo = {1, "one"}; >>auto t = foo.tupleof; >> >> Trying to use `alias` i.o. `auto` above fails. >> >> Now IIUC, trying to take the address of t fails, so it's still > > auto can refer only to run-time values. > > foo is run-time value. In which case, why should taking its address fail? If I try to do: auto tp = I'm getting: Error: tuple(__t_field_0, __t_field_1) is not an lvalue What the!? *After* I assign it to a variable, it still says it's not an lvalue? I mean I understand if I can't take the address of a compiler- created temporary rvalue, but why can't I take its address even after I assign it to a newly created variable? Does the variable t have an address in memory or not? I understand that: alias t2 = foo.tupleof; doesn't work since you cannot give an alias to an rvalue temporary, since t2 would be pointing to nothing after the (immediate) destruction of the temporary tuple object. But I can still do: alias t2 = t; So why can't I do: auto tp = ??? Note that the following, which should be equivalent, works: alias FooTuple = Tuple!(int, string); FooTuple footu = FooTuple(1, "one"); auto ttp = -- Shriramana Sharma, Penguin #395953
Re: D is on his way to Top 20 in Tiobe
On Saturday, 12 December 2015 at 04:38:02 UTC, JohnCK wrote: On Friday, 11 December 2015 at 15:29:52 UTC, Ola Fosheim And there is this site: http://githut.info/ where D is in #39 place of 49 languages. John. ... Where they group CSS, TeX, Matlab, XSlt and other similar together with C, Java and D. (!?) Come on,... for a language with no big company behind, I would congratulate D for his surviving and high ranking. The sad reality is, there are thousands of p-languages with great ideas and people behind but with no chance to reach enough awareness. And true is that D reached the breakpoint to be listed, discussed and used. Xmas greetings, Ozan (what kind of winter is this in Germany? It's sunny with no snow and crispy coldness)
[Issue 15432] Win64: bad code offset in debug line number info
https://issues.dlang.org/show_bug.cgi?id=15432 --- Comment #2 from Rainer Schuetze--- Yes, I'm referring to the debug information generated by dmd, so libraries cannot cause this. --
Re: Thoughts on a Future Garbage Collector
On 12/12/15 7:51 AM, Jakob Jenkov wrote: A little something I've been working on for making into a DIP: http://wiki.dlang.org/User:Alphaglosined/ManagedMemory Would it be to your liking? I don't know - what does it do? I am pretty new to D... ! It is not DIP ready, but basically would allow at runtime annotating some memory with behavior e.g. allocation strategy, when to deallocate ext. It would also almost force 'ownership' on it.
Re: Dmd doesn't like tuples or me :>
On 12/11/2015 05:41 PM, Enjoys Math wrote: > import std.stdio; > import std.typecons; > > int main(string[] argv) > { > auto value = Tuple(5, 6.7, "hello"); I don't understand how it relates to the error message but you should use lowercase 'tuple' there: auto value = tuple(5, 6.7, "hello"); tuple() is the convenience function template that takes care of type deduction. Otherwise, you would have to write it like this: auto value = Tuple!(int, double, string)(5, 6.7, "hello"); Both lines are equivalent. Ali
Re: log(n) amortized growth for containers
On 12/11/2015 04:55 AM, Andrei Alexandrescu wrote: Here's a quick thought on growth schedule for arrays. The classic approach is to grow by a geometric schedule. For example: 1, 2, 4, 8, 16, etc. That way, n memory moves are necessary for achieving a capacity equal to n, so on average we spend a constant amount of time per appended element. The main disadvantage with this growth schedule is there are on average n/2 slack memory slots. Also, a growth factor of 2 is unfriendly to the memory allocator (long discussion) so a smaller one (such as the golden cut or less) would be better. Anyhow, I was thinking why O(1) amortized growth and not O(log n)? The latter is considered scalable all right and the hope is to get a corresponding reduction in the slack memory space. ... E.g. the following sequence of capacities leads to amortized Θ(log n). c(0) = 0, c(k+1) = c(k)+c(k)/⌊log₂(c(k)+2)⌋+1.
Re: DConf 2016 news: 20% sold out, book signing
On 12/11/2015 8:28 PM, Joakim wrote: and a bluetooth keyboard Just to nit pick, using an external keyboard makes it more of a laptop than a tablet.
Re: How is `auto` and not `alias` appropriate for alias sequences?
ZombineDev wrote: > In short, the current D terminology calls: > compile-time lists -> AliasSeq > (http://dlang.org/phobos/std_meta#AliasSeq) > run-time values of type lists -> Tuple > (http://dlang.org/phobos/std_typecons#.Tuple) Excellent explanation. I keep looking for a "Like" or "Upvote" button on this forum. :-) Thanks! -- Shriramana Sharma, Penguin #395953
isExpressions -> isValuesSeq
This is w.r.t. http://dlang.org/phobos/std_traits.html#isExpressions: I am trying the following code: import std.stdio, std.meta, std.traits; void main() { alias a = AliasSeq!(1 + 2, "foo" == "goo"); if (isExpressions!a) write("This AliasSeq contains expressions: "); foreach (v; a) { write(v.stringof, ", "); } writeln(); writeln("This should be: ", (1 + 2).stringof, ", ", ("foo" == "goo").stringof); } The output is: This AliasSeq contains expressions: 3, false, This should be: 1 + 2, "foo" == "goo" Clearly, the AliasSeq is not able to store the expressions themselves since they are automatically evaluated at compile time. It stores only the values that the expressions evaluate to. Further, expressions which are not evaluable at compile time aren't permitted in the AliasSeq. (I tried it.) Thus the appropriate name would thus be isValuesSeq, no? -- Shriramana Sharma, Penguin #395953
Re: How to check if result of request to DB is empty?
string query_string = (`SELECT user, password FROM otest.myusers where user LIKE ` ~ `'%` ~ request["username"].to!string ~ `%';`); Don't piece queries together without escaping the dynamic parts. Imagine what happens when the user enters an apostrophe in the username field. Do you mean to wrap: request["username"].to!string in quotes? Also, are you using LIKE when authenticating the user? O_O Yes, my issue :) How I can check if SQL request returned empty result? When the result is empty, then rs.next() returns false on the first call, I presume. SO I can wrap it in `if`? Like: `if(rs.next())` ?
Re: MurmurHash3
On Friday, 11 December 2015 at 22:43:00 UTC, Guillaume Chatelet wrote: On Friday, 11 December 2015 at 01:51:09 UTC, Ilya wrote: http://dpaste.dzfl.pl/1b94ed0aa96e#line-222 - seed is uint, can it be ulong? Done Mutmur hash has three stages: 1. Computation of hash for blocks (32bit or 128bit) 2. Compitation of hash for tail (remainder) 3. Finalization. I will be very happy, if step 1 will be represented as an output range. Then it can be used directly like reduce aggregator for ranges and multidimensional slices. Done Not thoroughly tested but updated for range and taking an ulong seed for MurmurHash3_x64_128: http://dpaste.dzfl.pl/1b94ed0aa96e Not sure I got what you meant about the optimized version. For the return value ? I haven't done any benchmarking yet. Current version is suitable for arrays but not ranges or types. Few examples: 1. Compute hash of ulong. 2. Compute hash of all elements in matrix column (element are in different arrays). I have created output range API draft http://dpaste.dzfl.pl/a24050042758 Ilya
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 15:29:52 UTC, Ola Fosheim Grøstad wrote: On Friday, 11 December 2015 at 15:05:34 UTC, JohnCK wrote: On Friday, 11 December 2015 at 14:39:10 UTC, wobbles wrote: Don't believe everything you read on the internets! :) I don't but go tell this to every user. :) I use github trending for figuring out where the "open source" trends are: https://github.com/trending?l=d=monthly ... And there is this site: http://githut.info/ where D is in #39 place of 49 languages. John.
Re: How is `auto` and not `alias` appropriate for alias sequences?
Another twist to this is that the tuple created by .tupleof doesn't really seem to be a new object of type Tuple!() but rather a "view" of sorts onto the original object itself in the form of a tuple, else the example provided at http://dlang.org/spec/class.html i.e.: class Foo { int x; long y; } void test(Foo foo) { foo.tupleof[0] = 1; // set foo.x to 1 foo.tupleof[1] = 2; // set foo.y to 2 foreach (x; foo.tupleof) write(x); // prints 12 } wouldn't be able to set values to the original class instance via whatever .tupleof generates. So the exact nature of the object produced by .tupleof is still a mystery to me. Would be good if someone threw more light on it. Also: what is the use of presenting the members of a struct/class as a tuple? Is it iteration? -- Shriramana Sharma, Penguin #395953
Re: check variable for undefinedness
if(a is null) How to check if variable "is not null" ?
Re: How is `auto` and not `alias` appropriate for alias sequences?
On Friday, 11 December 2015 at 14:56:01 UTC, ZombineDev wrote: On Friday, 11 December 2015 at 14:25:45 UTC, Timon Gehr wrote: On 12/11/2015 03:12 PM, ZombineDev wrote: alias can refer to types, templates, template argument lists and compile-time expressions. It can't refer to run-time variables. Yes it can. void main(){ int x=0; alias y=x; y=2; assert(x==2) } It cannot refer to a field or method of a runtime variable though (it still compiles, but the 'this' reference is just thrown away). Yeah, I forgot to add that it can refer to symbols. Using this featue, you can implement a pass by name function (in addition to pass by value and pass by reference / address). To clarify: By using alias you can refer to one symbol through another name. So alias can refer to variables, but not to values. Currently, I think this is restricted to only symbols of run-time variables in the same scope (same function, same class, etc.) - only one level of indirection.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 15:29:52 UTC, Ola Fosheim Grøstad wrote: I use github trending for figuring out where the "open source" trends are: https://github.com/trending?l=d=monthly This months top 3: D/PowerNex 29 stars [...] Wow, I didn't think my kernel would top any list.
Re: Nullable condition operator
On Monday, 7 December 2015 at 15:13:31 UTC, Meta wrote: On Monday, 7 December 2015 at 11:40:45 UTC, Martin6265 wrote: Hello, I think nullable condition operator and null coalescending operator should be a nice new features in D. https://msdn.microsoft.com/library/dn986595.aspx https://msdn.microsoft.com/library/ms173224.aspx Same as operator `as` https://msdn.microsoft.com/library/cscsdfbt.aspx Why? Is better to write (variable as FooBar)?.callMethod(); than auto var = cast(FooBar)variable; if (var !is null) var.callMethod(); or auto x = (variable as FooBar)?.getRandomNumber() ?? 42; As per Rumbu's link, D is powerful enough to implement this in a library function, and have it optimize down to a set of if-else statements. But the syntax of it will be like calling template func, and its not desirable. The trick is in the simplicity of the pattern not only in functionality. Look, Im developing multiplatform GUI framework (based on .NET conventions and Cocoa) & ID. I can make my custom version of D (anyway, Ill distribute it as a one package product) but Im not happy to make new, uncompatibile version.
Re: How To Call D Code from Objective C?
So I'm having trouble figuring out the D and C code. Created dfunc.d with this: extern (C) string dfunc(string s) { return s ~ "response"; } Then compiled: $ dmd -c dfunc.d This created dfunc.o without error. Next, I created C code like so: extern char * dfunc(char *); char * c_dfunc(char *s) { return dfunc(s); } But when I try to compile on Linux (as a test -- I could have done this slightly differently on OSX), it throws this error: $ gcc -dynamiclib -o cfunc.o cfunc.c dfunc.o -L/usr/local/lib -lphobos2 -lpthread -lm cc1: warning: unrecognized gcc debugging option: y [enabled by default] cc1: warning: unrecognized gcc debugging option: n [enabled by default] cc1: warning: unrecognized gcc debugging option: m [enabled by default] cc1: warning: unrecognized gcc debugging option: i [enabled by default] cc1: warning: unrecognized gcc debugging option: c [enabled by default] cc1: warning: unrecognized gcc debugging option: l [enabled by default] cc1: warning: unrecognized gcc debugging option: i [enabled by default] cc1: warning: unrecognized gcc debugging option: b [enabled by default] /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 20 has invalid symbol index 13 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 21 has invalid symbol index 22 /usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2 /usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: error: ld returned 1 exit status
Re: How does D compare to Go when it comes to C interop?
On Friday, 11 December 2015 at 06:36:47 UTC, deadalnix wrote: Yeah tell me more about having web servers with many persistent connections, I don't have the opportunity to see to many of these t work. There is a point in this statement?
Re: std.math: FloatingPointControl option to round to nearest + tie away from zero
On Friday, 11 December 2015 at 05:25:03 UTC, Shriramana Sharma wrote: https://en.wikipedia.org/wiki/IEEE_floating_point#Roundings_to_nearest says that IEEE 754 provides two options for rounding to nearest: ties to even and ties away from zero. However, under https://github.com/D-Programming-Language/phobos/blob/master/std/math.d#L4539 we have only one roundToNearest which, I presume, ties to even. Is there a difficulty in providing the option for tieing away from zero? Thanks. Those are basically the rounding modes supported by the FPUs in hardware. Any other rounding modes would have to be emulated in software, which would require the compiler to generate completely different code instead of just changing a few bits in an FPU control register.
Re: How To Call D Code from Objective C?
Well, part of it was that I needed to do -shared on Linux instead of -dynamiclib. On OSX, I have to use -dynamiclib. It compiles now on the C code, but when I created a cmain.c to test the library, it gave me a segmentation fault when trying to run this compiled program, even though I copied gfunc.o and cfunc.o to /usr/lib on Linux. // cmain.c #include extern char * c_dfunc(char *s); void main() { printf("%s\n",c_dfunc("request")); }
Re: DConf 2016 news: 20% sold out, book signing
On Tue, 2015-12-08 at 15:50 -0800, Walter Bright via Digitalmars-d- announce wrote: > […] > > 1. If possible, do a long jog before going to the airport. It makes > you ready to > relax. Waste of time, but if you think it useful, do it. > 2. Load up a tablet with lots of books. Or a real laptop so you can do Real Programming – which of course must be in FORTRAN. > 3. Ear plugs. It's surprising how fatiguing the jet noise is. Or in ear monitors then you can listen to decent music. > 4. One of those neck pillows can help. Maybe, but probably. > 5. Booze :-) And other drugs. But mostly alcohol. ;-) -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: D is on his way to Top 20 in Tiobe
Sames here Dne 11. 12. 2015 16:25 napsal uživatel "Basile B. via Digitalmars-d" < digitalmars-d@puremagic.com>: > On Friday, 11 December 2015 at 14:32:38 UTC, JohnCK wrote: > >> On Friday, 11 December 2015 at 12:00:41 UTC, Ozan wrote: >> >>> the TIOBE Index for December 2015 lists D in rank 23. >>> >> >> You know what: for a language that is about 14 years old I was expecting >> more >> > > You know what ? That's this "marginal" / "looser" aspect that led me to D. > > As for the 14 years, two interesting links: > > https://web.archive.org/web/20110629120936/http://www.dlang.org/ > > then > > https://web.archive.org/web/20111014012905/http://dlang.org/ > > I'm not from the NG generation, I'm not from the social media generation, > I'm between the two. From my point of view it's started in 2011/2012, even > if, factually, D is 14 year old. > >
Re: D is on his way to Top 20 in Tiobe
On 12/11/2015 4:29 AM, Joakim wrote: Btw, D was once in the top 20, only to drop out. That happened when they changed their ranking algorithm.
Re: Formal Review of std.range.ndslice
Today I've made an abortive attempt at replacing my code's [1] dependence on unstd.multidimarray [2] with ndslice. I'm guessing it's just me being stupid, but could anyone supply with some hints on how to do the conversion with a minimum of fuss? Basically I have an N-dimensional array (N is known at compile time) of type T wrapped in a struct to carry some additional information. I then address it using size_t[N] fixed-size arrays, and loop over it a lot with foreach, which also uses size_t[N] as index. So it looks something like this: struct Field(T, uint N) { alias arr this; MultidimArray!(T, N) arr; // is there any way to supply the correct type here with ndslice? I cannot use auto, right? this (in size_t[N] lengths) { arr = multidimArray!T(lengths); } } and then things like foreach(immutable p, ref pop; someField) { pop = foo(someOtherField[bar(p)]); ... } where p is of type size_t[N]. I tried using ndarray in conjunction with the std.experimental.allocator, but I don't particularly care about memory management; these are large arrays that are allocated once and kept around for the duration of the program. Any help would be appreciated. [1] https://github.com/SFrijters/DLBC [2] https://bitbucket.org/SFrijters/unstandard
Re: Replacing .tupleof
On 12/11/2015 04:14 PM, ZombineDev wrote: On Friday, 11 December 2015 at 11:36:38 UTC, Shriramana Sharma wrote: Given that TypeTuple is replaced by AliasSeq (though many don't like the new name), it seems that .tupleof should be replaced by .fieldvalues like std.traits is proposed to have FieldIdentifiers and FieldTypes in https://github.com/D-Programming-Language/phobos/pull/3756. Thoughts? Incorrect. Tuple is the correct term in this case, because value.tupleof is still a run-time value. ... It is a compile-time sequence of run-time values. It avoids limitations of alias by apparently being a special case. :o) There is no way to get something of the kind that .tupleof gives you without .tupleof.
Re: benchmark on binary trees
ok, i have a working version (memory is nice, twice the speed as non parallel) ; http://dpaste.dzfl.pl/504a652c6c47 real0m14.427s user1m19.347s sys 0m0.124s i've got similar performances, without Allocators, using directly malloc and free i had to recursively deallocate ... though, still far from competing with the fastest, any advice ? i guess FreeList allocator is not the better tool here ?
Re: DConf 2016 news: 20% sold out, book signing
On Friday, 11 December 2015 at 19:59:54 UTC, Russel Winder wrote: On Tue, 2015-12-08 at 15:50 -0800, Walter Bright via Digitalmars-d- announce wrote: […] 1. If possible, do a long jog before going to the airport. It makes you ready to relax. Waste of time, but if you think it useful, do it. 2. Load up a tablet with lots of books. Or a real laptop so you can do Real Programming – which of course must be in FORTRAN. 3. Ear plugs. It's surprising how fatiguing the jet noise is. Or in ear monitors then you can listen to decent music. 4. One of those neck pillows can help. Maybe, but probably. 5. Booze :-) And other drugs. But mostly alcohol. ;-) 6. And don't forget an empty plastic bottle (would say G.Depardieu), particularly if (5.) is a met condition.
Re: D is on his way to Top 20 in Tiobe
On Friday, 11 December 2015 at 14:51:19 UTC, Adam D. Ruppe wrote: On Friday, 11 December 2015 at 14:32:38 UTC, JohnCK wrote: I said on IRC recently that D has genius programmers in it, but mediocre managers and marketers. Agreed. Don't let Andrei baptise any phobos stuff, he is a genius :)
Re: Thoughts on a Future Garbage Collector
A little something I've been working on for making into a DIP: http://wiki.dlang.org/User:Alphaglosined/ManagedMemory Would it be to your liking? I don't know - what does it do? I am pretty new to D... !
Re: DConf 2016 news: 20% sold out, book signing
On Monday, 7 December 2015 at 17:39:14 UTC, Andrei Alexandrescu wrote: Looking forward to seeing you at DConf! Just found out I won't be able to come, so will the entire thing be live streamed?
Re: DConf 2016 news: 20% sold out, book signing
On Friday, 11 December 2015 at 18:50:29 UTC, Jack Stouffer wrote: On Monday, 7 December 2015 at 17:39:14 UTC, Andrei Alexandrescu wrote: Looking forward to seeing you at DConf! Just found out I won't be able to come, so will the entire thing be live streamed? It is on the list but definitive answer will be known closer to the conference when all technical points of venue preparation are taken care of.
Re: How To Call D Code from Objective C?
I found a way to call C from in Objective C. The big trick is to rename a .m file to a .mm file. So, I think there's probably a way for me to link a compiled C dylib into Objective C and then load its .h header file so that Objective C can call those C functions. I'll be using GCC to statically combine the D's .o code in with the C code. So, I'm thinking the process is like this: 1. Create a D function d_test() that takes a string input, concatenates on "-response", and returns the result. Compile as dtest.o with "dmd -c dtest.d". 2. Create a C function c_test() that takes a string input, calls d_test() and passes it the string, and then returns the response from d_test() out of c_test() as a string result. Compile as ctest.dylib with "gcc -dynamiclib -o ctest.dylib ctest.c dtest.o -L/usr/local/lib -lphobos2 -lpthread -lm". 3. In Xcode IDE, add this ctest.dylib linked library. Then, create a ctest.h for the function declaration. 4. In Objective C, import ctest.h in my main.mm file and then call with something like NSLog("RESULT=%s",c_test("request")); That should create a debugger line that reads: RESULT=request-response. The problem is that I don't know the entire way that I should create dtest.d and ctest.c.
[Issue 15433] New: std.experimental.allocator.building_blocks.free_map only compiles with -unittest
https://issues.dlang.org/show_bug.cgi?id=15433 Issue ID: 15433 Summary: std.experimental.allocator.building_blocks.free_map only compiles with -unittest Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: yazan.dab...@gmail.com std.experimental.allocator.building_blocks.free_map only compiles with -unittest. Pull request incoming. --
[Issue 15433] std.experimental.allocator.building_blocks.free_tree only compiles with -unittest
https://issues.dlang.org/show_bug.cgi?id=15433 yazan.dab...@gmail.com changed: What|Removed |Added Summary|std.experimental.allocator. |std.experimental.allocator. |building_blocks.free_map|building_blocks.free_tree |only compiles with |only compiles with |-unittest |-unittest --