Re: IAP Tools for D

2015-12-22 Thread Guillaume Piolat via Digitalmars-d-announce
On Wednesday, 16 December 2015 at 09:47:35 UTC, Jakob Jenkov 
wrote:


Since we are rather new to D, would anyone be interested in 
helping us a bit out making such a library? We can probably do 
the coding ourselves, but might need some tips about how to 
pack it nicely into a D library which can be used with Dub etc.


Be sure to look at how MsgPack is implemented in D:
https://github.com/msgpack/msgpack-d

It has a very easy interface, and is one of the better D library 
out there.





Re: Three Cool Things about D

2015-12-22 Thread David Nadlinger via Digitalmars-d-announce
On Tuesday, 22 December 2015 at 19:07:55 UTC, Steven 
Schveighoffer wrote:

Am I missing some new feature here? What does the 'this' mean?


I have no idea, this must have been some sort of weird copy/paste 
or auto-correct mistake on my side. It's supposed to be "uint", 
as in Andrei's talk.


 — David


Re: Three Cool Things about D

2015-12-22 Thread Ali Çehreli via Digitalmars-d-announce

On 12/21/2015 09:28 AM, Andrei Alexandrescu wrote:

https://www.reddit.com/r/programming/comments/3xq2ul/codedive_2015_talk_three_cool_things_about_d/


https://www.facebook.com/dlang.org/posts/1192267587453587

https://twitter.com/D_Programming/status/678989872367988741


Andrei


Two unnecessary pedantic corrections:

- One of the earlier slides has "Voldermort" with an extra 'r'. It 
should be Voldemort.


- At the end of one of the optimization presentations you said that the 
behaviour of unsigned integer overflow and *underflow* are well defined. 
Although what you meant is clear and that I've been using "underflow" in 
the same meaning until very recently, I now know that underflow is a 
condition only for floating point types.


Copying from Wikipedia, "Arithmetic underflow can occur when the true 
result of a floating point operation is smaller in magnitude (that is, 
closer to zero) than the smallest value representable as a normal 
floating point number in the target datatype."


Ali



Re: Three Cool Things about D

2015-12-22 Thread Walter Bright via Digitalmars-d-announce

On 12/22/2015 10:29 AM, David Nadlinger wrote:

Not sure about how it arrives at the crazily unrolled loop, but no recursion in
sight anymore.


It's doing tail recursion optimization, which turns the recursion into a loop.
Then the loop is unrolled 8 times.



Re: Three Cool Things about D

2015-12-22 Thread Steven Schveighoffer via Digitalmars-d-announce

On 12/22/15 1:29 PM, David Nadlinger wrote:


---
ulong factorial(this n) {
 return n <= 1 ? 1 : n * factorial(n - 1);
}
---


Am I missing some new feature here? What does the 'this' mean?

-Steve


Re: Three Cool Things about D

2015-12-22 Thread David Nadlinger via Digitalmars-d-announce
On Wednesday, 23 December 2015 at 01:07:57 UTC, Walter Bright 
wrote:

On 12/22/2015 10:29 AM, David Nadlinger wrote:
Not sure about how it arrives at the crazily unrolled loop, 
but no recursion in

sight anymore.


It's doing tail recursion optimization, which turns the 
recursion into a loop.


The recursive call is not quite a tail call by itself, which is 
what Andrei pointed out using that example. But yes, that's what 
happens.



Then the loop is unrolled 8 times.


Sure thing. I was rather surprised to see that happen given that 
I only compiled with -O1, though, as it seems to be quite an 
aggressive optimization.


 — David


Re: Three Cool Things about D

2015-12-22 Thread Nordlöw via Digitalmars-d-announce
On Monday, 21 December 2015 at 17:28:51 UTC, Andrei Alexandrescu 
wrote:

https://www.reddit.com/r/programming/comments/3xq2ul/codedive_2015_talk_three_cool_things_about_d/


Great motivation as always! Thx!


Re: Packt ebooks are currently $5.00

2015-12-22 Thread Robert M. Münch via Digitalmars-d-announce

On 2015-12-21 23:50:17 +, bachmeier said:

All Packt ebooks are currently only $5.00, including pre-order of D Web 
Development, Learning D, and D Cookbook.


https://www.packtpub.com/web-development/d-web-development
https://www.packtpub.com/application-development/learning-d
https://www.packtpub.com/application-development/d-cookbook


Cool, thanks for the link.

@Adam: Will we see an update / extended version of the "D Cookbook" in 
the near future?


--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



Re: Three Cool Things about D

2015-12-22 Thread David Nadlinger via Digitalmars-d-announce
On Monday, 21 December 2015 at 17:28:51 UTC, Andrei Alexandrescu 
wrote:

https://www.reddit.com/r/programming/comments/3xq2ul/codedive_2015_talk_three_cool_things_about_d/


By the way, even though I wholeheartedly share your sentiment 
regarding those "functional" examples, I found it to be an 
interesting example for the power of modern optimizers that LDC 
manages to compile this


---
ulong factorial(this n) {
return n <= 1 ? 1 : n * factorial(n - 1);
}
---

to this:

---
__D4test9factorialFkZm:
mov eax, 1
cmp edi, 2
jb  LBB0_7
mov ecx, edi
lea edx, [rdi + 7]
add edi, -2
mov eax, 1
testdl, 7
je  LBB0_4
and edx, 7
neg edx
mov eax, 1
.align  4, 0x90
LBB0_3:
imulrax, rcx
dec rcx
inc edx
jne LBB0_3
LBB0_4:
cmp edi, 7
jb  LBB0_7
add rcx, -3
.align  4, 0x90
LBB0_6:
lea rdx, [rcx + 3]
imulrdx, rax
lea rax, [rcx + 2]
lea rsi, [rcx + 1]
imulrax, rsi
imulrax, rdx
lea rdx, [rcx - 1]
imulrdx, rcx
lea rsi, [rcx - 2]
imulrsi, rdx
imulrsi, rax
lea rax, [rcx - 3]
lea rdx, [rcx - 4]
imulrax, rdx
imulrax, rsi
add rcx, -8
lea edx, [rcx + 3]
cmp edx, 1
ja  LBB0_6
LBB0_7:
ret
---

Not sure about how it arrives at the crazily unrolled loop, but 
no recursion in sight anymore.


 — David