Re: Does scope not work on parameters?

2020-02-22 Thread Russ via Digitalmars-d-learn
On Sunday, 23 February 2020 at 03:26:17 UTC, Steven Schveighoffer wrote: On 2/22/20 10:01 PM, Russ wrote: Is there some newer feature I should be using? scope escapes are only disallowed in @safe code. Adding @safe: to the top of this file makes it not compile with a complaint: Error:

Re: Does scope not work on parameters?

2020-02-22 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/22/20 10:01 PM, Russ wrote: Is there some newer feature I should be using? scope escapes are only disallowed in @safe code. Adding @safe: to the top of this file makes it not compile with a complaint: Error: scope variable z assigned to non-scope b.foo Which I think is what you

Does scope not work on parameters?

2020-02-22 Thread Russ via Digitalmars-d-learn
Hi, I've been playing around with having classes allocated on the stack. I am using the scope keyword for local variables. I assumed that the scope modifier for function parameters was designed to prevent these from escaping, but the code below doesn't show any errors. Is there some newer

Re: Dynamic array of Cycle buffers of size 2 which use a struct?

2020-02-22 Thread Ali Çehreli via Digitalmars-d-learn
On 2/22/20 2:29 PM, Robert M. Münch wrote: I don't get how I can create a dynamic array of Cycle buffers of size 2 which use a struct.  struct ms {    int a;    int b;  }  ms[2] msBuffer;  alias circularStructBuffersT = typeof(cycle(msBuffer));  circularStructBuffersT[int]

Dynamic array of Cycle buffers of size 2 which use a struct?

2020-02-22 Thread Robert M. Münch via Digitalmars-d-learn
I don't get how I can create a dynamic array of Cycle buffers of size 2 which use a struct. struct ms { int a; int b; } ms[2] msBuffer; alias circularStructBuffersT = typeof(cycle(msBuffer)); circularStructBuffersT[int] circularStructBuffers; int i = 2; auto x =

Re: Porting D to custom OS

2020-02-22 Thread IGotD- via Digitalmars-d-learn
On Saturday, 22 February 2020 at 15:18:09 UTC, kinke wrote: I'd suggest to first hack the compiler, so that it doesn't predefine the host OS, but a new version for your OS (and check whether predefining `version (Posix)` is appropriate or not). That way, you'll hit static asserts when

Re: How do you peek a variant containing a complex value?

2020-02-22 Thread nullptr via Digitalmars-d-learn
On Saturday, 22 February 2020 at 18:00:16 UTC, Vinay Sajip wrote: The following program won't compile if I uncomment the if statement: void main() { Variant v = complex(1.0, 1.0); //if (v.peek!(Complex)) { //writeln("Complex"); //} writeln(v); } I get the same error

How do you peek a variant containing a complex value?

2020-02-22 Thread Vinay Sajip via Digitalmars-d-learn
The following program won't compile if I uncomment the if statement: void main() { Variant v = complex(1.0, 1.0); //if (v.peek!(Complex)) { //writeln("Complex"); //} writeln(v); } I get the same error with v.peek!(complex), which is: Error: template instance

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 22 February 2020 at 12:24:56 UTC, drathier wrote: On Saturday, 22 February 2020 at 11:53:38 UTC, Dennis wrote: On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: Is there a dmd flag that shows the code after template instantiations has been performed? The -vcg-ast

Re: Porting D to custom OS

2020-02-22 Thread kinke via Digitalmars-d-learn
On Saturday, 22 February 2020 at 13:20:40 UTC, IGotD- wrote: Do we have any guide for OS porting? I'd suggest to first hack the compiler, so that it doesn't predefine the host OS, but a new version for your OS (and check whether predefining `version (Posix)` is appropriate or not). That

Re: Porting D to custom OS

2020-02-22 Thread Iain Buclaw via Digitalmars-d-learn
On Saturday, 22 February 2020 at 13:20:40 UTC, IGotD- wrote: I'm trying to find information how to port D, especially the D runtime to a proprietary OS. The OS support seems to be scattered around several files with a lot version (OS) switches. This makes kind of hard to understand what you

Fastest linker on Mac OS X

2020-02-22 Thread Per Nordlöw via Digitalmars-d-learn
What's the fastest linker to use when building using dmd or ldc on Mac? My application takes under 1 sec to compiler and 2-3 secs to link.

Porting D to custom OS

2020-02-22 Thread IGotD- via Digitalmars-d-learn
I'm trying to find information how to port D, especially the D runtime to a proprietary OS. The OS support seems to be scattered around several files with a lot version (OS) switches. This makes kind of hard to understand what you have to implement. Also, what happens if you only have partial

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread drathier via Digitalmars-d-learn
On Saturday, 22 February 2020 at 11:53:38 UTC, Dennis wrote: On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: Is there a dmd flag that shows the code after template instantiations has been performed? The -vcg-ast flag does that. The d.cg files still contain templates, so it

Re: 2D matrix operation (subtraction)

2020-02-22 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 22 February 2020 at 08:29:32 UTC, 9il wrote: On Friday, 21 February 2020 at 13:42:24 UTC, Andre Pany wrote: Mir is great and actually I try to rewrite some Python Pandas Dataframe index logic. Maybe mir.series [1] can work for you. Series!(Key*, Value*) - is a pair of two 1D

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: We're looking for a way to speed up compilation of template-heavy code. So we are trying to find out which parts of the code that is most costly to compile. Is there a dmd flag that shows the code after template instantiations

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread Seb via Digitalmars-d-learn
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: We're looking for a way to speed up compilation of template-heavy code. So we are trying to find out which parts of the code that is most costly to compile. Is there a dmd flag that shows the code after template instantiations

Re: Speeding up compilation of template-heavy code

2020-02-22 Thread Dennis via Digitalmars-d-learn
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote: Is there a dmd flag that shows the code after template instantiations has been performed? The -vcg-ast flag does that.

Speeding up compilation of template-heavy code

2020-02-22 Thread Per Nordlöw via Digitalmars-d-learn
We're looking for a way to speed up compilation of template-heavy code. So we are trying to find out which parts of the code that is most costly to compile. Is there a dmd flag that shows the code after template instantiations has been performed? Or some other dmd flag that can help out

Re: GtkD crash

2020-02-22 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 21 February 2020 at 13:36:58 UTC, mark wrote: I thought that onChangeState was never called before the Label was constructed That's one of the 'features' (wink wink) of GtkD. It's possible to call the function as a class function (uninstantiated, in other words) or as an object

Re: 2D matrix operation (subtraction)

2020-02-22 Thread 9il via Digitalmars-d-learn
On Friday, 21 February 2020 at 13:42:24 UTC, Andre Pany wrote: Mir is great and actually I try to rewrite some Python Pandas Dataframe index logic. Maybe mir.series [1] can work for you. Series!(Key*, Value*) - is a pair of two 1D ndslices, they can be sorted according to the first one