Re: Zero-length static array spec

2015-02-26 Thread kinke via Digitalmars-d
Why's that? Shouldn't _all_ 0 size variables compare equal? I'd say that follows from the definition: array1 == array2 = all corresponding elements of both arrays are equal = no corresponding elements of both arrays are different For the last one, it's obvious that

Re: rvalue references

2015-06-06 Thread kinke via Digitalmars-d
On Wednesday, 3 June 2015 at 01:57:21 UTC, bitwise wrote: 'in' is currently useless because scope is not defined properly, and const is too restrictive. Also, because of DIP25, it's now even more useless. It seems a pretty sure bet that it will either continue to be completely useless or be

Re: Right after allocators: containers or database connectivity?

2015-06-09 Thread kinke via Digitalmars-d
On Tuesday, 9 June 2015 at 17:15:46 UTC, Dennis Ritchie wrote: On Tuesday, 9 June 2015 at 17:12:53 UTC, Liam McSherry wrote: I think containers would be the better option. D sorely needs to have basics like (de)queues and stacks in the standard library, as well as any other popular and useful

Re: rvalue references

2015-06-09 Thread kinke via Digitalmars-d
On Tuesday, 9 June 2015 at 17:38:00 UTC, Steven Schveighoffer wrote: But passing a large rvalue by value does not involve any moving of data, and can be abstracted to a pass by ref if needed. It's never less performing than an explicit pass by ref. Thanks Steve. The problem I see here on

Re: auto ref is on the docket

2015-06-23 Thread kinke via Digitalmars-d
On Tuesday, 23 June 2015 at 19:13:28 UTC, bitwise wrote: And I still think Timon's statement is untrue. There is a reason, which is that the new auto ref syntax forces reference parameters for all types(even primitives), where the old template approach does not. Timon suggested using another

Re: auto ref is on the docket

2015-06-23 Thread kinke via Digitalmars-d
On Tuesday, 23 June 2015 at 18:11:21 UTC, bitwise wrote: On Mon, 22 Jun 2015 19:09:45 -0400, Timon Gehr timon.g...@gmx.ch wrote: There is no reason to prevent templates from using the mechanism that generates only one copy. The two mechanisms shouldn't share the same syntax, because then

Re: auto ref is on the docket

2015-06-22 Thread kinke via Digitalmars-d
On Monday, 22 June 2015 at 23:04:14 UTC, Timon Gehr wrote: On 06/23/2015 12:18 AM, kinke wrote: In C++ there's no problem with const, so why they will be in D? Because const is transitive in D and therefore more restrictive. That's not a reason. Yes it is. It's just an additional

Re: auto ref is on the docket

2015-06-22 Thread kinke via Digitalmars-d
On Monday, 22 June 2015 at 18:34:37 UTC, Namespace wrote: On Monday, 22 June 2015 at 18:03:43 UTC, Temtaime wrote: I see no reasons why « ref in » is bad. Maybe someone explain ? It's also natural for those who came from C++. In C++ there's no problem with const, so why they will be in D?

Re: auto ref is on the docket

2015-06-22 Thread kinke via Digitalmars-d
On Monday, 22 June 2015 at 16:54:50 UTC, Marc Schütz wrote: On Monday, 22 June 2015 at 16:10:10 UTC, Namespace wrote: Rather than raising the matter of scope again and again, we should be thankful that a solution for this nasty problem is accepted and could be merged. I disagree strongly

Re: Naming things

2015-06-22 Thread kinke via Digitalmars-d
On Saturday, 20 June 2015 at 20:43:21 UTC, Nick Sabalausky wrote: On 06/20/2015 05:27 AM, Vladimir Panteleev wrote: [...] +1kazillion +1 ;)

Re: auto ref is on the docket

2015-06-27 Thread kinke via Digitalmars-d
On Saturday, 27 June 2015 at 11:10:49 UTC, Marc Schütz wrote: On Saturday, 27 June 2015 at 01:18:19 UTC, Jonathan M Davis wrote: That's a completely orthogonal issue to ref or auto ref. That's an @system operation (since taking the address of a local variable is @system), and it's up to you to

Re: auto ref is on the docket

2015-06-26 Thread kinke via Digitalmars-d
On Thursday, 25 June 2015 at 10:10:42 UTC, Jonathan M Davis wrote: Whether a reference escapes is an orthogonal issue. The return attribute is for dealing with that. The function should be able to return by ref or not and still accept both rvalues and lvalues for its parameters. As long as the

Evaluation order of index expressions

