Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
April 27, 2012 John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
A very good article by John-Carmack about purity http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/ |
April 27, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Chatelet | On Friday, 27 April 2012 at 07:26:52 UTC, Guillaume Chatelet wrote:
> A very good article by John-Carmack about purity
>
> http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/
So all that Twitter spamming finally led to something? :P
SCNR,
David
|
April 27, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Chatelet | "Guillaume Chatelet" <chatelet.guillaume@gmail.com> wrote in message news:llzwwxmdgnwydqcyfznn@forum.dlang.org... >A very good article by John-Carmack about purity > > http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/ Yea, that is good. Sometimes I agree with Carmack, and sometimes I don't, but he's always fascinating to listen to, and I'm always impressed by his intelligence and clairity-of-thought on complex matters. |
April 27, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Friday, 27 April 2012 at 08:21:07 UTC, Nick Sabalausky wrote:
> "Guillaume Chatelet" <chatelet.guillaume@gmail.com> wrote in message
> news:llzwwxmdgnwydqcyfznn@forum.dlang.org...
>>A very good article by John-Carmack about purity
>>
>> http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/
>
> Yea, that is good.
>
> Sometimes I agree with Carmack, and sometimes I don't, but he's always
> fascinating to listen to, and I'm always impressed by his intelligence and
> clairity-of-thought on complex matters.
Plus, he is extremely down to earth when tackling problems. He
has been rather conservative when coming to programming
languages, so if he talks about issues like purity, he probably
has studied and practiced them well enough to feel authorized to
talk about them. And I bet he started to look at it because of he
need for multithreaded programming.
|
April 27, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Chatelet | Le 27/04/2012 09:26, Guillaume Chatelet a écrit :
> A very good article by John-Carmack about purity
>
> http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/
The drawTriangle example is a very good example of why weak purity is good. D have made a very good move here.
|
April 27, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Chatelet | On Friday, 27 April 2012 at 07:26:52 UTC, Guillaume Chatelet wrote:
> A very good article by John-Carmack about purity
>
> http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/
Just a glance AND my eyes managed to parse "axilmar" in thousands of words.
I better get some fresh air.
|
April 27, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Chatelet | Guillaume Chatelet: > A very good article by John-Carmack about purity > > http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/ >Returning everything by value is the natural functional programming style, but relying on compilers to always perform return value optimization can be hazardous to performance, so passing reference parameter for output of complex data structures is often justifiable, but it has the unfortunate effect of preventing you from declaring the returned value as const to enforce single assignment.< Is this what he is talking about? class Foo { int x; } const(Foo) bar() pure { auto f = new Foo; f.x = 1; return f; } void main() pure {} ---------------------- Regarding D purity I have asked for another little improvements: http://d.puremagic.com/issues/show_bug.cgi?id=7994 It's related to this other example: import std.string: text; string foo() { return text(1); } void main() pure { enum s = foo(); // currently an error } Bye, bearophile |
April 27, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 27 April 2012 at 14:51:01 UTC, bearophile wrote:
> John Carmack:
>>Returning everything by value is the natural functional programming style, but relying on compilers to always perform return value optimization can be hazardous to performance, so passing reference parameter for output of complex data structures is often justifiable, but it has the unfortunate effect of preventing you from declaring the returned value as const to enforce single assignment.<
>
> Is this what he is talking about?
>
> class Foo {
> int x;
> }
> const(Foo) bar() pure {
> auto f = new Foo;
> f.x = 1;
> return f;
> }
> void main() pure {}
No, he is referring to the call site of the function which returns something by ref, where you can't declare the »target« const:
---
/* const */ Foo foo;
initializeFoo(foo);
---
David
|
April 28, 2012 Re: John-Carmack quotes the D programming language | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Chatelet | On Friday, 27 April 2012 at 07:26:52 UTC, Guillaume Chatelet wrote: > A very good article by John-Carmack about purity > > http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/ Someone mentioned Fabrice Bellard on the reddit thread. I just noticed that F. Bellard had a link to (the old) D prog language homepage from his own tcc page http://bellard.org/tcc/ I so wish a genius like him came here and give some help on the compiler... that would be so awesome. :) |
Copyright © 1999-2021 by the D Language Foundation