Re: How to build static linked executable

2018-03-20 Thread David Nadlinger via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 10:37:55 UTC, zunkree wrote: On Sunday, 18 March 2018 at 14:36:04 UTC, Jacob Carlborg wrote: FYI, -static is not support on macOS. So, how to build static binary for macOS? Static binaries aren't really supported by Apple (anymore). What do you need it for? —

Re: Slow start up time of runtime

2018-03-20 Thread David Nadlinger via Digitalmars-d-learn
On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote: Are there ways to reduce this to below 0.1s, or should I just leave idiomatic D and make a betterC program? The best solution would be to profile the startup process and file a bug accordingly. ;) — David

Re: Does the compiler inline the predicate functions to std.algorithm.sort?

2018-03-18 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 18 March 2018 at 14:15:37 UTC, Stefan Koch wrote: On Sunday, 18 March 2018 at 12:59:06 UTC, tipdbmp wrote: I can't read assembly but it seems to me that it doesn't: https://godbolt.org/g/PCsnPT I think C++'s sort can take a "function object" that can get inlined. Correct it does

Re: Convert output range to input range

2018-03-17 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 16 March 2018 at 07:57:04 UTC, John Chapman wrote: I need to write to a range created with outputRangeObject, then read from it. Is there a way to convert it to an input range? Could you illustrate your problem a bit further? In the literal sense, converting from an output to an

Re: Terminating multiple processes

2018-02-01 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 1 February 2018 at 11:42:32 UTC, Russel Winder wrote: The problem is actually a thread blocked in an inotify blocking read. As both Steven and yourself have pointed out I am going to have to use a timeout to check the state of the application. There are better solutions

Re: Get aliased type

2018-01-02 Thread David Nadlinger via Digitalmars-d-learn
On Tuesday, 2 January 2018 at 11:42:49 UTC, John Chapman wrote: Because an alias of a type is just another name for the same thing you can't test if they're different. I wondered if there was a way to get the aliased name, perhaps via traits? (.stringof returns the original type.) There is

Re: partial application for templates

2017-12-25 Thread David Nadlinger via Digitalmars-d-learn
On Monday, 25 December 2017 at 20:39:52 UTC, Mengu wrote: is partially applying templates possible? Check out std.meta.Apply{Left, Right}. — David

Re: Does LDC support profiling at all?

2017-12-23 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 23 December 2017 at 12:23:33 UTC, Johan Engelen wrote: Fine grained PGO profiling: -fprofile-instr-generate http://johanengelen.github.io/ldc/2016/07/15/Profile-Guided-Optimization-with-LDC.html Function entry/exit profiling: -finstrument-functions

Re: Is there anyway to access LLVM's 128 bit int type for C from LDC?

2017-12-14 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 14 December 2017 at 19:47:53 UTC, Jack Stouffer wrote: Clang has __int128. Is there anyway to use this with D with LDC? There has been some work on this a while ago, by Kai, but it hasn't been merged yet: https://github.com/ldc-developers/ldc/pull/1355 — David

Re: Get pointer or reference of an element in Array(struct)

2017-12-09 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 9 December 2017 at 06:46:27 UTC, Arun Chandrasekaran wrote: Thanks. Just curious why reference can't be obtained here. Saves nasty null checks in most places. D simply doesn't have a (C++-style) concept of references as part of the type. Arguments can be passed by reference -

Re: GDC generate wrong .exe ("not a valid win32 application")

2017-06-21 Thread David Nadlinger via Digitalmars-d-learn
On Monday, 19 June 2017 at 14:08:56 UTC, Patric Dexheimer wrote: Fresh install of GDC. (tried with 32x ad 32_64x) Where did you get the GDC executable from? The GDC project doesn't currently offer any official builds that target Windows; the 6.3.0 builds from https://gdcproject.org/downloads

Re: libc dependency

2017-06-21 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 21 June 2017 at 06:58:43 UTC, Jacob Carlborg wrote: Musl (or similar) should be available as an alternative. That will make it easier to cross-compile as well. This is not relevant for cross-compilation, as long as you have the libraries available. You can actually link a D

Re: libc dependency

