Re: D float types operations vs C++ ones

2015-12-18 Thread Ola Fosheim Gr via Digitalmars-d-learn
On Friday, 18 December 2015 at 07:30:52 UTC, drug wrote: What I mean about order of operations is that if you go a = b*a+c*c + e; the compiler is free to rewrite that as float __tmp0 = a*b; float __tmp1 = c*c; and then do either of float __tmp2 = __tmp0+__tmp1; a = __tmp2 + e; OR float __tmp2 =

Re: What is the best way to program over "abstract" types in D?

2019-11-23 Thread Ola Fosheim Gr via Digitalmars-d-learn
On Saturday, 23 November 2019 at 13:17:49 UTC, mipri wrote: I read your question as "can I have typeclasses in D?" I guess you could interpret it that way. I think you knowing Rust at all might be clouding your vision, actually. I have hardly ever ran the Rust compiler outside of the onlin

Re: delegates & GC allocations

2014-08-20 Thread Ola Fosheim Gr via Digitalmars-d-learn
non-static nested functions are effectively delegates as it needs a context pointer to parent stack frame. Only if it is recursive.

Re: delegates & GC allocations

2014-08-20 Thread Ola Fosheim Gr via Digitalmars-d-learn
On Wednesday, 20 August 2014 at 20:48:38 UTC, Chris Nicholson-Sauls wrote: On Wednesday, 20 August 2014 at 15:17:52 UTC, Ola Fosheim Gr wrote: non-static nested functions are effectively delegates as it needs a context pointer to parent stack frame. Only if it is recursive. Or if it refers t

Re: delegates & GC allocations

2014-08-20 Thread Ola Fosheim Gr via Digitalmars-d-learn
On Wednesday, 20 August 2014 at 21:19:18 UTC, Ola Fosheim Gr wrote: On Wednesday, 20 August 2014 at 20:48:38 UTC, Chris Nicholson-Sauls wrote: On Wednesday, 20 August 2014 at 15:17:52 UTC, Ola Fosheim Gr wrote: Only if it is recursive. Or if it refers to any state of the parent function. As

Re: delegates & GC allocations

2014-08-20 Thread Ola Fosheim Gr via Digitalmars-d-learn
On Wednesday, 20 August 2014 at 21:30:41 UTC, Etienne wrote: So, my question inspired a new optimization? :-p A decent optimizing compiler would detect that the function is calling itself and save stack space by using register where possible...

Re: Are there any exercises/challenges for D?

2014-08-24 Thread Ola Fosheim Gr via Digitalmars-d-learn
On Sunday, 24 August 2014 at 23:36:55 UTC, Ola Fosheim Grøstad wrote: On Sunday, 24 August 2014 at 23:20:21 UTC, maik klein wrote: It's actually quite strange that no one has done something like this in D, it's usually the first thing people do. Bearophile has created many such examples at Ros