Re: How to use LLD linker?

2018-07-05 Thread SrMordred via Digitalmars-d-learn
On Saturday, 30 June 2018 at 10:48:49 UTC, Suliman wrote: Correct me if I am wrong, but I have read news that dmd now can be used without C++ Build Tools. I trying to build simple project. And getting Error: Warning: no Visual C++ installation detected OPTLINK (R) for Win32 Release 8.00.17 Co

Re: Static member function returning immutable slice; compiler error: without this cannot be immutable

2018-07-05 Thread Ali Çehreli via Digitalmars-d-learn
On 07/05/2018 01:00 PM, ag0aep6g wrote: > `immutable` means that the data can't ever change. Not even the owning > Foo is allowed to change it. If you want to disallow changes from > outside, but still allow the owning Foo to make changes, use `const`: > > static const(Foo[]) getFooList() T

Re: Why is it hard to make Qt bindings?

2018-07-05 Thread Tony via Digitalmars-d-learn
On Thursday, 5 July 2018 at 12:52:49 UTC, Steven Schveighoffer wrote: On 7/5/18 4:42 AM, drug wrote: There were several attempts to make Qt binding for dlang, but either they has failed or has been stalled. It would be nice to collect that experience. Considering 2.081 supports C++ special mem

Re: Static member function returning immutable slice; compiler error: without this cannot be immutable