2017-06-20 Thread David Nadlinger via Digitalmars-d-learn
On Tuesday, 20 June 2017 at 18:51:17 UTC, Moritz Maxeiner wrote: On Tuesday, 20 June 2017 at 12:09:06 UTC, Jacob Carlborg wrote: LLD, the LLVM linker [1]. As far as I understand it, it also support cross-platform linking. Using LDC, musl and LLD you have a fully working cross-compiler tool

Re: std.path.buildPath

2017-06-03 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 3 June 2017 at 14:12:03 UTC, Russel Winder wrote: I have no idea what drugs the person who chose that last one to be correct semantics was on at the time, but it was some seriously bad stuff. Of all people, I certainly didn't expect you to stray so far from the tone appropriate

Re: C macros vs D can't do the right thing

2017-06-03 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 3 June 2017 at 14:19:00 UTC, Jacob Carlborg wrote: Perhaps using the variadic template with a constraint on one element trick will work. Ugly, but I think that will work. We could also finally fix the frontend to get around this. At DConf 2015, Walter officially agreed that this

Re: C macros vs D can't do the right thing

2017-06-03 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 3 June 2017 at 13:17:46 UTC, Russel Winder wrote: Is this a problem in D or a problem in DStep? It's a limitation of DStep – for that use case, it would need to transform one of the macro arguments into a template argument rather than a runtime function parameter. If you need

Re: std.socket classes

2017-04-10 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 9 April 2017 at 14:47:39 UTC, Jonathan Marler wrote: My guess is that making Socket a class prevents socket handle leaks because you can clean up the handle in the destructor when the memory gets freed if no one closes it. Is this the reason it is a class and are there any other

Re: Is DMD breaking BigInt?

2017-04-07 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 7 April 2017 at 17:06:31 UTC, Russel Winder wrote: If anyone has any useful intelligence as to what happening and how I can workaround it, I'd be a grateful bunny. You might want to check with LDC from Git master first to see whether it is in fact a 2.073-related problem. — David

Re: GitHub detects .d source as Makefile?

2017-03-17 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 18 March 2017 at 00:34:57 UTC, XavierAP wrote: Is this a known issue with D on GitHub? Should I report it I guess? How smart is GH that it doesn't look at the file extension? What happened? The extension .d can legitimately refer to makefiles as well (specifically, to dependency

Re: Writing pattern matching macros in D.

2017-03-06 Thread David Nadlinger via Digitalmars-d-learn
On Monday, 6 March 2017 at 02:20:02 UTC, Deech wrote: […] add pattern matching to the language as a macro. D doesn't have macros per se. However, template metaprogramming and mixins can replace them in many cases. Which particular form of pattern matching do you have in mind? You won't get

Re: Why is [0] @safer than array.ptr?

2017-01-25 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 25 January 2017 at 22:59:55 UTC, Jonathan M Davis wrote: Yes, but my point is that you're normally only going to use .ptr to pass something to a C function, and even if you're doing more with it in D, odds are, you're going to be doing pointer arithmetic. Wrong again. If this

Re: Why is [0] @safer than array.ptr?

2017-01-25 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 25 January 2017 at 22:54:32 UTC, Adam D. Ruppe wrote: On Wednesday, 25 January 2017 at 22:46:10 UTC, David Nadlinger wrote: This is because every pointer in SafeD is dereferencable. But null pointers are allowed in SafeD and arr.ptr is either arr[0] or null

Re: Why is [0] @safer than array.ptr?

2017-01-25 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 25 January 2017 at 18:12:18 UTC, Jonathan M Davis wrote: Fine, but in the vast majority of cases, you're calling .ptr, because you're going to be passing the pointer to C code, in which case, doing [0] buys you very little, since the C code is inevitably going to be reading more

Re: Why is [0] @safer than array.ptr?

2017-01-25 Thread David Nadlinger via Digitalmars-d-learn
On Tuesday, 24 January 2017 at 11:38:16 UTC, Jonathan M Davis wrote: It seems _slightly_ better from a safety perspective but only slightly. Wrong – one is correct, the other is not. This is because every pointer in SafeD is dereferencable. Pointer arithmetic is not allowed in SafeD, so your

Re: Reinstalled Mac

2016-09-28 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 29 September 2016 at 01:33:00 UTC, Joel wrote: Oops, I got confused and installed with homebrew. I was going to try DVM. Jacob is also the author of DVM, so he might be a bit biased. ;) I've had good experiences using Homebrew, although you sometimes have to wait a day or three

