www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - John-Carmack quotes the D programming language

reply "Guillaume Chatelet" <chatelet.guillaume gmail.com> writes:
A very good article by John-Carmack about purity

http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/
Apr 27 2012
next sibling parent "David Nadlinger" <see klickverbot.at> writes:
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
Apr 27 2012
prev sibling next sibling parent "Nick Sabalausky" <SeeWebsiteToContactMe semitwist.com> writes:
"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.
Apr 27 2012
prev sibling next sibling parent "SomeDude" <lovelydear mailmetrash.com> writes:
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.
Apr 27 2012
prev sibling next sibling parent deadalnix <deadalnix gmail.com> writes:
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.
Apr 27 2012
prev sibling next sibling parent "so" <so so.so> writes:
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.
Apr 27 2012
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
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
Apr 27 2012
prev sibling next sibling parent "David Nadlinger" <see klickverbot.at> writes:
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
Apr 27 2012
prev sibling parent "SomeDude" <lovelydear mailmetrash.com> writes:
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. :)
Apr 28 2012