2015-05-24 Thread kinke via Digitalmars-d
code import core.stdc.stdio; static int[] _array = [ 0, 1, 2, 3 ]; int[] array() @property { printf(array()\n); return _array; } int start() @property { printf(start()\n); return 0; } int end() @property { printf(end()\n); return 1; } void main() { array[start..end] = 666;

Re: Evaluation order of index expressions

2015-05-24 Thread kinke via Digitalmars-d
On Sunday, 24 May 2015 at 19:48:05 UTC, Jonathan M Davis wrote: The original code is clearly wrong. And forcing the order of evaluation so that it's one way or the other just changes under which cases you end up with bugs. Mutating in an expression while using it multiple times in that

Re: Evaluation order of index expressions

2015-05-25 Thread kinke via Digitalmars-d
On Monday, 25 May 2015 at 08:00:15 UTC, Jonathan M Davis wrote: It might be completely well-defined and consistent, but it may not be what you expect, and even if it is, a slight change to the code could change the order. If the behavior isn't what I expect (and I don't think that's often

Re: Evaluation order of index expressions

2015-05-25 Thread kinke via Digitalmars-d
On Monday, 25 May 2015 at 17:21:05 UTC, Johannes Pfau wrote: import std.stdio; void main() { int a = 0; int bar() { a++; return a; } a += bar(); // = a = a + bar() writeln(a); } DMD: 2 GDC: 1 which one is correct? So what about my previous example?

Re: Evaluation order of index expressions

2015-05-25 Thread kinke via Digitalmars-d
On 05/25/2015 09:14 PM, Iain Buclaw via Digitalmars-d wrote: If the litmus test is What does GDC do?, then LDC is doing it the correct way. :-) Perfect. :) On Monday, 25 May 2015 at 19:17:48 UTC, Timon Gehr wrote: Even if it isn't. ;) It is - on its merge-2.067 branch. ;)

Re: new release doesn't work as advertised

2015-08-13 Thread kinke via Digitalmars-d
On Thursday, 13 August 2015 at 17:56:06 UTC, tcak wrote: On Thursday, 13 August 2015 at 16:44:09 UTC, David Nadlinger wrote: On Thursday, 13 August 2015 at 16:30:59 UTC, learn wrote: On Thursday, 13 August 2015 at 11:04:21 UTC, Rikki Cattermole wrote: It was posted there. It's a known issue.

Slice expressions - exact evaluation order, dollar

