Re: string to wchar*?

2017-06-03 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jun 04, 2017 at 12:45:23AM +, Stanislav Blinov via Digitalmars-d-learn wrote: [...] > No, it shouldn't. char* et al. are not string types in D. > to!(char*)(string) just doesn't make sense. If you need to convert between D strings and char*, wchar*, etc., e.g., for interfacing with

Re: How to Compare 2 objects of the same class

2017-06-03 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jun 03, 2017 at 10:38:31PM +, Mark via Digitalmars-d-learn wrote: [...] > Ok. So by using '==' it should compare the addresses of the objects? [...] No, `==` is for comparing the *contents* of the objects. You need to implement opEquals() for the objects being compared in order to

Re: Dynamic binding to the Mono runtime API

2017-06-03 Thread Adam Wilson via Digitalmars-d-announce
On 6/3/17 10:30, Jakub Szewczyk wrote: Mono runtime is a cross-platform, open-source alternative to Microsoft's .NET framework [1], and it can be embedded in other applications as a "scripting" VM, but with JIT-compilation enhanced performance and support of many languages such as C#, F# or

Re: C++17 cannot beat D surely

2017-06-03 Thread Mike Parker via Digitalmars-d
On Sunday, 4 June 2017 at 05:12:13 UTC, Jonathan M Davis wrote: As the enum has no address, it can't store anything. So, _anything_ that's an enum is going to be effectively copy-pasted everywhere that it's used. The compiler is smart enough to just copy-past the result and not the

Re: C++17 cannot beat D surely

2017-06-03 Thread H. S. Teoh via Digitalmars-d
On Sat, Jun 03, 2017 at 03:00:56PM -0700, Ali Çehreli via Digitalmars-d wrote: > On 06/03/2017 12:12 PM, Steven Schveighoffer wrote: > > > I'd say this deserves a blog post but it would be too short. > > I made many good friends at C++Now. Some of them know Atila from > CppCon and other C++

Re: std.csv Performance Review

2017-06-03 Thread Jesse Phillips via Digitalmars-d
On Saturday, 3 June 2017 at 23:18:26 UTC, bachmeier wrote: Do you know what happened with fastcsv [0], original thread [1]. [0] https://github.com/quickfur/fastcsv [1] http://forum.dlang.org/post/mailman.3952.1453600915.22025.digitalmars-d-le...@puremagic.com I do not. Rereading that in

Re: C++17 cannot beat D surely

2017-06-03 Thread Jonathan M Davis via Digitalmars-d
On Sunday, June 04, 2017 04:47:56 Mike Parker via Digitalmars-d wrote: > On Sunday, 4 June 2017 at 04:39:21 UTC, Adam D. Ruppe wrote: > > On Sunday, 4 June 2017 at 04:34:44 UTC, Mike Parker wrote: > >> I would not have expected enum b = sort(a) to trigger an > >> allocation. auto b, yes, of course

Re: CTFE Status 2

2017-06-03 Thread Stefan Koch via Digitalmars-d
On Sunday, 28 May 2017 at 22:26:18 UTC, Stefan Koch wrote: On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote: [ ... ] Hi Guys, I just fixed the sliceAssignment! now overlapping assignments are correctly detected. I also re-enabled a bailout on struct-member operation which

Re: C++17 cannot beat D surely

2017-06-03 Thread Mike Parker via Digitalmars-d
On Sunday, 4 June 2017 at 04:47:56 UTC, Mike Parker wrote: On Sunday, 4 June 2017 at 04:39:21 UTC, Adam D. Ruppe wrote: I thought that assigning the result of a function call to an enum would force a compile-time evaluation of the function, so I would expect enum b = call(lit) to be

Re: C++17 cannot beat D surely

2017-06-03 Thread Mike Parker via Digitalmars-d
On Sunday, 4 June 2017 at 04:39:21 UTC, Adam D. Ruppe wrote: On Sunday, 4 June 2017 at 04:34:44 UTC, Mike Parker wrote: I would not have expected enum b = sort(a) to trigger an allocation. auto b, yes, of course (and the disassembly from that is not much different). So I'd love to see a blog

Re: C++17 cannot beat D surely

2017-06-03 Thread Adam D. Ruppe via Digitalmars-d
On Sunday, 4 June 2017 at 04:34:44 UTC, Mike Parker wrote: I would not have expected enum b = sort(a) to trigger an allocation. auto b, yes, of course (and the disassembly from that is not much different). So I'd love to see a blog post explaining it. I don't think I can do a full-on blog