Re: Compiling vibe.d application for Amazon ec2 instance

2016-09-14 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 14 September 2016 at 12:13:58 UTC, Seb wrote: You should try -static in ldc, it's works like a dream for me :) Yep, LDC supports fully static linking on Linux (and is currently the only compiler to do so). — David

Re: Fast multidimensional Arrays

2016-08-29 Thread David Nadlinger via Digitalmars-d-learn
On Monday, 29 August 2016 at 10:20:56 UTC, rikki cattermole wrote: By the looks you're not running the tests more then once. Druntime initialization could be effecting this. Please execute each test (without memory allocation) 1 times atleast and then report back what they are. D program

Re: InterlockedIncrement, InterlockedCompareExchange, etc

2016-08-28 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 28 August 2016 at 21:52:48 UTC, Illuminati wrote: Also D doesn't seem to have a volitile keyword anymore which is required to prevent the compiler from prematurely optimizing critical code. It isn't. In fact, using volatile to achieve thread synchronisation (seeing as this is what

Re: How to avoid ctRegex (solved)

2016-08-27 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 27 August 2016 at 17:47:33 UTC, Dicebot wrote: But actual value of that Regex struct is perfectly known during compile time. Thus it is possible and fine to use it as initializer. You can use any struct or class as initializer if it can be computed during compile-time. Yes,

Re: Is it's possible to install DMD/LDC/GDC on CoreOS?

2016-08-21 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 21 August 2016 at 14:57:15 UTC, Seb wrote: An alternative would be to compile your application locally, then copy it over to your container. I don't know how similar CoreOs to a typical Linux distribution is, but if it comes with the typical shared libraries (libm.so, libc.so,

Re: Is it's possible to install DMD/LDC/GDC on CoreOS?

2016-08-21 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 21 August 2016 at 11:38:09 UTC, Suliman wrote: I would like to create small VPS instance with Linux distrib on VPS. Can I use CoreOS as image? Would it possible to install dlang there? For LDC, you can just download the latest release from

Re: typeof.stringof wrong type

2016-08-19 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 19 August 2016 at 15:47:00 UTC, ag0aep6g wrote: https://dlang.org/spec/property.html#stringof Someone should edit that, if fullyQualifiedName is no good either. Indeed. I'm sure the change was well-intentioned, but symbol visibility/import concerns and Voldemort types should make

Re: typeof.stringof wrong type

2016-08-19 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 19 August 2016 at 15:15:55 UTC, ag0aep6g wrote: I think that qualifies as a bug, because fullyQualifiedName is supposed to be usable in code generation. This is a misconception. Neither .stringof nor fullyQualifiedName should *ever* be used in code generation. There is a myriad of

Re: Searching for a T in a T[]

2016-06-22 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 22 June 2016 at 08:04:34 UTC, Nordlöw wrote: Is there now algorithm (similar to `canFind`) that can search for a `T` in a `T[]`? Existing `canFind` only supports sub-sequence needles. What about http://dlang.org/phobos/std_algorithm_searching.html#.canFind.canFind.2? — David

Re: D casting broke?

2016-06-19 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 19 June 2016 at 21:06:43 UTC, Joerg Joergonson wrote: A!b is derived from A!a if b is derived from a, is it not? If not, then I am wrong, if so then D casting has a bug. You are wrong. The array example given by Adam is actually a neat illustration of precisely your question if

Re: Default initialization of structs?

2016-06-17 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 17 June 2016 at 11:10:12 UTC, Gary Willoughby wrote: Thanks, I forgot to mention I'm also doing lots of other stuff in the constructor to private fields too. struct Foo(T) { private int _bar; private void* _baz; this(int bar = 8) { this._bar = bar;

Re: An Alternative to Deimos' OpenSSL Bindings

2016-06-12 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 12 June 2016 at 21:49:21 UTC, Vladimir Panteleev wrote: On Sunday, 12 June 2016 at 19:12:37 UTC, Meta wrote: I wanted to use OpenSSL from D but I noticed that the Deimos bindings are for version 1.0.0e, which according to OpenSSL.org is an out of date version. Are there any bindings

Re: Why can't I assign a mixin to an alias?

2016-06-10 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 10 June 2016 at 22:38:29 UTC, Dechcaudron wrote: Error: basic type expected, not mixin Why should it be like that? I believe the compiler should not impose restrictions on what mixins can or cannot do :/ This might be a gratuitous grammar restriction. There are a few of those

Re: What's up with GDC?

2016-06-10 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 10 June 2016 at 22:01:15 UTC, Joerg Joergonson wrote: The problem I'm getting with ldc, using your simpledisplay, is that the libs aren't loading due to the wrong format. It's the omf vs coff thing or whatever, I guess... How do you mean that? LDC/MSVC uses COFF, and there should

Re: What's up with GDC?

2016-06-10 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 10 June 2016 at 20:30:36 UTC, Joerg Joergonson wrote: Well, the post was a bit incoherent because getting all this stuff working is. I was searching for ldc and ran across some web site that had only the sources(same for gdc). […] Why isn't there a proper binaries for ldc and gdc

Re: Why I can't pass to datetime.benchmark function with parameters?

2016-04-24 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 23 April 2016 at 18:52:30 UTC, Suliman wrote: My error. I mean it should be: auto r = benchmark!(foo(4))(1); But thanks for answer! This would use the result of foo(4) as the template parameter. Use e.g. { foo(4); } instead (a function that calls foo with the desired argument).

Re: Instantiate!(Template, args) in Phobos?

2016-04-22 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 21 April 2016 at 14:47:55 UTC, Nick Treleaven wrote: I found std.meta.ApplyLeft but it doesn't seem to work here. I've needed this before and ended up doing a workaround with a template block and temporary alias but it might be nice if Phobos had this. Or is there a simpler

Re: My is the order of parameters reversed for functions that are dynamically loaded from shared C libraries?

2015-11-15 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 15 November 2015 at 17:54:27 UTC, David Nies wrote: How can I make sure the order is correct? Whenever you use a C function, it must be marked as, even if it's through a function pointer as in this case. Just apply the attribute to the dll2_fn and dll3_fn declarations. Hope this

Re: My is the order of parameters reversed for functions that are dynamically loaded from shared C libraries?

2015-11-15 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 15 November 2015 at 18:02:01 UTC, David Nies wrote: How do I mark it as such? Can you please give an example? Thanks for the quick reply! :) Just add extern(C) to the beginning of the "alias" line. — David