2016-06-17 Thread kinke via Digitalmars-d
The following snippet is interesting: <<< __gshared int step = 0; __gshared int[] globalArray; ref int[] getBase() { assert(step == 0); ++step; return globalArray; } int getLowerBound(size_t dollar) { assert(step == 1); ++step; assert(dollar == 0); globalArray = [

Re: Slice expressions - exact evaluation order, dollar

2016-06-25 Thread kinke via Digitalmars-d
Ping. Let's clearly define these hairy evaluation order details and add corresponding tests; that'd be another advantage over C++.

Re: Slice expressions - exact evaluation order, dollar

2016-06-26 Thread kinke via Digitalmars-d
On Sunday, 26 June 2016 at 08:08:58 UTC, Iain Buclaw wrote: Now when creating temporaries of references, the reference is stabilized instead. New codegen: *(_ptr = getBase()); _lwr = getLowerBound(_ptr.length); _upr = getUpperBound(_ptr.length); r = {.length=(_upr - _lwr), .ptr=_ptr.ptr +

Re: rval->ref const(T), implicit conversions

2016-01-19 Thread kinke via Digitalmars-d
On Monday, 18 January 2016 at 17:48:39 UTC, Namespace wrote: You don't give up, huh? ;) I'm glad he doesn't. I couldn't agree more with Manu. It's the one thing I really, I mean *really* detest about D. To me, this rvalue-to-ref bindability is 100x more important than the GC. Yet it keeps on

Re: Running DMD tests on Windows / build requirements

2016-02-20 Thread kinke via Digitalmars-d
On Saturday, 20 February 2016 at 00:25:12 UTC, Martin Krejcirik wrote: How do I run DMD tests on Windows ? I'm not able to, even with gmake. You may want to have a look at http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC#Running_the_dmd-testsuite_tests for some tools

Re: Running DMD tests on Windows / build requirements

2016-02-21 Thread kinke via Digitalmars-d
On Sunday, 21 February 2016 at 16:45:14 UTC, Martin Krejcirik wrote: LINK : fatal error LNK1104: cannot open file 'libucrt.lib' --- errorlevel 1104 Stock dmd doesn't require libucrt.lib. If I copy it to dmd2\windows\lib64 a get: D:\devel\bugs>dmd -m64 utfbug DMD v2.068 DEBUG

Re: Good project: stride() with constant stride value

2016-03-04 Thread kinke via Digitalmars-d
On Friday, 4 March 2016 at 17:49:09 UTC, John Colvin wrote: Surely after inlining (I mean real inlining, not dmd) it makes no difference, a constant is a constant? I remember doing tests of things like that and finding that not only did it not make a difference to performance, ldc produced

Re: Good project: stride() with constant stride value

2016-03-05 Thread kinke via Digitalmars-d
On Friday, 4 March 2016 at 20:14:41 UTC, Andrei Alexandrescu wrote: This is just speculation. When the stride is passed to larger functions the value of the stride is long lost. I understand the desire for nice and simple code but sadly the stdlib is not a good place for it - everything must

Re: Slice expressions - exact evaluation order, dollar

2016-07-13 Thread kinke via Digitalmars-d
On Wednesday, 13 July 2016 at 21:06:28 UTC, kinke wrote: On Monday, 27 June 2016 at 02:38:22 UTC, Timon Gehr wrote: The point is that the slice expression itself does or does not see the updates based on whether I wrap base in a lambda or not. I don't really see a necessity for the lambda to

Re: Slice expressions - exact evaluation order, dollar

2016-07-13 Thread kinke via Digitalmars-d
On Monday, 27 June 2016 at 02:38:22 UTC, Timon Gehr wrote: As far as I understand, for the first expression, code gen will generate a reference to a temporary copy of base, and for the second expression, it will generate a reference to base directly. If lwr() or upr() then update the ptr

C++ interop

2017-01-30 Thread kinke via Digitalmars-d
I was wondering whether C++ interop is already considered sufficiently working enough, as I don't see any plans for improving it in the H1 2017 vision, except for the `C++ stdlib interface` bullet point. IMO, the main obstacles for mixed D/C++ RAII-style code are: 1) Constructors don't work

Re: `in` no longer same as `const ref`

2017-01-30 Thread kinke via Digitalmars-d
On Monday, 30 January 2017 at 19:05:33 UTC, Q. Schroll wrote: Can't we make "in" mean "const scope ref", that binds on r-values, too? Effectively, that's (similar to) what "const T&" in C++ means. It's a non-copying const view on the object. We have the longstanding problem, one must overload

Re: pragma(mangle,"name") for a type?

2017-02-14 Thread kinke via Digitalmars-d
Side note: Microsoft uses a different C++ mangling...

Re: Updating Windows SDK static libraries of the DMD distribution

2017-02-14 Thread kinke via Digitalmars-d
On Tuesday, 14 February 2017 at 14:11:31 UTC, Sönke Ludwig wrote: It's a quite frequent issue to get unresolved externals on Windows, because the lib files of the Windows platform SDK are still stuck at Windows XP age. It would make a lot of sense to update those to the latest Windows 10 SDK,

Re: syntax sugar: std.path::buildPath instead of from!"std.path".buildPath

2017-02-14 Thread kinke via Digitalmars-d
On Tuesday, 14 February 2017 at 20:03:13 UTC, Jonathan M Davis wrote: That being said, at some point, you have to ask whether each added feature is worth the cost when you consider how it's going to clutter up function signatures even further. And while I do think that there is value in DIP

Re: Usability of D on windows?

2016-08-25 Thread kinke via Digitalmars-d
On Wednesday, 24 August 2016 at 21:13:45 UTC, Guillaume Piolat wrote: A minor problem is that on Windows users expect both x86 and x86_64 builds so one has to juggle with the 2 LDC PATH to release both. I've said this thrice already and it's quite minor really. There's a multilib edition for

Re: std.math API rework

2016-10-06 Thread kinke via Digitalmars-d
On Thursday, 6 October 2016 at 20:55:55 UTC, Ilya Yaroshenko wrote: So, I don't see a reason why this change break something, hehe No, Iain is right. These LLVM intrinsics are most often simple forwarders to the C runtime functions; I was rather negatively surprised to find out a while ago.

Re: How to link *.a file on Windows?

2016-09-22 Thread kinke via Digitalmars-d
On Thursday, 22 September 2016 at 17:09:38 UTC, Brian wrote: I use cygwin build a C++ lib file: libmemcached.a but, how to link it to my dub project? You'd probably need to use the GNU linker then, but the D objects would need to match the format used for your C++ lib. You could give the

Re: Optimisation possibilities: current, future and enhancements

2016-08-25 Thread kinke via Digitalmars-d
I found it hard to believe LDC generates such crappy code when optimizing. These are my results using LDC master on Win64 (`ldc2 -O -release -output-s`): struct Foo { immutable _u = 8; int foo() const { return 8 * _u; } } int use(ref const(Foo) foo) { return

Re: Optimisation possibilities: current, future and enhancements

2016-08-25 Thread kinke via Digitalmars-d
On Thursday, 25 August 2016 at 18:09:14 UTC, Cecil Ward wrote: On Thursday, 25 August 2016 at 18:07:14 UTC, Cecil Ward wrote: On Thursday, 25 August 2016 at 17:22:27 UTC, kinke wrote: [...] I think that here the optimisation is only because LDC can “see” the text of the method. When

Re: Optimisation possibilities: current, future and enhancements

2016-08-25 Thread kinke via Digitalmars-d
On Thursday, 25 August 2016 at 18:15:47 UTC, Basile B. wrote: The problem here that the example is bad with too agressive optimizations because the CALLs are eliminated despite of no inlining. [...] int use(const(Foo) foo) { return foo.foo() + foo.foo(); } From my perspective, the

Re: const(Class) is mangled as Class const* const

2017-03-28 Thread kinke via Digitalmars-d
On Tuesday, 28 March 2017 at 02:14:25 UTC, Jonathan M Davis wrote: Realistically, unless D fully supports C++ (which pretty much means that it has to become C++ on some level), you're almost always going to be stuck with some sort of glue layer between D code and C++ code. There's no

Re: const(Class) is mangled as Class const* const

2017-03-28 Thread kinke via Digitalmars-d
On Tuesday, 28 March 2017 at 12:55:02 UTC, deadalnix wrote: On Tuesday, 28 March 2017 at 08:30:43 UTC, kinke wrote: What I don't get is why it's considered important to have a matching C++ mangling for templates across D and C++ - what for? I only care about mangling wrt. If you still think

Re: const(Class) is mangled as Class const* const

2017-03-28 Thread kinke via Digitalmars-d
On Tuesday, 28 March 2017 at 14:11:16 UTC, deadalnix wrote: I understand you point and showed you why it isn't a mangling problem at all, and gave you direction you may want to dig in to make a proposal that may actually get traction. If you really did get my point, it should be clear that I

Re: const(Class) is mangled as Class const* const

2017-03-27 Thread kinke via Digitalmars-d
On Sunday, 26 March 2017 at 17:41:57 UTC, Benjamin Thaut wrote: There are thousands of C++ libraries out there that can't be bound to D because they use const Class* instead of const Class* const. So in my eyes there is definitly something wrong with the C++ mangling of D. I agree that

Re: const(Class) is mangled as Class const* const

2017-03-27 Thread kinke via Digitalmars-d
On Monday, 27 March 2017 at 20:09:35 UTC, Walter Bright wrote: Whichever way it is mangled will gore someone's ox. D went with the simplest mangling solution, which is to mangle all C++ const pointers as "head const". [...] I suggest a simpler way - declare the C++ side of the D interface in

Re: const(Class) is mangled as Class const* const

2017-03-27 Thread kinke via Digitalmars-d
On Monday, 27 March 2017 at 22:04:55 UTC, Walter Bright wrote: On 3/27/2017 1:41 PM, kinke wrote: Unfortunately, it's almost always the other way around - D code trying to interop with one of the gazillions existing C++ libs, and nobody wants to maintain his own fork with D-compatible glue

Re: const(Class) is mangled as Class const* const

2017-03-27 Thread kinke via Digitalmars-d
On Monday, 27 March 2017 at 22:24:26 UTC, Walter Bright wrote: On 3/27/2017 3:12 PM, kinke wrote: It's made to work with: const T which is the norm with C++ templates. Okay, so how exactly do I bind D code to a C++ header-only-template library? I thought that in that case you need a

Re: D in China?

2017-03-20 Thread kinke via Digitalmars-d
On Monday, 20 March 2017 at 12:44:32 UTC, Laeeth Isharc wrote: becoming more involved in the Chinese open-source community I thought we had left behind nations and borders in the open-source community. - Sorry, I couldn't resist. ;)

Re: What are we going to do about mobile?

2017-04-06 Thread kinke via Digitalmars-d
On Thursday, 6 April 2017 at 05:24:07 UTC, Joakim wrote: D is currently built and optimized for that dying PC platform. I don't think x86 is dying soon, but I agree that embedded architectures get more important every day and should get more focus. I would even go so far as to say it may

DPaste using ancient LDC

2017-03-03 Thread kinke via Digitalmars-d
I'm slightly annoyed by DPaste providing a single ancient LDC version (0.12, 2.063 front-end...). I wouldn't mind as long as it wouldn't boldly state `We provide always up-to-date compilers collection!` and it wasn't the first result when googling for "dlang online compiler" (I prefer

Re: Phobos and LTO

2017-03-07 Thread kinke via Digitalmars-d
On Tuesday, 7 March 2017 at 18:46:15 UTC, Johan Engelen wrote: On Tuesday, 7 March 2017 at 18:42:40 UTC, Johan Engelen wrote: It works on OS X too. And OS X is the only platform for which we package the LTO linker binaries in the release. Has anybody tried LLD on Windows for D already?

Re: Immovable types

2017-04-19 Thread kinke via Digitalmars-d
On Wednesday, 19 April 2017 at 02:53:18 UTC, Stanislav Blinov wrote: But it is always assumed that a value can be moved. It's not just assumed, it's a key requirement for structs in D, as the compiler can move stuff automatically this way (making a bitcopy and then eliding the postblit ctor

Re: The progress of D since 2013

2017-07-31 Thread kinke via Digitalmars-d
Hi, On Monday, 31 July 2017 at 07:22:06 UTC, Maxim Fomin wrote: 1) Support of linking in win64? LDC: MSVC targets, both 32 and 64 bits, fully supported since a year or so. Requires Visual Studio 2015+. 2) What is the support of other platforms? AFAIK there was progress on Android. LDC:

Re: Webassembly?

2017-07-06 Thread kinke via Digitalmars-d
On Thursday, 6 July 2017 at 18:26:18 UTC, Joakim wrote: On Thursday, 6 July 2017 at 17:19:34 UTC, bauss wrote: On Thursday, 6 July 2017 at 15:34:08 UTC, Wulfklaue wrote: Is there a future where we can see WebAssembly as part of D? Seeing Rusts backbone already producing wasm is impressive.

Re: D easily overlooked?

2017-07-26 Thread kinke via Digitalmars-d
On Wednesday, 26 July 2017 at 15:55:14 UTC, Wulfklaue wrote: But how about NOT always adding new feature and actually making things more easy for new people. People need to eventually understand that all the energy wasted for complaining about D/the community/whatever would be so much more

Re: Anyone relying on signaling NaNs?

2017-07-26 Thread kinke via Digitalmars-d
On Saturday, 1 October 2016 at 19:10:47 UTC, Martin Nowak wrote: Just tried to fix the float/double initialization w/ signaling NaNs [¹], but it seems we can't reliably do that for all backends/architectures. Any additional move of float might convert SNaNs to QNaNs (quiet NaNs). This has also

Re: D easily overlooked?

2017-07-26 Thread kinke via Digitalmars-d
On Wednesday, 26 July 2017 at 20:23:25 UTC, Ola Fosheim Grøstad wrote: so it doesn't make a whole lot of sense telling people to "improve" on it if they haven't even adopted it (in production). My point was improving vs. complaining. Both take some analysis to figure out an issue, but then

Re: Compilation times and idiomatic D code

2017-07-05 Thread kinke via Digitalmars-d
On Wednesday, 5 July 2017 at 20:12:40 UTC, H. S. Teoh wrote: I vaguely remember there was talk about compressing symbols when they get too long... is there any hope of seeing this realized in the near future? LDC has an experimental feature replacing long names by their hash; ldc2 -help:

Re: LDC, ARM: unnecessary default initialization

2017-08-18 Thread kinke via Digitalmars-d
On Friday, 18 August 2017 at 12:09:04 UTC, kinke wrote: On Friday, 18 August 2017 at 09:42:25 UTC, Jack Applegame wrote: For some reason, the LDC default initializes the structure, even if initialization of all its members is specified as void. I believe that this is wrong. Afaik, this has

Re: void init of out variables

2017-08-19 Thread kinke via Digitalmars-d
On Saturday, 19 August 2017 at 06:20:28 UTC, Nicholas Wilson wrote: is there a way to not assign to out variables? I don't think so. Is there a good reason not to return the matrix directly (taking advantage of in-place construction)? float[M][M] f() { float[M][M] mean = void; //

Re: LDC, ARM: unnecessary default initialization

2017-08-18 Thread kinke via Digitalmars-d
On Friday, 18 August 2017 at 09:42:25 UTC, Jack Applegame wrote: For some reason, the LDC default initializes the structure, even if initialization of all its members is specified as void. I believe that this is wrong. Afaik, this has been brought up multiple times already and is so by

Re: simple ABI change to enable implicit conversion of functions to delegates?

2017-05-15 Thread kinke via Digitalmars-d
On Monday, 15 May 2017 at 10:41:55 UTC, ag0aep6g wrote: TL;DR: Changing the ABI of delegates so that the context pointer is passed last would make functions implicitly convertible to delegates, no? In the discussion of issue 17156 [1], Eyal asks why functions (function pointers?) don't

Re: NetBSD amd64: which way is the best for supporting 80 bits real/double?

2017-05-11 Thread kinke via Digitalmars-d
On Thursday, 11 May 2017 at 11:31:58 UTC, Nikolay wrote: On Thursday, 11 May 2017 at 11:10:50 UTC, Joakim wrote: Well, if you don't like what's available and NetBSD doesn't provide them... up to you to decide where that leads. In any case it was not my decision. LDC does not use x87 for math

Re: simple ABI change to enable implicit conversion of functions to delegates?

2017-05-15 Thread kinke via Digitalmars-d
On Monday, 15 May 2017 at 17:03:20 UTC, ag0aep6g wrote: On 05/15/2017 02:27 PM, kinke wrote: Some additional context: https://github.com/dlang/dmd/pull/5232 What I take from that is that changing the way arguments are passed (particularly if they're reversed or not) is going to break a ton

Re: simple ABI change to enable implicit conversion of functions to delegates?

2017-05-15 Thread kinke via Digitalmars-d
On Monday, 15 May 2017 at 20:14:49 UTC, ag0aep6g wrote: Say, the function ABI uses EAX, EBX, and ECX for the first three arguments (in that order). For a function call `f(1, 2)` that means: EAX: 1 EBX: 2 ECX: not used For a delegate call `dg(1, 2)` I'd also put 1 and 2 into EAX

Re: How can I use ldc2 and link to full runtime on arm with no OS

2017-06-20 Thread kinke via Digitalmars-d
On Tuesday, 20 June 2017 at 17:52:59 UTC, Dan Walmsley wrote: How do I link in the run time and gc, etc? In your case, you firstly need to cross-compile druntime to your target. This means compiling most files in the src subdirectory of LDC's druntime [1], excluding obvious ones like

Re: gdc is in

2017-06-21 Thread kinke via Digitalmars-d
On Wednesday, 21 June 2017 at 15:11:39 UTC, Joakim wrote: Congratulations to Iain and the gdc team. :) +1. Awesome!

Re: zig

2017-09-08 Thread kinke via Digitalmars-d
On Friday, 8 September 2017 at 08:07:25 UTC, Daniel N wrote: I was just reading the LLVM release notes. Looks quite interesting, did anyone try it? http://ziglang.org/ I noticed it too in the release notes, browsed to the page, scrolled down to the first code samples and was immediately put

Re: Events in D

2017-08-29 Thread kinke via Digitalmars-d
On Tuesday, 29 August 2017 at 05:10:25 UTC, bitwise wrote: I needed some C# style events, so I rolled my own. Long story short, the result was unsatisfactory. [...] Anyways, I threw together some code while thinking about what an event may look like in D: [...] I like the C# event

Awful dlang.org server performance

2017-09-12 Thread kinke via Digitalmars-d
Okay so I'm (sadly) used to every ~10th forum.dlang.org web request to take something like 10-15 seconds to get a response (while the other ~9 are instantaneous). But the last couple of days, the Wiki is hardly usable (editing last night took > 1 minute for the page to reload), and Travis CI

Re: Struct alignment

2017-09-24 Thread kinke via Digitalmars-d
On Sunday, 24 September 2017 at 21:01:06 UTC, Johan Engelen wrote: So... what's correct? :-) 2.075+. ;) See https://github.com/dlang/dmd/pull/6754.

Re: Events in D

2017-08-31 Thread kinke via Digitalmars-d
On Wednesday, 30 August 2017 at 15:35:57 UTC, bitwise wrote: -What if I want an event to lock a shared mutex of the enclosing object, without storing a pointer to that mutex inside the event itself (and every single other event in the object)? -What if I want an event to call a method of the

Re: Link errors when compiling shared lib on windows

2017-11-01 Thread kinke via Digitalmars-d
On Wednesday, 1 November 2017 at 15:15:27 UTC, Daniel Fitzpatrick wrote: I am following this short tutorial on compiling a shared lib: https://wiki.dlang.org/Call_D_from_Ruby_using_FFI Because it's on Windows I am using these compiler options: -shared -m64 -defaultlib=libphobos2.so i.d

Re: Should 'in' Imply 'ref' as Well for Value Types?

2018-05-05 Thread kinke via Digitalmars-d
On Saturday, 5 May 2018 at 15:22:04 UTC, Bolpat wrote: I once proposed that `in` can mean `const scope ref` that also binds rvalues. https://github.com/dlang/DIPs/pull/111#issuecomment-381911140 We could make `in` be something similar to `inline`. The compiler can implement it as stated above

Re: DIP 1014:Hooking D's struct move semantics--Community Review Round 1

2018-05-17 Thread kinke via Digitalmars-d
3. When deciding to move a struct instance, the compiler MUST emit a call to the struct's __move_post_blt after blitting the instance and before releasing the memory containing the old instance. __move_post_blt MUST receive references to both the pre- and post-move instances. This implies

Re: DIP 1014:Hooking D's struct move semantics--Community Review Round 1

2018-05-17 Thread kinke via Digitalmars-d
On Thursday, 17 May 2018 at 12:36:29 UTC, Shachar Shemesh wrote: Again, as far as I know, structs are not copied when passed as arguments. They are allocated on the caller's stack and a reference is passed to the callee. If that's the case, no move (of any kind) is done. That's the exception

Re: DIP 1014:Hooking D's struct move semantics--Community Review Round 1

2018-05-17 Thread kinke via Digitalmars-d
On Thursday, 17 May 2018 at 15:23:50 UTC, kinke wrote: See IR for https://run.dlang.io/is/1JIsk7. I should probably emphasize that the LLVM `byval` attribute is strange at first sight. Pseudo-IR `void foo(S* byval param); ... foo(S* byarg arg);` doesn't mean that the IR callee gets the S*

Re: DIP 1014:Hooking D's struct move semantics--Community Review Round 1

2018-05-18 Thread kinke via Digitalmars-d
On Thursday, 17 May 2018 at 19:11:27 UTC, Shachar Shemesh wrote: On 17/05/18 18:47, kinke wrote: Since clang is able to compile this struct and do everything with it, and since the existence of the move constructor requires the precise same type of hooking as is needed in this case, I tend to

Re: Disappointing performance from DMD/Phobos

2018-06-26 Thread kinke via Digitalmars-d
On Tuesday, 26 June 2018 at 17:38:42 UTC, Manu wrote: I know, but it's still the reference compiler, and it should at least to a reasonable job at the kind of D code that it's *recommended* that users write. I get your point, but IMO it's all about efficient allocation of the manpower we

Re: Arch Linux ldc package can't use asan

2018-01-09 Thread kinke via Digitalmars-d
On Tuesday, 9 January 2018 at 15:27:56 UTC, Wild wrote: On Tuesday, 9 January 2018 at 15:19:37 UTC, Atila Neves wrote: I don't know who's the current maintainer of the Arch Linux D packages. ldc1.7.0 from the Arch repositories doesn't work with -fsanitize=address right now, it fails to link. I

Re: Bump the minimal version required to compile DMD to 2.076.1

2018-01-16 Thread kinke via Digitalmars-d
On Tuesday, 16 January 2018 at 13:09:06 UTC, Daniel Kozak wrote: On Tue, Jan 16, 2018 at 12:51 PM, Joakim via Digitalmars-d < digitalmars-d@puremagic.com> wrote: On Monday, 15 January 2018 at 13:25:26 UTC, Daniel Kozak wrote: So why not to use cross compilation? As I said before, you

Re: Quora: Why hasn't D started to replace C++?

2018-01-31 Thread kinke via Digitalmars-d
On Wednesday, 31 January 2018 at 11:42:14 UTC, Seb wrote: On Wednesday, 31 January 2018 at 10:35:06 UTC, Benny wrote: * three compilers Not sure why that's a bad thing. They all have their ups and downs: - dmd SUPER fast compilation - ldc multiarch + good optimization + cross-compilation -

Re: lld status

2017-12-21 Thread kinke via Digitalmars-d
On Thursday, 21 December 2017 at 18:40:54 UTC, Andrei Alexandrescu wrote: I heard ldc already uses its embedded variant for linking programs (on Widows? Posix? 32bit? 64bit?). Currently only for Windows-MSVC targets (both 32 and 64 bits) and only when specifying the `-link-internally` switch.

Re: skinny delegates

2018-08-02 Thread kinke via Digitalmars-d
Leaking may be an issue. This currently works: ``` static const(int)* global; auto foo(const int param) { return { global = return param + 10; }; } void main() { { int arg = 42; auto dg = foo(42); auto r = dg(); assert(r == 52); } assert(*global

Re: skinny delegates

2018-08-02 Thread kinke via Digitalmars-d
On Thursday, 2 August 2018 at 21:28:27 UTC, kinke wrote: Leaking may be an issue. Ah, I guess that's why you mentioned the use-as-rvalue requirement.

Re: skinny delegates

2018-08-02 Thread kinke via Digitalmars-d
On Thursday, 2 August 2018 at 15:12:10 UTC, Steven Schveighoffer wrote: On 8/2/18 11:00 AM, Kagamin wrote: I suppose it's mostly for mutability, so if it's const, it can be optimized based on type information only: auto foo(in int x) {    return { return x + 10; }; } I'm not sure what you

Re: skinny delegates

2018-08-03 Thread kinke via Digitalmars-d
On Friday, 3 August 2018 at 14:46:59 UTC, Jonathan Marler wrote: After thinking about it more I suppose it wouldn't be that complicated to implement. For delegate literals, you already need to gather a list of all the data you need to put on the heap, and if it can all fit inside a pointer,

Re: skinny delegates

2018-08-03 Thread kinke via Digitalmars-d
On Friday, 3 August 2018 at 16:46:53 UTC, Jonathan Marler wrote: Maybe you could provide an example or 2 to demonstrate why these would be requirements...we may have 2 different ideas on how this would be implemented. auto foo(/*mutable*/ int x) { return { return ++x; }; } void main() {

Re: skinny delegates

2018-08-03 Thread kinke via Digitalmars-d
A slightly more complex example, illustrating that it wouldn't be enough to check that the delegate body itself doesn't mutate the captured variable: ``` int delegate() increment; auto foo(int x) { increment = () => ++x; return () => x; } void main() { auto dg = foo(42); auto

Re: Is there any good reason why C++ namespaces are "closed" in D?

2018-07-29 Thread kinke via Digitalmars-d
On Sunday, 29 July 2018 at 11:03:43 UTC, Jonathan M Davis wrote: I guess that the argument at that point is that you would have to put them in separate D modules, just like you would if they were extern(D) functions. Yep, that'd sound acceptable to me, implying that ``` extern(C++, cppns) {

Re: "catch" not catching the correct exception

2018-07-26 Thread kinke via Digitalmars-d
On Thursday, 26 July 2018 at 07:38:08 UTC, Shachar Shemesh wrote: Mecca doesn't call that. Should it? Can that be the problem? Very likely so. It's (normally) used in core.thread.Thread's push/popContext() when switching into a fiber.

Re: skinny delegates

2018-08-04 Thread kinke via Digitalmars-d
On Saturday, 4 August 2018 at 13:52:54 UTC, Steven Schveighoffer wrote: No, it depends on and is dictated by D's delegate system. The delegate receives the context pointer by value. Absolutely right, thx for clarifying.

Re: skinny delegates

2018-08-04 Thread kinke via Digitalmars-d
Argh, should read `*cast(int*) `.

Re: skinny delegates

2018-08-04 Thread kinke via Digitalmars-d
On Saturday, 4 August 2018 at 12:21:18 UTC, Steven Schveighoffer wrote: You don't even need to make a copy to show problems, the context isn't passed by reference: const r1 = dg(); const r2 = dg(); assert(r1 == 43 && r2 == 44); // would fail with optimization. -Steve This depends on the

Re: Is there any good reason why C++ namespaces are "closed" in D?

2018-07-27 Thread kinke via Digitalmars-d
This limitation really seems to make no sense, especially since you can split up a C++ namespace across multiple D modules, just not inside a single module.

Re: Using a C++ class in a D associative array

2018-08-20 Thread kinke via Digitalmars-d
On Monday, 20 August 2018 at 22:16:09 UTC, Jacob Carlborg wrote: At the third line there's a call from object.TypeInfo_Class.getHash. I looked up to see what the "getHash" method is doing in druntime [2], the method looks like this: override size_t getHash(scope const void* p) @trusted const

Re: Using a C++ class in a D associative array

2018-08-22 Thread kinke via Digitalmars-d
On Wednesday, 22 August 2018 at 19:25:40 UTC, Jacob Carlborg wrote: This could be solved, I think, with having "TypeInfo.getHash" a template taking the actual type and not void*. That template can then inspect if the passed type is a D class or any other type of class and act accordingly. It

Re: DIP 1016--ref T accepts r-values--Community Review Round 1

2018-07-21 Thread kinke via Digitalmars-d
Thanks a lot, Manu, I'm a huge fan of this. Wrt. binding rvalues to mutable refs, we could introduce something like `-transition=rval_to_mutable_ref` to have the compiler list all matching call sites. Wrt. `auto ref`, I'd very much like to see its semantics change to 'pass this argument in

Re: DMD, Vibe.d, and Dub

2018-07-17 Thread kinke via Digitalmars-d
On Tuesday, 17 July 2018 at 18:31:18 UTC, Russel Winder wrote: This would seem to imply that you can't use Vibe.d 0.8.4 with DMD 2.081.0. I think that regression was the main reason for early 2.081.1.

Re: DMD, Vibe.d, and Dub

2018-07-17 Thread kinke via Digitalmars-d
On Tuesday, 17 July 2018 at 19:39:32 UTC, Russel Winder wrote: It seems that the LDC 1.11 branch in the GitHub repository has the DMD 2.081.0 problem. If you're referring to branch merge-2.081, that one doesn't exist anymore. master/beta2 are based on 2.081.1+ and should thus be fixed.

Re: Completely Remove C Runtime with DMD for win32

2018-07-15 Thread kinke via Digitalmars-d
On Sunday, 15 July 2018 at 20:29:29 UTC, tcb wrote: Is it possible to completely remove the C runtime on windows, and if so how? This works for me: extern(C) int mainCRTStartup() { return 0; } dmd -m32mscoff -betterC -L/subsystem:CONSOLE main.d => 1.5 kB .exe.

  1   2   3   4   5   6   7   >