Re: Internal Compiler Error Help

2015-05-21 Thread Andrea Fontana via Digitalmars-d-learn
https://github.com/CyberShadow/DustMite/wiki On Thursday, 21 May 2015 at 08:28:30 UTC, Saurabh Das wrote: Hello, We have been working on a genetic programming project, and occasionally the compiler fails and gives an internal error. I've captured and reduced one of these down to a single

Internal Compiler Error Help

2015-05-21 Thread Saurabh Das via Digitalmars-d-learn
Hello, We have been working on a genetic programming project, and occasionally the compiler fails and gives an internal error. I've captured and reduced one of these down to a single expression. See http://dpaste.dzfl.pl/e7a66aa067ab (reduced_expr.d) When I compile this file using: dmd -c

Re: Template type deduction and specialization

2015-05-21 Thread Daniel Kozák via Digitalmars-d-learn
On Wed, 20 May 2015 17:23:05 -0700 Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 05/20/2015 04:10 PM, Mike Parker wrote: On Wednesday, 20 May 2015 at 13:46:22 UTC, Daniel Kozák wrote: DOC say `may not have` not `must not have` ;-) OK, if that's the

deserialization: creating a class instance without calling constructor

2015-05-21 Thread Timothee Cour via Digitalmars-d-learn
Can I create an instance of A without calling a constructor? (see below) Use case: for generic deserialiaztion, when the deserialization library encounters a class without default constructor for example (it knows what the fields should be set to, but doesn't know how to construct the object).

Re: Internal Compiler Error Help

2015-05-21 Thread Saurabh Das via Digitalmars-d-learn
Thanks! Wow, dustmite is really useful. It reduces the expression down to: double someFunction(double AvgPriceChangeNormalized, double TicksTenMinutesNormalized) { return (TicksTenMinutesNormalized?1:AvgPriceChangeNormalized)?1:TicksTenMinutesNormalized/(TicksTenMinutesNormalized==0)==0;

Re: deserialization: creating a class instance without calling constructor

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 09:06:59 UTC, Timothee Cour wrote: Can I create an instance of A without calling a constructor? (see below) Use case: for generic deserialiaztion, when the deserialization library encounters a class without default constructor for example (it knows what the fields

Re: Internal Compiler Error Help

2015-05-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 21, 2015 08:28:29 Saurabh Das via Digitalmars-d-learn wrote: Am I correct in assuming that an internal error in the compiler should be filed as a bug report? Yes. You should never see an ICE, and the compiler should never segfault. So, whenever you see either of those happen,

Re: Dual conditions in D and Python

2015-05-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, May 21, 2015 16:57:14 Dennis Ritchie via Digitalmars-d-learn wrote: Hi, In Python I can write this: if (4 = 5 = 6): print (OK) - http://rextester.com/NNAM70713 In D, I can only write this: import std.stdio; void main() { if (4 = 5 5 = 6)

Re: Dual conditions in D and Python

2015-05-21 Thread Manfred Nowak via Digitalmars-d-learn
Dennis Ritchie wrote: if (4 = 5 = 6): print (OK) - I would rather write: if( isSorted![4,5,6]) -manfred

Re: Dual conditions in D and Python

2015-05-21 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 21 May 2015 at 18:26:28 UTC, Dennis Ritchie wrote: elif instead of else if: http://rextester.com/WOSH30608 The parallel exchange values: http://rextester.com/TPUD51604 wow!

Re: Dual conditions in D and Python

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 18:26:28 UTC, Dennis Ritchie wrote: On Thursday, 21 May 2015 at 17:43:25 UTC, Jonathan M Davis wrote: No C-based language allows what python does, and based on operators work in C-based languages, what python is doing simply doesn't fit or make sense. What happens

Re: Dual conditions in D and Python

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 21 May 2015 at 17:43:25 UTC, Jonathan M Davis wrote: No C-based language allows what python does, and based on operators work in C-based languages, what python is doing simply doesn't fit or make sense. What happens in C/C++/D/Java/C#/etc. land is that 4 = 5 results in a bool, at

Re: Template type deduction and specialization

2015-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/15 2:35 AM, Daniel Kozák via Digitalmars-d-learn wrote: On Wed, 20 May 2015 17:23:05 -0700 Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 05/20/2015 04:10 PM, Mike Parker wrote: On Wednesday, 20 May 2015 at 13:46:22 UTC, Daniel Kozák wrote: DOC say

Re: Template type deduction and specialization

2015-05-21 Thread Daniel Kozak via Digitalmars-d-learn
On Thursday, 21 May 2015 at 13:12:36 UTC, Daniel Kozák wrote: On Thu, 21 May 2015 08:54:54 -0400 Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 5/21/15 2:35 AM, Daniel Kozák via Digitalmars-d-learn wrote: On Wed, 20 May 2015 17:23:05 -0700 Ali

Re: Internal Compiler Error Help

2015-05-21 Thread Kagamin via Digitalmars-d-learn
double foo(double b) { return b / (b == 0) == 0; } Looks like this fails too.

Re: Internal Compiler Error Help

2015-05-21 Thread Saurabh Das via Digitalmars-d-learn
PS: The original expression: http://dpaste.dzfl.pl/raw/e7a66aa067ab double someFunction(double AvgPriceChangeNormalized, double DayFactor, double TicksTenMinutesNormalized) { return

Re: GC Destruction Order

2015-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/20/15 11:09 AM, Kagamin wrote: On Wednesday, 20 May 2015 at 13:54:29 UTC, bitwise wrote: Yes, but D claims to support manual memory management. It seems to get second class treatment though. It's WIP. There were thoughts to run finalizers on the thread where the object was allocated (I

Re: GC Destruction Order

2015-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/15 8:40 AM, Kagamin wrote: On Thursday, 21 May 2015 at 12:33:33 UTC, Steven Schveighoffer wrote: At this moment, a thread-local-only heap pointer must deal with multi-threading issues simply because destructors can run on another thread, even though the reference is thread-local. The

Re: Internal Compiler Error Help

2015-05-21 Thread Saurabh Das via Digitalmars-d-learn
and please submit to https://issues.dlang.org Submitted: https://issues.dlang.org/show_bug.cgi?id=14613 That expression is, not to put too fine a point on it, mad. The operator precedence itself is giving me a headache, let alone the division of a double by a boolean... I'm pretty sure

Re: DMD Symbol Reference Analysis Pass

2015-05-21 Thread via Digitalmars-d-learn
On Wednesday, 20 May 2015 at 09:41:09 UTC, Per Nordlöw wrote: On Wednesday, 20 May 2015 at 09:27:06 UTC, Per Nordlöw wrote: Ping!?

Re: GC Destruction Order

2015-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/19/15 7:03 PM, bitwise wrote: On Tue, 19 May 2015 18:47:26 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On 5/19/15 5:07 PM, bitwise wrote: On Tue, 19 May 2015 15:36:21 -0400, rsw0x anonym...@anonymous.com wrote: On Tuesday, 19 May 2015 at 18:37:31 UTC, bitwise wrote: On Tue,

Re: Template type deduction and specialization

2015-05-21 Thread Daniel Kozák via Digitalmars-d-learn
On Thu, 21 May 2015 08:54:54 -0400 Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 5/21/15 2:35 AM, Daniel Kozák via Digitalmars-d-learn wrote: On Wed, 20 May 2015 17:23:05 -0700 Ali Çehreli via Digitalmars-d-learn

Re: GC Destruction Order

2015-05-21 Thread Kagamin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 12:33:33 UTC, Steven Schveighoffer wrote: At this moment, a thread-local-only heap pointer must deal with multi-threading issues simply because destructors can run on another thread, even though the reference is thread-local. The biggest example right now is

Re: GC Destruction Order

2015-05-21 Thread Kagamin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 12:33:33 UTC, Steven Schveighoffer wrote: At this moment, a thread-local-only heap pointer must deal with multi-threading issues simply because destructors can run on another thread, even though the reference is thread-local. The biggest example right now is

Re: DMD Symbol Reference Analysis Pass

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 11:52:34 UTC, Per Nordlöw wrote: On Wednesday, 20 May 2015 at 09:41:09 UTC, Per Nordlöw wrote: On Wednesday, 20 May 2015 at 09:27:06 UTC, Per Nordlöw wrote: Ping!? I think you'd be more likely to get responses to this sort of question in the main group, not

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:02:42 UTC, Ali Çehreli wrote: On 05/21/2015 01:56 PM, wobbles wrote: What I ended up doing was creating an OutputRange that contains the files I want to write to. On OutputRange.put I simply print to print to all the files. Just like MultiFile example here: :)

Re: Writing to two files at once

2015-05-21 Thread Cassio Butrico via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:16:59 UTC, wobbles wrote: On Thursday, 21 May 2015 at 21:00:15 UTC, Cassio Butrico wrote: If I understand right you want to redirect the output to a file by a flag , another file type , video printer is it? I think by video printer you mean the console? If so,

Re: Writing to two files at once

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 20:15:29 UTC, wobbles wrote: On Thursday, 21 May 2015 at 20:06:08 UTC, wobbles wrote: I would like to write to two files at once. If user specifies verbose flag, output should write to both stdout and the programs standard output file. Any ideas? I should add,

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 20:15:29 UTC, wobbles wrote: On Thursday, 21 May 2015 at 20:06:08 UTC, wobbles wrote: I would like to write to two files at once. If user specifies verbose flag, output should write to both stdout and the programs standard output file. Any ideas? I should add,

Re: Writing to two files at once

2015-05-21 Thread Cassio Butrico via Digitalmars-d-learn
If I understand right you want to redirect the output to a file by a flag , another file type , video printer is it?

Re: Writing to two files at once

2015-05-21 Thread Ali Çehreli via Digitalmars-d-learn
On 05/21/2015 01:56 PM, wobbles wrote: What I ended up doing was creating an OutputRange that contains the files I want to write to. On OutputRange.put I simply print to print to all the files. Just like MultiFile example here: :)

ImplicitConversionTargets opposite

2015-05-21 Thread Freddy via Digitalmars-d-learn
std.traits has ImplicitConversionTargets. Is there any template that returns the types that can implicty convert to T?

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:00:15 UTC, Cassio Butrico wrote: If I understand right you want to redirect the output to a file by a flag , another file type , video printer is it? I think by video printer you mean the console? If so, yes. I believe I've solved it anyway, see Ali and my

Re: Dual conditions in D and Python

2015-05-21 Thread Ali Çehreli via Digitalmars-d-learn
On 05/21/2015 12:44 PM, Meta wrote: All we need is user-defined opIs and then we're really cooking with gas. if (5 is between(4, 6)) { //... } We're almost there. :) bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max) { return (what = min) (what = max); } void main() { if

Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
I would like to write to two files at once. If user specifies verbose flag, output should write to both stdout and the programs standard output file. Any ideas?

Re: Writing to two files at once

2015-05-21 Thread wobbles via Digitalmars-d-learn
On Thursday, 21 May 2015 at 20:06:08 UTC, wobbles wrote: I would like to write to two files at once. If user specifies verbose flag, output should write to both stdout and the programs standard output file. Any ideas? I should add, I'm using a library that already writes it's output to a

Re: Internal Compiler Error Help

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 08:55:45 UTC, Saurabh Das wrote: Thanks! Wow, dustmite is really useful. It reduces the expression down to: double someFunction(double AvgPriceChangeNormalized, double TicksTenMinutesNormalized) { return

Re: Internal Compiler Error Help

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 10:24:59 UTC, John Colvin wrote: On Thursday, 21 May 2015 at 08:55:45 UTC, Saurabh Das wrote: Thanks! Wow, dustmite is really useful. It reduces the expression down to: double someFunction(double AvgPriceChangeNormalized, double TicksTenMinutesNormalized) {

Re: deserialization: creating a class instance without calling constructor

2015-05-21 Thread Baz via Digitalmars-d-learn
On Thursday, 21 May 2015 at 09:06:59 UTC, Timothee Cour wrote: Can I create an instance of A without calling a constructor? (see below) Use case: for generic deserialiaztion, when the deserialization library encounters a class without default constructor for example (it knows what the fields

Re: Template type deduction and specialization

2015-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/15 10:15 AM, Daniel Kozák via Digitalmars-d-learn wrote: import std.stdio; void f(T:T*)(T* t) { writeln(before change this is not called); } void f(T)(T t) { writeln(before change this is called); } void main() { int val; f(val); f!(int*)(val); } now it

Re: Template type deduction and specialization

2015-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/15 9:14 AM, Daniel Kozak wrote: On Thursday, 21 May 2015 at 13:12:36 UTC, Daniel Kozák wrote: On Thu, 21 May 2015 08:54:54 -0400 Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 5/21/15 2:35 AM, Daniel Kozák via Digitalmars-d-learn wrote: On

Re: Internal Compiler Error Help

2015-05-21 Thread ketmar via Digitalmars-d-learn
On Thu, 21 May 2015 11:36:14 +, Saurabh Das wrote: PS: The original expression: http://dpaste.dzfl.pl/raw/e7a66aa067ab double someFunction(double AvgPriceChangeNormalized, double DayFactor, double TicksTenMinutesNormalized) { return

Re: Internal Compiler Error Help

2015-05-21 Thread Saurabh Das via Digitalmars-d-learn
fair enough. I thought normally you'd want to have some sort of expression simplification in genetic programming, to avoid adding too many superfluous degrees of freedom? Aside from the obvious problems, those extra degrees of freedom can put you at risk of overfitting. Yes - our

Re: Internal Compiler Error Help

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 11:36:15 UTC, Saurabh Das wrote: PS: The original expression: http://dpaste.dzfl.pl/raw/e7a66aa067ab double someFunction(double AvgPriceChangeNormalized, double DayFactor, double TicksTenMinutesNormalized) { return

Re: Internal Compiler Error Help

2015-05-21 Thread Kagamin via Digitalmars-d-learn
If you're looking for speed, how about ldc?

Re: Template type deduction and specialization

2015-05-21 Thread Daniel Kozák via Digitalmars-d-learn
On Thu, 21 May 2015 09:58:16 -0400 Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On 5/21/15 9:14 AM, Daniel Kozak wrote: On Thursday, 21 May 2015 at 13:12:36 UTC, Daniel Kozák wrote: On Thu, 21 May 2015 08:54:54 -0400 Steven Schveighoffer via

Re: fwiw - quora on stroustrup/static if/D

2015-05-21 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 21 May 2015 at 23:28:32 UTC, weaselcat wrote: On Thursday, 21 May 2015 at 17:36:00 UTC, Laeeth Isharc wrote: https://www.quora.com/What-does-Bjarne-Stroustrup-think-about-different-programming-languages The C++ standard committee already reviewed static_if IIRC Andrei and Walter

Re: Dual conditions in D and Python

2015-05-21 Thread weaselcat via Digitalmars-d-learn
On Thursday, 21 May 2015 at 23:14:47 UTC, Dennis Ritchie wrote: On Thursday, 21 May 2015 at 21:35:22 UTC, Ali Çehreli wrote: We're almost there. :) bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max) { return (what = min) (what = max); } void main() { if (5.is_between(4, 6)) {

Re: Dual conditions in D and Python

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 21 May 2015 at 21:35:22 UTC, Ali Çehreli wrote: We're almost there. :) bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max) { return (what = min) (what = max); } void main() { if (5.is_between(4, 6)) { // ... } } Ali A condition is that if, for example,

Re: fwiw - quora on stroustrup/static if/D

2015-05-21 Thread weaselcat via Digitalmars-d-learn
On Thursday, 21 May 2015 at 17:36:00 UTC, Laeeth Isharc wrote: https://www.quora.com/What-does-Bjarne-Stroustrup-think-about-different-programming-languages The C++ standard committee already reviewed static_if IIRC Andrei and Walter said they were being incredibly unfair.

Re: Python's features, which requires D

2015-05-21 Thread weaselcat via Digitalmars-d-learn
On Friday, 22 May 2015 at 00:23:30 UTC, Dennis Ritchie wrote: Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR D doesn't have list comprehensions, so it's difficult to directly port

Re: Python's features, which requires D

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 22 May 2015 at 01:17:17 UTC, weaselcat wrote: D doesn't have list comprehensions, so it's difficult to directly port these. I can not imagine how difficult it is to implement it in D, but I'm pretty sure that nested for loops to fill arrays (in D, you can call them differently,

Re: Python's features, which requires D

2015-05-21 Thread weaselcat via Digitalmars-d-learn
On Friday, 22 May 2015 at 01:52:30 UTC, Dennis Ritchie wrote: On Friday, 22 May 2015 at 01:17:17 UTC, weaselcat wrote: D doesn't have list comprehensions, so it's difficult to directly port these. I can not imagine how difficult it is to implement it in D, but I'm pretty sure that nested for

Re: Python's features, which requires D

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 22 May 2015 at 02:18:23 UTC, weaselcat wrote: On Friday, 22 May 2015 at 01:52:30 UTC, Dennis Ritchie wrote: off the top of my head, the last one can easily be done with std.range.stride import std.stdio, std.range; void main() { int[] a = [ 1, 2, 3, 4, 5, 6 ];

Python's features, which requires D

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR

Re: Python's features, which requires D

2015-05-21 Thread Ali Çehreli via Digitalmars-d-learn
On 05/21/2015 05:23 PM, Dennis Ritchie wrote: Hi, I've collected some of Python's features. It seems to me that they are not in the D! Surely all this is in the D? :) http://rextester.com/CNQQR Here is my attempt: import std.stdio; import std.algorithm; import std.conv; import std.range;

Re: opIndex vs. opSlice for empty slices

2015-05-21 Thread weaselcat via Digitalmars-d-learn
On Friday, 22 May 2015 at 05:47:28 UTC, Mike Parker wrote: I've always used opSlice to produce empty slices, but having recently read the documentation at [1], I see this: To overload a[], simply define opIndex with no parameters: And no mention that opSlice can fill the same role. Am I right

opIndex vs. opSlice for empty slices

2015-05-21 Thread Mike Parker via Digitalmars-d-learn
I've always used opSlice to produce empty slices, but having recently read the documentation at [1], I see this: To overload a[], simply define opIndex with no parameters: And no mention that opSlice can fill the same role. Am I right to infer that we should prefer opIndex over opSlice for

Re: Dual conditions in D and Python

2015-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/21/15 12:57 PM, Dennis Ritchie wrote: Hi, In Python I can write this: if (4 = 5 = 6): print (OK) - http://rextester.com/NNAM70713 In D, I can only write this: import std.stdio; void main() { if (4 = 5 5 = 6) puts(OK); } - http://rextester.com/FICP83173 I

Re: deserialization: creating a class instance without calling constructor

2015-05-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-05-21 11:06, Timothee Cour via Digitalmars-d-learn wrote: Can I create an instance of A without calling a constructor? (see below) Use case: for generic deserialiaztion, when the deserialization library encounters a class without default constructor for example (it knows what the fields

Re: Dual conditions in D and Python

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
Something I sometimes do for strictly personal projects: import std.typecons : ω = tuple; import std.typetuple : Ω = TypeTuple; void main() { auto a = 1, b = 2; Ω!(a, b) = ω(b, a); assert(a==2 b==1); } On Thursday, 21 May 2015 at 19:05:16 UTC, Steven Schveighoffer wrote: On

Re: Dual conditions in D and Python

2015-05-21 Thread Meta via Digitalmars-d-learn
On Thursday, 21 May 2015 at 19:05:16 UTC, Steven Schveighoffer wrote: On 5/21/15 12:57 PM, Dennis Ritchie wrote: Hi, In Python I can write this: if (4 = 5 = 6): print (OK) - http://rextester.com/NNAM70713 In D, I can only write this: import std.stdio; void main() { if (4 = 5 5

Dual conditions in D and Python

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, In Python I can write this: if (4 = 5 = 6): print (OK) - http://rextester.com/NNAM70713 In D, I can only write this: import std.stdio; void main() { if (4 = 5 5 = 6) puts(OK); } - http://rextester.com/FICP83173 I wanted to ask what is the reason? Maybe the

Re: Using arrays of function pointers in D

2015-05-21 Thread Adam D. Ruppe via Digitalmars-d-learn
Start with a function type declaration: void function() func_ptr; Then make an array out of it: void function()[] func_ptr_array; It works like other arrays, just the [] might be a little harder to see since it is a much longer type signature. But it is still in there, right after it,

Re: Internal Compiler Error Help

2015-05-21 Thread Saurabh Das via Digitalmars-d-learn
On Thursday, 21 May 2015 at 14:12:25 UTC, Kagamin wrote: If you're looking for speed, how about ldc? Absolutely - we are working on getting it to compile on ldc and/or gdc.

Using arrays of function pointers in D

2015-05-21 Thread John via Digitalmars-d-learn
I've been rewriting one of my emulators in D and am fairly new to the language. I'm having trouble finding documentation on creating/initializing/use of arrays of function pointers in D. If anyone has a code example I'd appreciate it!

Re: Using arrays of function pointers in D

2015-05-21 Thread John via Digitalmars-d-learn
On Thursday, 21 May 2015 at 16:25:24 UTC, Adam D. Ruppe wrote: Start with a function type declaration: void function() func_ptr; Then make an array out of it: void function()[] func_ptr_array; It works like other arrays, just the [] might be a little harder to see since it is a much longer

Re: Using arrays of function pointers in D

2015-05-21 Thread John Colvin via Digitalmars-d-learn
On Thursday, 21 May 2015 at 16:23:15 UTC, John wrote: I've been rewriting one of my emulators in D and am fairly new to the language. I'm having trouble finding documentation on creating/initializing/use of arrays of function pointers in D. If anyone has a code example I'd appreciate it!

Re: Dual conditions in D and Python

2015-05-21 Thread Alex Parrill via Digitalmars-d-learn
On Thursday, 21 May 2015 at 16:57:16 UTC, Dennis Ritchie wrote: Hi, In Python I can write this: if (4 = 5 = 6): print (OK) - http://rextester.com/NNAM70713 In D, I can only write this: import std.stdio; void main() { if (4 = 5 5 = 6) puts(OK); } -

fwiw - quora on stroustrup/static if/D

2015-05-21 Thread Laeeth Isharc via Digitalmars-d-learn
https://www.quora.com/What-does-Bjarne-Stroustrup-think-about-different-programming-languages

Re: Dual conditions in D and Python

2015-05-21 Thread Dennis Ritchie via Digitalmars-d-learn
On Thursday, 21 May 2015 at 17:17:29 UTC, Alex Parrill wrote: http://wiki.dlang.org/Language_Designs_Explained#Why_does_D_not_support_chaining_comparison_operators.3F Backward compatibility with C is nice but on the other hand it is a road to nowhere! Because of this compatibility, I'm