Re: C++17 cannot beat D surely

2017-06-03 Thread Mike Parker via Digitalmars-d
On Sunday, 4 June 2017 at 03:28:32 UTC, Andrei Alexandrescu wrote: On 06/03/2017 07:41 PM, jmh530 wrote: On Saturday, 3 June 2017 at 22:18:06 UTC, Timon Gehr wrote: There is no mistake. (But 'auto' is redundant.) void main() { import std.algorithm, std.stdio; enum a = [ 3, 1, 2,

Re: C++17 cannot beat D surely

2017-06-03 Thread Stefan Koch via Digitalmars-d
On Saturday, 3 June 2017 at 23:41:37 UTC, jmh530 wrote: On Saturday, 3 June 2017 at 22:18:06 UTC, Timon Gehr wrote: There is no mistake. (But 'auto' is redundant.) void main() { import std.algorithm, std.stdio; enum a = [ 3, 1, 2, 4, 0 ]; enum b = sort(a);// static is not CT

Re: C++17 cannot beat D surely

2017-06-03 Thread Andrei Alexandrescu via Digitalmars-d
On 06/03/2017 07:41 PM, jmh530 wrote: On Saturday, 3 June 2017 at 22:18:06 UTC, Timon Gehr wrote: There is no mistake. (But 'auto' is redundant.) void main() { import std.algorithm, std.stdio; enum a = [ 3, 1, 2, 4, 0 ]; enum b = sort(a);// static is not CT ! static

Re: C++17 cannot beat D surely

2017-06-03 Thread Basile B. via Digitalmars-d
On Saturday, 3 June 2017 at 20:29:04 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:18:59 UTC, Basile B. wrote: On Saturday, 3 June 2017 at 18:45:56 UTC, Jacob Carlborg wrote: On 2017-06-03 20:31, Russel Winder via Digitalmars-d wrote: But is this sort guaranteed to happen at

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Walter Bright via Digitalmars-d-announce
On 6/3/2017 5:20 PM, Mike Parker wrote: On Saturday, 3 June 2017 at 20:06:05 UTC, Walter Bright wrote: On 6/3/2017 12:28 AM, Petar Kirov [ZombineDev] wrote: Personally, making contracts less verbose and more powerful is much higher on my list We did discuss bouncing the DIP back with a request

Question to GC experts: NO_SCAN for a part of the block

2017-06-03 Thread Stanislav Blinov via Digitalmars-d
Suppose I need to allocate several dynamic arrays of different types and/or sizes. An obvious choice is to do just that: perform N allocations. But given that I know all the sizes, and also am pretty sure that each of the arrays will have the same lifespan, why would I do N allocations when I

Re: string to wchar*?

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 23:36:18 UTC, Mike B Johnson wrote: https://dlang.org/phobos/std_utf.html#toUTF16z This didn't work. More errors than the first. Works for me: void main() { import std.conv; import std.stdio; import core.stdc.wchar_; import core.stdc.stdio;

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Mike Parker via Digitalmars-d-announce
On Saturday, 3 June 2017 at 23:43:10 UTC, Ali Çehreli wrote: If that's the only change, then we have a serious issue with the text of this DIP. I think the DIP must be corrected with the following change. Please review and then change the DIP accordingly: from: "Add do as an optional

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Mike Parker via Digitalmars-d-announce
On Saturday, 3 June 2017 at 20:06:05 UTC, Walter Bright wrote: On 6/3/2017 12:28 AM, Petar Kirov [ZombineDev] wrote: Personally, making contracts less verbose and more powerful is much higher on my list We did discuss bouncing the DIP back with a request to revamp it as a complete overhaul of

Re: GPGPU progess

2017-06-03 Thread David Nadlinger via Digitalmars-d
On Saturday, 3 June 2017 at 23:13:09 UTC, Nicholas Wilson wrote: Good idea, name of global needs to be known in advance though. Why, and how would that be a non-trivial problem? — David

Re: Value closures (no GC allocation)

2017-06-03 Thread MysticZach via Digitalmars-d
On Tuesday, 30 May 2017 at 19:29:38 UTC, deadalnix wrote: What are your thoughts? Has something similar been proposed before? https://wiki.dlang.org/DIP30 Also, while no syntax is provided, this is how SDC works internally and this is how it can handle multiple context pointers. FWIW, I

Re: string to wchar*?

2017-06-03 Thread Ali Çehreli via Digitalmars-d-learn
On 06/03/2017 04:36 PM, Mike B Johnson wrote: On Saturday, 3 June 2017 at 23:09:56 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 22:54:22 UTC, Mike B Johnson wrote: How to convert a string to wchar*? C-style null-terminated wchar*? https://dlang.org/phobos/std_utf.html#toUTF16z

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 23:32:44 UTC, Ali Çehreli wrote: ... Ali Awesome, that might be handy in the near future. Thanks.

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Ali Çehreli via Digitalmars-d-announce
On 06/02/2017 11:44 PM, H. S. Teoh via Digitalmars-d-announce wrote: > Yes, count me somewhat disappointed at merely changing `body` to `do`. If that's the only change, then we have a serious issue with the text of this DIP. I think the DIP must be corrected with the following change. Please

Re: Bad array indexing is considered deadly

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 21:00:43 UTC, Steven Schveighoffer wrote: That is my conclusion too. Is your library in a usable state? Perhaps we should not repeat efforts, though I wasn't planning on making a robust public library for it :) After some consideration you can now find the

Re: C++17 cannot beat D surely

2017-06-03 Thread jmh530 via Digitalmars-d
On Saturday, 3 June 2017 at 22:18:06 UTC, Timon Gehr wrote: There is no mistake. (But 'auto' is redundant.) void main() { import std.algorithm, std.stdio; enum a = [ 3, 1, 2, 4, 0 ]; enum b = sort(a);// static is not CT ! static assert(b[0] == 0); // does not pass with

Re: Idea: Reverse Type Inference

2017-06-03 Thread Enamex via Digitalmars-d
On Wednesday, 24 May 2017 at 15:02:05 UTC, Steven Schveighoffer wrote: In fact, you could simulate overloading of return values based on IFTI instantiation: void fooImpl(ref int retval, int x) { ... } void fooImpl(ref string retval, int x) { ... } T foo(T)(int x) { T t; fooImpl(t, x); return

Re: string to wchar*?

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
On Saturday, 3 June 2017 at 23:09:56 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 22:54:22 UTC, Mike B Johnson wrote: How to convert a string to wchar*? C-style null-terminated wchar*? https://dlang.org/phobos/std_utf.html#toUTF16z This didn't work. More errors than the first.

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Ali Çehreli via Digitalmars-d-learn
On 06/03/2017 03:38 PM, Mark wrote: > Ok. So by using '==' it should compare the addresses of the objects? That's the default behavior. You can change it with opEquals: http://ddili.org/ders/d.en/object.html#ix_object.opEquals I think you want to use the 'is' operator:

Re: std.csv Performance Review

2017-06-03 Thread bachmeier via Digitalmars-d
On Saturday, 3 June 2017 at 04:25:27 UTC, Jesse Phillips wrote: Author here: The discussion[1] and articles[2] around "Faster Command Line Tools" had me trying out std.csv for the task. Now I know std.csv isn't fast and it allocates. When I wrote my CSV parser, I'd also left around a parser

Re: GPGPU progess

2017-06-03 Thread Nicholas Wilson via Digitalmars-d
On Saturday, 3 June 2017 at 14:12:28 UTC, David Nadlinger wrote: On Saturday, 3 June 2017 at 12:13:41 UTC, Nicholas Wilson wrote: Alas no. __attribute__((target(...)) works because it targeting different targets of the _same_ backend, this targets different backends. But surely you could

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Jonathan M Davis via Digitalmars-d-announce
On Saturday, June 03, 2017 17:16:52 Jacob Carlborg via Digitalmars-d- announce wrote: > On 2017-06-02 16:17, Mike Parker wrote: > > Congratulations are in order for Jared Hanson. Walter and Andrei have > > approved his proposal to remove body as a keyword. I've added a summary > > of their

Re: string to wchar*?

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:54:22 UTC, Mike B Johnson wrote: How to convert a string to wchar*? C-style null-terminated wchar*? https://dlang.org/phobos/std_utf.html#toUTF16z

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:52:42 UTC, Mark wrote: Thanks again. Nevermind, I got it.

string to wchar*?

2017-06-03 Thread Mike B Johnson via Digitalmars-d-learn
How to convert a string to wchar*? string s; to!(wchar*)(s) gives phobo's deduction problems. \dmd2\windows\bin\..\..\src\phobos\std\conv.d(194): Error: template std.conv.toImpl cannot deduce function from argument types !(wchar*)(string), candidates are:

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:38:31 UTC, Mark wrote: In the future I'll include a compilable example. I was having problems with a class I made which is about 45 lines, that might be a lot of code for a post. You can use external resources such as: https://d.godbolt.org/

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 22:38:31 UTC, Mark wrote: ... Thanks. Actually, I got another question, how Can I obtain the actual memory address of a class? I'll still need to solve the problem of taking ints/floats/reals etc., as well as structs and classes and sending them right/left in

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:24:44 UTC, ag0aep6g wrote: By default, they act the same. But you can change how `==` behaves by overriding `opEquals`. You cannot override `is`. Ok. So by using '==' it should compare the addresses of the objects? I think I didn't include the other file as

Re: Dynamic binding to the Mono runtime API

2017-06-03 Thread Laeeth Isharc via Digitalmars-d-announce
On Saturday, 3 June 2017 at 17:30:05 UTC, Jakub Szewczyk wrote: Mono runtime is a cross-platform, open-source alternative to Microsoft's .NET framework [1], and it can be embedded in other applications as a "scripting" VM, but with JIT-compilation enhanced performance and support of many

Re: Release D 2.074.1

2017-06-03 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Friday, 2 June 2017 at 09:52:45 UTC, Joseph Rushton Wakeling wrote: Great news, thanks Martin. I'll update the snap packages over the weekend. :-) Done. sudo snap refresh --classic --edge dmd should upgrade things for anyone who already has the package install; otherwise, sudo

Re: C++17 cannot beat D surely

2017-06-03 Thread Timon Gehr via Digitalmars-d
On 03.06.2017 22:16, Basile B. wrote: On Saturday, 3 June 2017 at 19:12:46 UTC, Steven Schveighoffer wrote: On Saturday, 3 June 2017 at 17:32:41 UTC, Andrei Alexandrescu wrote: On 06/03/2017 01:03 PM, Russel Winder via Digitalmars-d wrote: Björn Fahller has done compile time sort in C++17

OT: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 21:46:45 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 21:39:54 UTC, Moritz Maxeiner wrote: It's always true, because I explicitly wrote *might*, not *will*, to indicate that it depends on your use case. Your example is a common use case where you can't

Re: C++17 cannot beat D surely

2017-06-03 Thread Ali Çehreli via Digitalmars-d
On 06/03/2017 12:12 PM, Steven Schveighoffer wrote: > I'd say this deserves a blog post but it would be too short. I made many good friends at C++Now. Some of them know Atila from CppCon and other C++ conferences. (Beer involved. :) ) They told me Atila would routinely tell them during C++

Re: The design of the hooks in std.experimental.checkedint

2017-06-03 Thread Andrei Alexandrescu via Digitalmars-d
On 06/03/2017 11:59 AM, Jacob Carlborg wrote: I've been looking a bit at the design of the hooks in std.experimental.checkedint. Due to all hooks being optional there's quite a few "static if" in the implementation of checkedint to check if a hook is implemented. Wouldn't it be simpler if

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 21:39:54 UTC, Moritz Maxeiner wrote: On Saturday, 3 June 2017 at 21:16:08 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:53:05 UTC, Moritz Maxeiner wrote: Quite, but if you backtrack to my initial statement, it was about ptr not being/becoming null

Re: Dynamic binding to the Mono runtime API

2017-06-03 Thread extrawurst via Digitalmars-d-announce
On Saturday, 3 June 2017 at 17:30:05 UTC, Jakub Szewczyk wrote: Mono runtime is a cross-platform, open-source alternative to Microsoft's .NET framework [1], and it can be embedded in other applications as a "scripting" VM, but with JIT-compilation enhanced performance and support of many

Re: Release D 2.074.1

2017-06-03 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Saturday, 3 June 2017 at 21:17:18 UTC, Seb wrote: I understand the problem, but there's only so much Martin can do in his free time. I'm not asking anyone to do the work. I'm asking for a clear recognition that this is a problem that should be fixed. I'm also asking for a clear

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 21:16:08 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:53:05 UTC, Moritz Maxeiner wrote: Quite, but if you backtrack to my initial statement, it was about ptr not being/becoming null (implicitly) in the first place, which *might* allow you to skip

Re: C++17 cannot beat D surely

2017-06-03 Thread Tourist via Digitalmars-d
On Saturday, 3 June 2017 at 19:12:46 UTC, Steven Schveighoffer wrote: On Saturday, 3 June 2017 at 17:32:41 UTC, Andrei Alexandrescu wrote: On 06/03/2017 01:03 PM, Russel Winder via Digitalmars-d wrote: Björn Fahller has done compile time sort in C++17 here http://playfulpr

Re: C++17 cannot beat D surely

2017-06-03 Thread Stanislav Blinov via Digitalmars-d
On Saturday, 3 June 2017 at 21:04:16 UTC, ag0aep6g wrote: On 06/03/2017 10:29 PM, Stanislav Blinov wrote: Meep. Wrong :) Static initializers for static variables and constants are evaluated at compile time, initializing them with runtime values is a compile-time error. Meep. Meep. I

Re: Release D 2.074.1

2017-06-03 Thread Seb via Digitalmars-d-announce
On Saturday, 3 June 2017 at 19:57:36 UTC, Joseph Rushton Wakeling wrote: It's a mistake that remains tolerated, despite the problem being known and having an associated issue, because the dlang/installer scripts work around it, meaning the fundamental problem never gets fixed. I understand

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:53:05 UTC, Moritz Maxeiner wrote: On Saturday, 3 June 2017 at 20:25:22 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:13:30 UTC, Moritz Maxeiner wrote: Calling std.algorithm.move is explicit programmer intent, I consider that about as accidental as

Re: C++17 cannot beat D surely

2017-06-03 Thread ag0aep6g via Digitalmars-d
On 06/03/2017 10:29 PM, Stanislav Blinov wrote: Meep. Wrong :) Static initializers for static variables and constants are evaluated at compile time, initializing them with runtime values is a compile-time error. Meep. Meep. I wouldn't say you're wrong, but there's nitpicking to be done.

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:25:22 UTC, Stanislav Blinov wrote: On Saturday, 3 June 2017 at 20:13:30 UTC, Moritz Maxeiner wrote: Calling std.algorithm.move is explicit programmer intent, I consider that about as accidental as calling memcpy with a source full of zeroes. In any case, having

Re: C++17 cannot beat D surely

2017-06-03 Thread Stanislav Blinov via Digitalmars-d
On Saturday, 3 June 2017 at 20:18:59 UTC, Basile B. wrote: On Saturday, 3 June 2017 at 18:45:56 UTC, Jacob Carlborg wrote: On 2017-06-03 20:31, Russel Winder via Digitalmars-d wrote: But is this sort guaranteed to happen at compile time rather than runtime? Yes. It's the context that

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:13:30 UTC, Moritz Maxeiner wrote: Calling std.algorithm.move is explicit programmer intent, I consider that about as accidental as calling memcpy with a source full of zeroes. In any case, having that check in the destructor is fairly cheap, so better safe than

Re: How to Compare 2 objects of the same class

2017-06-03 Thread ag0aep6g via Digitalmars-d-learn
On 06/03/2017 10:02 PM, Mark wrote: auto A = new Box(); auto B = new Box(); if(A.opEquals(B)) {} gives the error test.o:(.data.rel.ro+0x18): undefined reference to `_D5Stack12__ModuleInfoZ' collect2: error: ld returned 1 exit status Error: linker exited with status 1 Your code works for

Re: How to Compare 2 objects of the same class

2017-06-03 Thread cym13 via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:02:13 UTC, Mark wrote: On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote: Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 20:02:13 UTC, Mark wrote: On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote: Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class

Re: C++17 cannot beat D surely

2017-06-03 Thread Basile B. via Digitalmars-d
On Saturday, 3 June 2017 at 18:45:56 UTC, Jacob Carlborg wrote: On 2017-06-03 20:31, Russel Winder via Digitalmars-d wrote: But is this sort guaranteed to happen at compile time rather than runtime? Yes. It's the context that decides if it occurs at compile time or at runtime. Something

Re: C++17 cannot beat D surely

2017-06-03 Thread Basile B. via Digitalmars-d
On Saturday, 3 June 2017 at 19:12:46 UTC, Steven Schveighoffer wrote: On Saturday, 3 June 2017 at 17:32:41 UTC, Andrei Alexandrescu wrote: On 06/03/2017 01:03 PM, Russel Winder via Digitalmars-d wrote: Björn Fahller has done compile time sort in C++17 here http://playfulpr

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:55:30 UTC, ag0aep6g wrote: On 06/03/2017 09:37 PM, Moritz Maxeiner wrote: Of course, but AFAIK you'd need to explicitly assign it to an object, so `ptr` won't null by accident, but only by explicit programmer intent (same as overwriting the memory the object

Re: Guide - Migrating from std.experimental.ndslice to mir-algorithm

2017-06-03 Thread Zz via Digitalmars-d-learn
On Saturday, 3 June 2017 at 05:21:13 UTC, 9il wrote: On Friday, 2 June 2017 at 16:08:20 UTC, Zz wrote: Hi, Just tried migrating from std.experimental.ndslice to mir-algorithm. Is there a guide on how migrate old code? I used the following imports before and using then with ndslice.

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Walter Bright via Digitalmars-d-announce
On 6/3/2017 12:28 AM, Petar Kirov [ZombineDev] wrote: Personally, making contracts less verbose and more powerful is much higher on my list We did discuss bouncing the DIP back with a request to revamp it as a complete overhaul of the contract syntax, but decided that this DIP was about

Re: C++17 cannot beat D surely

2017-06-03 Thread Stanislav Blinov via Digitalmars-d
On Saturday, 3 June 2017 at 19:12:46 UTC, Steven Schveighoffer wrote: On Saturday, 3 June 2017 at 17:32:41 UTC, Andrei Alexandrescu wrote: On 06/03/2017 01:03 PM, Russel Winder via Digitalmars-d wrote: Björn Fahller has done compile time sort in C++17 here http://playfulpr

Re: RAII pointers

2017-06-03 Thread Stanislav Blinov via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:55:30 UTC, ag0aep6g wrote: On 06/03/2017 09:37 PM, Moritz Maxeiner wrote: Of course, but AFAIK you'd need to explicitly assign it to an object, so `ptr` won't null by accident, but only by explicit programmer intent (same as overwriting the memory the object

Re: How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:57:47 UTC, Mark wrote: Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class on the heap somewhere. Example: Not sure what

Re: Release D 2.074.1

2017-06-03 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Saturday, 3 June 2017 at 19:31:51 UTC, Seb wrote: Tags are only made from the stable branch. The point is that the VERSION file is wrong in the officially tagged release source. Well, as mentioned minor point releases have never been changed in the git repo before:

How to Compare 2 objects of the same class

2017-06-03 Thread Mark via Digitalmars-d-learn
Hello again. I'm designing a template version of a BST. Because of this, I want to be able to compare if two objects of the same class type are references to the same anonymous class on the heap somewhere. Example:

Re: RAII pointers

2017-06-03 Thread ag0aep6g via Digitalmars-d-learn
On 06/03/2017 09:37 PM, Moritz Maxeiner wrote: Of course, but AFAIK you'd need to explicitly assign it to an object, so `ptr` won't null by accident, but only by explicit programmer intent (same as overwriting the memory the object lives in via things like `memcpy`); and you can always screw

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 19:21:58 UTC, ag0aep6g wrote: On 06/03/2017 09:06 PM, Moritz Maxeiner wrote: - null check in destructor: That's just because I forgot to add it. If you add `@disable(this)` (disable the default constructor), all elaborate constructors ensure it is not null, and no

Re: Release D 2.074.1

2017-06-03 Thread Seb via Digitalmars-d-announce
On Saturday, 3 June 2017 at 19:02:36 UTC, Joseph Rushton Wakeling wrote: On Saturday, 3 June 2017 at 18:42:57 UTC, Seb wrote: So, I guess your problem is the VERSION file on the dmd stable branch? No, it's the VERSION file present if one checks out the v2.074.1 tag. Tags are only made from

Re: RAII pointers

2017-06-03 Thread ag0aep6g via Digitalmars-d-learn
On 06/03/2017 09:06 PM, Moritz Maxeiner wrote: - null check in destructor: That's just because I forgot to add it. If you add `@disable(this)` (disable the default constructor), all elaborate constructors ensure it is not null, and no members can set it to null, you might be able to skip the

Re: C++17 cannot beat D surely

2017-06-03 Thread Steven Schveighoffer via Digitalmars-d
On Saturday, 3 June 2017 at 17:32:41 UTC, Andrei Alexandrescu wrote: On 06/03/2017 01:03 PM, Russel Winder via Digitalmars-d wrote: Björn Fahller has done compile time sort in C++17 here http://playfulpr ogramming.blogspot.co.uk/2017/06/constexpr-quicksort-in-c17.html Surely D can do better?

Re: Release D 2.074.1

2017-06-03 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Saturday, 3 June 2017 at 19:02:36 UTC, Joseph Rushton Wakeling wrote: The point is here that this keeps happening. The relevant issue (filed over a year ago): https://issues.dlang.org/show_bug.cgi?id=15910

Re: RAII pointers

2017-06-03 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 3 June 2017 at 17:40:32 UTC, Russel Winder wrote: Would one be considered more idiomatic D, or is it a question of different circumstances different approaches. The differences are mainly in construction I believe. Well, the differences I spot are: - null check in destructor:

Re: Release D 2.074.1

2017-06-03 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Saturday, 3 June 2017 at 18:42:57 UTC, Seb wrote: So, I guess your problem is the VERSION file on the dmd stable branch? No, it's the VERSION file present if one checks out the v2.074.1 tag. I suspect this doesn't show up in the official packages because IIRC the VERSION file is edited

Re: C++17 cannot beat D surely

2017-06-03 Thread Jacob Carlborg via Digitalmars-d
On 2017-06-03 20:31, Russel Winder via Digitalmars-d wrote: But is this sort guaranteed to happen at compile time rather than runtime? Yes. It's the context that decides if it occurs at compile time or at runtime. Something declared as "static" or "enum" requires that the value can be

Re: C++17 cannot beat D surely

2017-06-03 Thread Meta via Digitalmars-d
On Saturday, 3 June 2017 at 18:31:37 UTC, Russel Winder wrote: On Sat, 2017-06-03 at 13:32 -0400, Andrei Alexandrescu via Digitalmars- d wrote: […] There is nothing to do really. Just use standard library sort. void main() { import std.algorithm, std.stdio; enum a = [ 3, 1, 2,

Re: C++17 cannot beat D surely

2017-06-03 Thread Russel Winder via Digitalmars-d
On Sat, 2017-06-03 at 13:32 -0400, Andrei Alexandrescu via Digitalmars- d wrote: > […] > > There is nothing to do really. Just use standard library sort. > > void main() { > import std.algorithm, std.stdio; > enum a = [ 3, 1, 2, 4, 0 ]; > static auto b = sort(a); >

Re: Release D 2.074.1

2017-06-03 Thread Joseph Rushton Wakeling via Digitalmars-d-announce
On Thursday, 1 June 2017 at 21:04:00 UTC, Martin Nowak wrote: This point release fixes a few issues over 2.074.0, see the changelog for more details. I'm afraid that the release has another fault: the VERSION file still gives 2.074.0. This means that unless it is edited during the build

Re: RAII pointers

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
Thanks to Moritz and Stanislav for their examples, most useful. There are similarities (which I have just taken :-) but also some differences. Would one be considered more idiomatic D, or is it a question of different circumstances different approaches. The differences are mainly in construction I

Dynamic binding to the Mono runtime API

2017-06-03 Thread Jakub Szewczyk via Digitalmars-d-announce
Mono runtime is a cross-platform, open-source alternative to Microsoft's .NET framework [1], and it can be embedded in other applications as a "scripting" VM, but with JIT-compilation enhanced performance and support of many languages such as C#, F# or IronPython [2]. It provides a C API, so

Re: C++17 cannot beat D surely

2017-06-03 Thread Andrei Alexandrescu via Digitalmars-d
On 06/03/2017 01:03 PM, Russel Winder via Digitalmars-d wrote: Björn Fahller has done compile time sort in C++17 here http://playfulpr ogramming.blogspot.co.uk/2017/06/constexpr-quicksort-in-c17.html Surely D can do better? There is nothing to do really. Just use standard library sort. void

Re: D scripting in D

2017-06-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 3 June 2017 at 17:24:08 UTC, Russel Winder wrote: So why isn't rdmd shipped as a separate thing if it can wrap any of the three compilers? it is... the link above is all there is to it, you simply compile it. The docs also call it a download: http://dlang.org/rdmd.html dmd just

Re: D scripting in D

2017-06-03 Thread Russel Winder via Digitalmars-d-learn
On Sat, 2017-06-03 at 17:08 +, Adam D. Ruppe via Digitalmars-d- learn wrote: > On Saturday, 3 June 2017 at 05:04:24 UTC, Russel Winder wrote: > > Not enough is made of rdmd. rdmd needs to be separated from dmd  > > so it works with gdc and ldc2. > > rdmd has always worked with them, at least

Re: D scripting in D

2017-06-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 3 June 2017 at 05:04:24 UTC, Russel Winder wrote: Not enough is made of rdmd. rdmd needs to be separated from dmd so it works with gdc and ldc2. rdmd has always worked with them, at least with their gdmd and ldmd wrappers https://github.com/dlang/tools/blob/master/rdmd.d#L46

C++17 cannot beat D surely

2017-06-03 Thread Russel Winder via Digitalmars-d
Björn Fahller has done compile time sort in C++17 here http://playfulpr ogramming.blogspot.co.uk/2017/06/constexpr-quicksort-in-c17.html Surely D can do better? -- Russel. = Dr Russel Winder t: +44 20 7585 2200

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 06/03/2017 11:08 AM, Andrei Alexandrescu wrote: On 6/2/17 10:17 AM, Mike Parker wrote: Congratulations are in order for Jared Hanson. Walter and Andrei have approved his proposal to remove body as a keyword. I've added a summary of their decision to the end of the DIP for anyone who cares

Re: Strange expression found in std.variant

2017-06-03 Thread Basile B. via Digitalmars-d-learn
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote: When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s);

Re: Strange expression found in std.variant

2017-06-03 Thread Igor Shirkalin via Digitalmars-d-learn
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote: When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s);

Re: Strange expression found in std.variant

2017-06-03 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote: When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s);

Strange expression found in std.variant

2017-06-03 Thread Francis Nixon via Digitalmars-d-learn
When looking at std.variant I found the following line: return q{ static if (allowed!%1$s && T.allowed!%1$s) if (convertsTo!%1$s && other.convertsTo!%1$s) return VariantN(get!%1$s %2$s other.get!%1$s); }.format(tp, op); I was wondering what exactly the % signs where

Re: DIP 1003 (Remove body as a Keyword) Accepted!

2017-06-03 Thread Mike Parker via Digitalmars-d-announce
On Saturday, 3 June 2017 at 07:01:48 UTC, Walter Bright wrote: On 6/2/2017 9:56 PM, MysticZach wrote: Also Mike Parker seems to be doing a very good job in his appointed position as DIP manager. Yes, I am very happy with Mike's contributions on this, as well as on his blog work. We are very

Re: Check for duplicated AA keys at compile time

2017-06-03 Thread Stefan Koch via Digitalmars-d
On Saturday, 3 June 2017 at 14:59:38 UTC, Jacob Carlborg wrote: Would it be reasonable for the compiler to check for duplicated keys in an associative array literal where all the keys are known at compile time? For example: auto aa = ["foo": 1, "foo": 1]; You can write one yourself as soon

The design of the hooks in std.experimental.checkedint

2017-06-03 Thread Jacob Carlborg via Digitalmars-d
I've been looking a bit at the design of the hooks in std.experimental.checkedint. Due to all hooks being optional there's quite a few "static if" in the implementation of checkedint to check if a hook is implemented. Wouldn't it be simpler if all hooks were required and a default

Re: D scripting in D

2017-06-03 Thread rikki cattermole via Digitalmars-d-learn
On 03/06/2017 4:43 PM, Lewis wrote: On Saturday, 3 June 2017 at 09:28:03 UTC, rikki cattermole wrote: A lot of this can be done by simply implementing shared libraries fully on Windows. There is a reason why TypeInfo doesn't cross the dll boundary right now. Sadly it isn't a high priority (and

Re: D scripting in D

2017-06-03 Thread Lewis via Digitalmars-d-learn
On Saturday, 3 June 2017 at 09:28:03 UTC, rikki cattermole wrote: A lot of this can be done by simply implementing shared libraries fully on Windows. There is a reason why TypeInfo doesn't cross the dll boundary right now. Sadly it isn't a high priority (and it really really needs to be "just

Re: Typecasting delegates

2017-06-03 Thread Jacob Carlborg via Digitalmars-d
On 2017-06-02 23:14, Seiji Emery wrote: The main worry that I have is that this could somehow wreak havoc with the GC-managed payload pointer, but I'm not sure. As long as you cast between different type of delegates I don't think it would be a problem. The context pointer is always void*

  1   2   >