2018-07-05 Thread ag0aep6g via Digitalmars-d-learn
On 07/05/2018 09:43 PM, Ivo Maffei wrote: class Foo { private static Foo[] fooSlice = new Foo[0]; //private static slice static immutable Foo[] getFooList() { //static method returning an immutable slice     return fooSlice; } } However when compiling with dub I get the fo

Re: Static member function returning immutable slice; compiler error: without this cannot be immutable

2018-07-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 5 July 2018 at 19:43:43 UTC, Ivo Maffei wrote: private static Foo[] fooSlice = new Foo[0]; //private static That initializer is useless, don't do that, just use the slice. static immutable Foo[] getFooList() { //static method returning an immutable slice Actually, that

Static member function returning immutable slice; compiler error: without this cannot be immutable

2018-07-05 Thread Ivo Maffei via Digitalmars-d-learn
I'm writing my first D program and I want to have a class which contains a private static list of objects. Moreover such list should be visible from outside the class, so I wrote a get method which returns such list as immutable (so that the list cannot be modified outside the class). Finally su

Re: ranges.chunks and map! does not work

2018-07-05 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 5 July 2018 at 12:00:03 UTC, vit wrote: On Thursday, 5 July 2018 at 09:47:32 UTC, Andre Pany wrote: [...] roundRobin doesn't return RandomAccessRange => chunks doesn't return range of RandomAccessRange => Error: no [] operator overload try this: string content = roundRobi

Re: Function Template for Dynamic Parameter

2018-07-05 Thread vino.B via Digitalmars-d-learn
On Sunday, 1 July 2018 at 12:46:30 UTC, Timoses wrote: On Sunday, 1 July 2018 at 11:58:30 UTC, vino.B wrote: On Sunday, 1 July 2018 at 11:52:19 UTC, Alex wrote: NewType.d(19): Error: function declaration without return type. (Note that constructors are always named this) [...] auto coCleanFi

Re: Why is it hard to make Qt bindings?

2018-07-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 05, 2018 11:42:39 drug via Digitalmars-d-learn wrote: > There were several attempts to make Qt binding for dlang, but either > they has failed or has been stalled. It would be nice to collect that > experience. Considering 2.081 supports C++ special member (not all but > majority)

Re: Cleanup class after method?

2018-07-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 05, 2018 05:47:20 Flaze07 via Digitalmars-d-learn wrote: > On Wednesday, 4 July 2018 at 16:02:25 UTC, Jonathan M Davis wrote: > > -dip1000 fully implements scope so that it verifies that no > > reference escapes, but it's not ready yet, let alone the > > default behavior. > > > >

Re: Why is it hard to make Qt bindings?

2018-07-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 July 2018 at 12:52:49 UTC, Steven Schveighoffer wrote: I remember there being a project for qt for D a long time ago. I think this is it: http://www.dsource.org/projects/qtd You may find some way to resurrect this. And QtE5 is still active. He announced support for QML not to

Re: Safe to cast to immutable and return?

2018-07-05 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 12:15:35 UTC, vit wrote: Try pure functions: class A {} A getA()pure @safe //pure whitout mutable parameters guarantees that function doesn't leak data. { A a; // .. do stuff with a // not leaking a to any functions // is this safe re

Re: Why is it hard to make Qt bindings?

2018-07-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/5/18 4:42 AM, drug wrote: There were several attempts to make Qt binding for dlang, but either they has failed or has been stalled. It would be nice to collect that experience. Considering 2.081 supports C++ special member (not all but majority) isn't it time to make another attempt or the

Re: 'is(T==return)' How does is expression with return keyword as TypeSpecialization

2018-07-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/5/18 6:32 AM, Timoses wrote:     int fun(T)(T i)     {     static assert(is(typeof(return) == T)); //true This is the type of the return value for the function you are in.     pragma(msg, is(T == return)); // false This is not a valid is expression, which is why it's false.

Re: 'is(T==return)' How does is expression with return keyword as TypeSpecialization

2018-07-05 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 10:32:01 UTC, Timoses wrote: int fun(T)(T i) { static assert(is(typeof(return) == T)); //true pragma(msg, is(T == return)); // false static if (is(T ReturnType == return)) pragma(msg, ReturnType); // does not enter re

Re: Safe to cast to immutable and return?

2018-07-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/5/18 7:15 AM, Timoses wrote: Is this safe? class A {} immutable(A) getA() {     A a;     // .. do stuff with a     // not leaking a to any functions     // is this safe     return cast(immutable A)a; } As in @safe? no. But it's safe in the fact that you aren't escaping any muta

Re: 'is(T==return)' How does is expression with return keyword as TypeSpecialization

2018-07-05 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 11:37:16 UTC, Timoses wrote: I think it refers to this section: https://dlang.org/spec/expression.html#is_expression should mention that I mean the 6th paragraph.

Re: Safe to cast to immutable and return?

2018-07-05 Thread vit via Digitalmars-d-learn
On Thursday, 5 July 2018 at 11:15:03 UTC, Timoses wrote: Is this safe? class A {} immutable(A) getA() { A a; // .. do stuff with a // not leaking a to any functions // is this safe return cast(immutable A)a; } What if A is replaced with A[] or A[int]? If it's not safe,

Re: ranges.chunks and map! does not work

2018-07-05 Thread vit via Digitalmars-d-learn
On Thursday, 5 July 2018 at 09:47:32 UTC, Andre Pany wrote: Hi, the purpose of this code is to generate CSV based on 3 double arrays. I wonder why map cannot directly use the result of the chunks function. import std.experimental.all; void main() { double[] timestamps = [1.1]; doubl

Re: 'is(T==return)' How does is expression with return keyword as TypeSpecialization

2018-07-05 Thread Alex via Digitalmars-d-learn
On Thursday, 5 July 2018 at 11:37:16 UTC, Timoses wrote: I think it refers to this section: https://dlang.org/spec/expression.html#is_expression I don't remember where I read this usage (think it was in a book), but I noted it down and now I wonder how it can be used. I saw some usage cases,

Re: 'is(T==return)' How does is expression with return keyword as TypeSpecialization

2018-07-05 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 11:21:41 UTC, Alex wrote: On Thursday, 5 July 2018 at 10:32:01 UTC, Timoses wrote: int fun(T)(T i) { static assert(is(typeof(return) == T)); //true pragma(msg, is(T == return)); // false static if (is(T ReturnType == return))

Re: 'is(T==return)' How does is expression with return keyword as TypeSpecialization

2018-07-05 Thread Alex via Digitalmars-d-learn
On Thursday, 5 July 2018 at 10:32:01 UTC, Timoses wrote: int fun(T)(T i) { static assert(is(typeof(return) == T)); //true pragma(msg, is(T == return)); // false static if (is(T ReturnType == return)) pragma(msg, ReturnType); // does not enter re

Re: ranges.chunks and map! does not work

2018-07-05 Thread Alex via Digitalmars-d-learn
On Thursday, 5 July 2018 at 09:47:32 UTC, Andre Pany wrote: Is it correct that I need to call ".map!(c => c.array)"? Kind regards André Well, no. It depends on how you define the formatting string. This would also work: ´´´ import std.experimental.all; void main() { double[] timestamps

Safe to cast to immutable and return?

2018-07-05 Thread Timoses via Digitalmars-d-learn
Is this safe? class A {} immutable(A) getA() { A a; // .. do stuff with a // not leaking a to any functions // is this safe return cast(immutable A)a; } What if A is replaced with A[] or A[int]? If it's not safe, what would be the proper way to return an immutable insta

Re: Using C++ with D / returning a templated type from C++

2018-07-05 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-07-05 08:14:18 +, Seb said: On Thursday, 5 July 2018 at 06:35:01 UTC, Robert M. Münch wrote: So, the only difference left is the C++ static and the additional __ptr64 (whatever this is) on the D side. Any further ideas? Could you post your current C++ and D files? It's a big cod

'is(T==return)' How does is expression with return keyword as TypeSpecialization

2018-07-05 Thread Timoses via Digitalmars-d-learn
int fun(T)(T i) { static assert(is(typeof(return) == T)); //true pragma(msg, is(T == return)); // false static if (is(T ReturnType == return)) pragma(msg, ReturnType); // does not enter return i; } unittest { fun(3); } Wh

Re: ranges.chunks and map! does not work

2018-07-05 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 09:47:32 UTC, Andre Pany wrote: Hi, the purpose of this code is to generate CSV based on 3 double arrays. I wonder why map cannot directly use the result of the chunks function. import std.experimental.all; void main() { double[] timestamps = [1.1]; doubl

ranges.chunks and map! does not work

2018-07-05 Thread Andre Pany via Digitalmars-d-learn
Hi, the purpose of this code is to generate CSV based on 3 double arrays. I wonder why map cannot directly use the result of the chunks function. import std.experimental.all; void main() { double[] timestamps = [1.1]; double[] temperatures = [2.2]; double[] pressures = [3.3];

Re: how to import file from another path in dub ?

2018-07-05 Thread Flaze07 via Digitalmars-d-learn
On Thursday, 5 July 2018 at 08:55:13 UTC, Timoses wrote: Depending on your use case I see these options: - If you have a library that defines the symbols that you are using in the imported files you could use the dub `libs` setting - Otherwise, if you're just using the other folder to separate

Re: how to import file from another path in dub ?

2018-07-05 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 05:38:29 UTC, Flaze07 wrote: I have a dub project, and I put the importPath to the path of the file I want to import and the source file to the source folder, and it appears that I have succeeded at importing the module, but there's one problem, it appears like I nee

Why is it hard to make Qt bindings?

2018-07-05 Thread drug via Digitalmars-d-learn
There were several attempts to make Qt binding for dlang, but either they has failed or has been stalled. It would be nice to collect that experience. Considering 2.081 supports C++ special member (not all but majority) isn't it time to make another attempt or the problem is more complex? Coul

Re: Using C++ with D / returning a templated type from C++

2018-07-05 Thread Seb via Digitalmars-d-learn
On Thursday, 5 July 2018 at 06:35:01 UTC, Robert M. Münch wrote: So, the only difference left is the C++ static and the additional __ptr64 (whatever this is) on the D side. Any further ideas? Could you post your current C++ and D files? So, how or where could such a collection be done? Wel

Re: Error calling geqrs function from lubeck package.

2018-07-05 Thread 9il via Digitalmars-d-learn
On Tuesday, 17 April 2018 at 03:26:25 UTC, Jamie wrote: I'm attempting to use the lubeck package, as described here https://forum.dlang.org/post/axacgiisczwvygyef...@forum.dlang.org I have lubeck, mir-algorithm, mir-blas, mir-lapack downloaded and accessible by the compiler, and I have install