Re: good reasons not to use D?

2015-10-31 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 31 October 2015 at 18:23:43 UTC, rumbu wrote: My opinion is that a decimal data type must be builtin in any modern language, not implemented as a library. "must be builtin in any modern language" – which modern languages actually have decimals as a built-in type, and what is your

ORM libraries for D

2015-09-24 Thread David Nadlinger via Digitalmars-d-learn
Hi all, I'm having a look at ORM libraries in D right now. So far, I've come across hibernated and dvorm. Are there any other libraries that I should have a look at, particularly actively maintained ones? dvorm and hibernated seem to have received no work during the last couple of months.

Re: ORM libraries for D

2015-09-24 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 24 September 2015 at 13:24:14 UTC, Rikki Cattermole wrote: Dvorm is more or less feature complete :) I am the author of it, but unless issues come up I do not intend to continue working upon it. Do you know whether somebody has written an SQLite provide for it? I was going to

Re: Seems core.thread.Fiber is broken dmd windows 64-bit build

2015-03-09 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 8 March 2015 at 18:18:49 UTC, Carl Sturtivant wrote: Should I be doing something special with linkage so this works? What is going on? IIRC there are some fixes to the Win64 context switching code in the 2.067 or master druntime. You might want to try those first before spending

Re: How do I write __simd(void16*, void16) ?

2014-10-09 Thread David Nadlinger via Digitalmars-d-learn
On Thursday, 9 October 2014 at 20:29:44 UTC, Benjamin Thaut wrote: Unforunately the gcc.buildints module seems to be generated during compilation of gdc, so you might want to get a binary version or compile it yourself to see the module. By the way, LDC has ldc.gccbuiltins_x86 too. LLVM

Re: DUB Errors

2014-10-04 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 3 October 2014 at 23:00:53 UTC, Brian Hechinger wrote: With my old set of packages I had no problems. I just now deleted ~/.dub and now I too get this error. Some issue with the openssl module, yes, but what? This is a bit of an issue. :) At first glance, this seems like a forward

Re: Building a dmd that works on old systems: TLS problems with libc

2014-10-03 Thread David Nadlinger via Digitalmars-d-learn
On Friday, 3 October 2014 at 08:47:07 UTC, Atila Neves wrote: ld: .../libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1

Re: String Theory Questions

2014-09-13 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 13 September 2014 at 22:41:39 UTC, AsmMan wrote: D string are actullay C-strings? No. But string *literals* are guaranteed to be 0-terminated for easier interoperability with C code. David

Re: Installing LDC on Windows

2014-09-06 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 6 September 2014 at 17:51:16 UTC, Trass3r wrote: SEH was patented, so llvm doesn't support it. That has changed. Has it? SEH on Win64 is something entirely different from the original (x86) SEH design, and not covered by said patent. David

Re: Installing LDC on Windows

2014-09-06 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 6 September 2014 at 16:11:55 UTC, Russel Winder via Digitalmars-d-learn wrote: I installed the other MinGW option and it provides libgcc_s_sjlj-1.dll which is not helping me actually run ldc2 on Windows :-( It is mentioned both the in README coming with the Windows packages and

Re: Installing LDC on Windows

2014-09-06 Thread David Nadlinger via Digitalmars-d-learn
On Saturday, 6 September 2014 at 16:36:38 UTC, Kagamin wrote: Looks like mingw supports 3 types of exception handling. LDC usually tightly coupled with mingw version, you shouldn't try it blindly, but follow installation instructions instead. It's not really tightly coupled to the MinGW

Re: Threadpools, difference between DMD and LDC

2014-08-04 Thread David Nadlinger via Digitalmars-d-learn
On Monday, 4 August 2014 at 05:14:22 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: This is correct – the LLVM optimizer indeed gets rid of the loop completely. OK,that's clever. But I get this even when put a writeln(some msg) inside the task. I thought a write couldn't be optimized

Re: Threadpools, difference between DMD and LDC

2014-08-03 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 3 August 2014 at 22:24:22 UTC, safety0ff wrote: On Sunday, 3 August 2014 at 19:52:42 UTC, Philippe Sigaud wrote: Can someone confirm the results and tell me what I'm doing wrong? LDC is likely optimizing the summation: int sum = 0; foreach(i; 0..task.goal) sum +=

Re: Some kind of RPC exists for D?

2014-06-18 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 19:24:03 UTC, Bienlein wrote: I'm looking for a way to do some kind of RPC in D. Some way of being able to say aFoo.bar(int i, ...) with receiver object and method being marshalled at the sender's site and being unmarshalled and invoked at the receiver's site. Any

Run child process with null stdin/stdout

2014-06-18 Thread David Nadlinger via Digitalmars-d-learn
Hi all, is there a platform independent way to do the equivalent of some_program /dev/null /dev/null using std.process? I neither want to capture/print the standard output of the child process nor have anything available on its input. Quite probably, I'm just missing something obvious…

Re: Run child process with null stdin/stdout

2014-06-18 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 20:00:43 UTC, Justin Whear wrote: For POSIX, seems like you could pass `File(/dev/null, r)` for stdin and `File(/dev/null, w)`. On Windows I believe you can use `File (nul)` for the same effect. Implementing this myself is of course always an option, yes, but

Re: DMD Compiler Version Dependent Conditional Compilation

2014-06-09 Thread David Nadlinger via Digitalmars-d-learn
On Monday, 9 June 2014 at 17:36:10 UTC, Nordlöw wrote: Can I use the version keyword or static if to perform conditional compilation that depends on the version of DMD? The __VERSION__ magic token should do the job. David

Re: Array!T and find are slow

2014-05-14 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 14 May 2014 at 14:24:28 UTC, Damian Day wrote: I've written some search functions, which are many times faster, is it worth making a pull request? Generally, we strive to make the algorithms in Phobos as fast as possible even in the general case. I didn't look at the issue at

Re: Array!T and find are slow

2014-05-14 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 14 May 2014 at 15:42:13 UTC, Damian Day wrote: On Wednesday, 14 May 2014 at 14:54:57 UTC, David Nadlinger wrote: Could you post a short benchmark snippet explicitly showing the problem? Benchmark found here: http://dpaste.dzfl.pl/0058fc8341830 Unfortunately, I don't have

Re: Array!T and find are slow

2014-05-14 Thread David Nadlinger via Digitalmars-d-learn
On Wednesday, 14 May 2014 at 17:36:35 UTC, monarch_dodra wrote: Adding a special case in Array.Range allows bypassing the repeated indexing costs, but at the very least, should be implemented in terms of find itself, eg: Shouldn't the extra indirection just vanish into thin air once opIndex

Re: What's the current phobos way to define generic data sources and sinks?

2014-04-16 Thread David Nadlinger
On Wednesday, 16 April 2014 at 21:05:30 UTC, Hannes Steffenhagen wrote: I've looked at std.stream, but it says in big red scary letters that I probably shouldn't be using it. Is there a suitable replacement? If not, I'd just roll my own and provide a couple of templates to automatically

Re: TLF = thread local functions

2014-01-23 Thread David Nadlinger
On Thursday, 23 January 2014 at 16:15:46 UTC, Frustrated wrote: The point is that making the **STACK** TLS too should a way around having to use synchronization. Precisely because the STACK is not TLS makes functions not thread safe(since data is already safe in d). Maybe you could

Re: Another purity question

2014-01-14 Thread David Nadlinger
On Tuesday, 14 January 2014 at 19:50:10 UTC, bearophile wrote: But is it possible for D to see that bar function as pure? In the general case, no: --- auto foo(const int[] a) { int bar() { return a[0]; } return bar; } void main() { int[3] a; auto dg = foo(a[]);

Re: Another purity question

2014-01-14 Thread David Nadlinger
On Tuesday, 14 January 2014 at 20:36:43 UTC, Timon Gehr wrote: Yes, it should. https://d.puremagic.com/issues/show_bug.cgi?id=9148 And, of course, you are right. ;) I missed the analogy to member functions w.r.t. the implicit context parameter. Shame on me. David

Re: pure is as pure does with LLVM compiler

2014-01-13 Thread David Nadlinger
On Monday, 13 January 2014 at 15:12:21 UTC, Ben Cumming wrote: On Monday, 13 January 2014 at 14:32:03 UTC, Dicebot wrote: I don't think 2.064 LDC has been released yet So I see, thanks. The merge-2.064 branch in Git is stable enough already for most purposes, so if you don't mind building

Re: Ultra-pure map()?

2013-12-27 Thread David Nadlinger
On Saturday, 28 December 2013 at 01:41:35 UTC, David Held wrote: Can someone explain to me why map() is not equivalent to foreach in the code above? From what I can tell, map() doesn't do anything at all on objs, even though it is a perfectly legitimate range (as far as I can tell). map()

Re: std.net.curl - get() is too slow

2013-12-20 Thread David Nadlinger
On Friday, 20 December 2013 at 18:23:30 UTC, Benji wrote: When I call get() function from std.net.curl, I notice it's extremely slow! Maybe 50 times slower than in Python.. Is there any better/faster alternative? How do you benchmark the functions? David

Re: How to correctly deal with unicode strings?

2013-11-27 Thread David Nadlinger
On Wednesday, 27 November 2013 at 14:34:15 UTC, Gary Willoughby wrote: Here i understand what is happening but how could i improve this example to make the expected asserts true? In this specific example you could e.g. use std.uni.normalize, which by default puts the string into NFC, which

Re: pure-ifying my code

2013-11-17 Thread David Nadlinger
On Sunday, 17 November 2013 at 10:33:12 UTC, Philippe Sigaud wrote: But `popFront()` changes an internal state with visible, external effects: it changes `front` return value and in the end, it will affect `empty` return value. So no, I don't consider `popFront` to be pure. That's actually

[challenge] Lazy flatten/avoiding type forward reference with map

2013-10-31 Thread David Nadlinger
A while back, somebody raised the topic of implementing a lazy range for traversing/flattening a tree structure on #d. The obvious (in terms of Phobos primitives) solution would be something along the lines of this: --- struct Node(T) { T val; Node!T[] children; } auto

Re: Lambda are capricious little animals indeed

2013-10-27 Thread David Nadlinger
On Sunday, 27 October 2013 at 14:01:31 UTC, Derix wrote: I get the immutable(char)[] : an immutable array of characters, why not. But I really dont get the set of parens between the square brackets and the asterisk. Could that mean that what I get is in fact a pointer to a function ? (said

Re: Building derelict

2013-10-22 Thread David Nadlinger
On Tuesday, 22 October 2013 at 22:24:36 UTC, bioinfornatics wrote: derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn unknown size derelict/pq/types.d(117): Error: struct derelict.pq.types.PGconn no size yet for forward reference That's with LDC, right? We definitely need to

Re: Derelict Assimp RemoveComponent

2013-09-26 Thread David Nadlinger
On Wednesday, 25 September 2013 at 15:32:08 UTC, Lemonfiend wrote: The docs only mention http://assimp.sourceforge.net/lib_html/config_8h.html#afc0a4c00fb90c345eb38fe3f7d7c8637 which is less than helpful.. I'm not sure what the problem is here. Just as the docs say, you have to set the

Re: join of range of ranges?

2013-09-22 Thread David Nadlinger
On Sunday, 22 September 2013 at 14:26:14 UTC, bearophile wrote: In some cases I'd like to join a range of ranges in a single array/string (I know here the inner map could be replaced by something better, this code is just an example): std.algorithm.joiner, or am I missing something? David

Re: Unable to use tradional tools to find memory leaks

2013-09-21 Thread David Nadlinger
On Saturday, 21 September 2013 at 17:03:14 UTC, Brad Roberts wrote: That's wrong. Both DMD and Valgrind are software, both of which can be debugged and changed. Please file appropriate bug reports, hopefully with nicely minimized test cases. I ran into an issue like this once where DMD would

Re: is the tools part of the test suite? currently tools/ddemangle doesn't compile on git master

2013-08-24 Thread David Nadlinger
On Saturday, 24 August 2013 at 03:20:42 UTC, Timothee Cour wrote: More often than not, the tools submodule ( https://github.com/D-Programming-Language/tools) will not build on git master. So I'm wondering whether it's even being tested before pushing commits. In short: no, unfortunately.

Re: Large (32 byte) concurrency messages

2013-08-08 Thread David Nadlinger
On Thursday, 8 August 2013 at 20:08:11 UTC, JR wrote: Passing by value, e.g. tid.send(eventStruct); core.exception.AssertError@/usr/include/d/4.8/std/variant.d(280): target must be non-null http://d.puremagic.com/issues/show_bug.cgi?id=9122, should be fixed now. Passing by immutable, e.g.

Re: Large (32 byte) concurrency messages

2013-08-08 Thread David Nadlinger
On Thursday, 8 August 2013 at 20:08:11 UTC, JR wrote: I put together http://dpaste.dzfl.pl/d7322971 earlier to demonstrate some of these errors, though I didn't mention the raciness of passing pointers there. To test that race I used http://dpaste.dzfl.pl/e6fd4569. That's just a bug in your

Re: Socket.select interrupted system call because of GC

2013-08-03 Thread David Nadlinger
On Saturday, 3 August 2013 at 13:19:53 UTC, dennis luehring wrote: but you should not reduce your sample down to maybe-incorrect (what it seems for me in this case) - the join wouldn't make your sample to big The example given is correct, as druntime guarantees that non-daemon threads will

Re: Socket.select interrupted system call because of GC

2013-08-03 Thread David Nadlinger
On Saturday, 3 August 2013 at 15:59:30 UTC, Marek Janukowicz wrote: It's really nice to have some chat about the correctness of example code snippets, but can anyone help me with the original issue? :) Sorry, apparently I forgot to include the actual content:. ;) Socket.select is an ancient

Re: Friend class and methods

2013-06-12 Thread David Nadlinger
On Wednesday, 12 June 2013 at 19:01:24 UTC, Maxime Chevalier-Boisvert wrote: Does D have something like the concept of friend classes and functions in C++? I'd like to have a function that can access private members of two classes at the same time. No (t really), you have to stick the two

Re: until strange behavior

2013-06-02 Thread David Nadlinger
On Sunday, 2 June 2013 at 13:26:02 UTC, Jack Applegame wrote: It is something wrong with ElementType template. ElementType works as intended. As to whether that is a good idea… – just search the NG archives for string range element type or something like that. David

Re: two mains

2013-01-27 Thread David Nadlinger
On Saturday, 26 January 2013 at 20:42:27 UTC, Tyro[17] wrote: Trying to learn from the ground up and would appreciate some assistance making sense of the following: // void main(){} [1] [...] This might not be directly relevant here, but in general, I'd steer clear of main() for such

Re: two mains

2013-01-27 Thread David Nadlinger
On Saturday, 26 January 2013 at 20:57:54 UTC, Tyro[17] wrote: On 1/26/13 3:42 PM, Tyro[17] wrote: The second is the use of leave in [2]. If I understand correctly, leave is the exact same as: movRBP,RSP popRBP So why do we need to mov RBP, RSP in [2] but not in [1]?

Re: Is this a bug?

2013-01-16 Thread David Nadlinger
Yes, this seems to be a DMD codegen bug – works with LDC. David

Re: this(this) / opAssign

2013-01-10 Thread David Nadlinger
On Thursday, 10 January 2013 at 23:37:14 UTC, Namespace wrote: Without a declared opAssign, this S s3; s3 = s1; also calls the postblit. That is strange. Think of it like this: Blit means bit-by-bit copy, so a postblit is a function that is invoked on the result of every bit-by-bit

Re: release mode optimization

2013-01-09 Thread David Nadlinger
On Thursday, 10 January 2013 at 00:40:21 UTC, Jonathan M Davis wrote: So clearly, dmd does _not_ optimize out the loop. I have no idea what gdc and ldc do though. Wow, DMD doesn't optimize it away indeed, just confirmed that by a look at the assembly. LDC does delete the loop though,

Re: release mode optimization

2013-01-09 Thread David Nadlinger
On Thursday, 10 January 2013 at 01:14:42 UTC, H. S. Teoh wrote: I tested DMD on a loop containing assert(true);, and apparently that *is* optimized out with -O. I tested it with the program from Jonathan's post – still has an empty inc/cmp/jl loop in there with -O -release (x86_64). David

Re: detecting POD types

2012-12-28 Thread David Nadlinger
On Sunday, 20 May 2012 at 13:50:17 UTC, japplegame wrote: I write function template that should works only with POD types (i.e. base types, structures, enums etc.). Is there something like C++11 std::is_pod (http://en.cppreference.com/w/cpp/types/is_pod) template? Sorry for resurrecting this

Re: AES-NI

2012-12-08 Thread David Nadlinger
On Saturday, 8 December 2012 at 20:14:09 UTC, Heinz wrote: Just in case i've been looking for the corresponding machine codes and can not find them, i've searched even in Intel's AES whitepaper with no luck. You probably want to have a look at the Intel Instruction Set Reference document.

Re: template error instantiating

2012-11-17 Thread David Nadlinger
On Saturday, 17 November 2012 at 18:28:10 UTC, ref2401 wrote: I get template instance main.MyClass!(int) error instantiating in the following case: public class MyClass(TStuff) { public void foo(TStuff item) {} public void foo(TRange)(TRange items) if

Re: Template mixin identifier as template alias parameter

2012-11-11 Thread David Nadlinger
On Sunday, 11 November 2012 at 10:36:42 UTC, Jacob Carlborg wrote: This won't work. The node template doesn't evaluate to a type and you wouldn't use it as a mixin if it did. You _can_ actually use an identifier for mixin templates, it is used to disambiguate in case of name collisions. As

Re: How to have strongly typed numerical values?

2012-09-06 Thread David Nadlinger
On Wednesday, 5 September 2012 at 05:53:49 UTC, anonymous wrote: I noticed two flaws in std.units: 1) Can't add quantities of the same type (this is probably trivial to fix). 2) Different scopes don't make different quantity types. Can you elaborate on that? I must admit that I didn't

Re: CT Busy Beaver

2012-08-19 Thread David Nadlinger
On Sunday, 19 August 2012 at 14:18:45 UTC, bearophile wrote: You get an optlink crash. I don't know if this is fit for Bugzilla. Any crashes should be submitted to Bugzilla, regardless of what input produced them. And besides that, the code presented here is actually quite short for a linker

Re: where is parameterNames?

2012-08-15 Thread David Nadlinger
On Tuesday, 14 August 2012 at 16:06:33 UTC, Jacob Carlborg wrote: https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L29 Related: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L510 David

Re: where is parameterNames?

2012-08-14 Thread David Nadlinger
On Tuesday, 14 August 2012 at 16:06:33 UTC, Jacob Carlborg wrote: I don't know if this works any better: https://github.com/jacob-carlborg/orange/blob/master/orange/util/Reflection.d#L29 It's a simple implementation. Nice hack, but when using this on functions you don't control, be aware

  1   2   3   >