www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - FP in D (today)

reply Gour <gour atmarama.net> writes:
Hello!

After posting about "how to resolve "object-relational impedance
mismatch" using D" dilemma, I did some more homework and today finally
(after being advised in sqlite group) went through The Vietnam of
Computer Science
(http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx=
)=20

which confirmed that for our application the best course of action is to
forget about any attempt to fix mismtach between relational and
object-oriented model by using ORM and to simply skip OOP code in our
application and focus more towards FP.

Interestingly enough, here is intriguing sentence in the
http://en.wikipedia.org/wiki/Functional_programming article stating:
"Among imperative programming languages, the D programming language's
solid support for functional programming stands out." so I'm curious if
anyone more experienced with using FP paradigm in D can comment what
works nicely and is there anything important missing in today's
implementation of D?


Sincerely,
Gour

--=20
Everyone is forced to act helplessly according to the qualities=20
he has acquired from the modes of material nature; therefore no=20
one can refrain from doing something, not even for a moment.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Feb 23 2012
next sibling parent deadalnix <deadalnix gmail.com> writes:
Le 23/02/2012 15:50, Gour a écrit :
 Hello!

 After posting about "how to resolve "object-relational impedance
 mismatch" using D" dilemma, I did some more homework and today finally
 (after being advised in sqlite group) went through The Vietnam of
 Computer Science
 (http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx)

 which confirmed that for our application the best course of action is to
 forget about any attempt to fix mismtach between relational and
 object-oriented model by using ORM and to simply skip OOP code in our
 application and focus more towards FP.

 Interestingly enough, here is intriguing sentence in the
 http://en.wikipedia.org/wiki/Functional_programming article stating:
 "Among imperative programming languages, the D programming language's
 solid support for functional programming stands out." so I'm curious if
 anyone more experienced with using FP paradigm in D can comment what
 works nicely and is there anything important missing in today's
 implementation of D?


 Sincerely,
 Gour
Search for immutability and pure functions. You'll find what you need to do FP in D.
Feb 23 2012
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 2/23/2012 6:50 AM, Gour wrote:
 I'm curious if
 anyone more experienced with using FP paradigm in D can comment what
 works nicely and is there anything important missing in today's
 implementation of D?
The main issue with FP in D today is it needs to be pervasively used in Phobos. A large part of Phobos should be marked as pure, but is not, making it difficult to use Phobos from FP code. For example, Object.opEquals should be pure, nothrow, safe. The inheriting purity thing helps significantly with that.
Feb 23 2012
parent reply Gour <gour atmarama.net> writes:
On Thu, 23 Feb 2012 10:45:38 -0800
Walter Bright <newshound2 digitalmars.com> wrote:

 The main issue with FP in D today is it needs to be pervasively used
 in Phobos. A large part of Phobos should be marked as pure, but is
 not, making it difficult to use Phobos from FP code.
Heh, that's interesting...
 For example, Object.opEquals should be pure, nothrow,  safe.
This is scheduled for the next release?
 The inheriting purity thing helps significantly with that.
Good...we're enthusiastic to put FP's in D on the severe test...hoping to use D as 'the world's most practical FP language'. ;) Sincerely, Gour --=20 But those who, out of envy, disregard these teachings and do not=20 follow them are to be considered bereft of all knowledge, befooled,=20 and ruined in their endeavors for perfection. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Feb 24 2012
parent Walter Bright <newshound2 digitalmars.com> writes:
On 2/24/2012 12:20 PM, Gour wrote:
 On Thu, 23 Feb 2012 10:45:38 -0800
 Walter Bright<newshound2 digitalmars.com>  wrote:

 The main issue with FP in D today is it needs to be pervasively used
 in Phobos. A large part of Phobos should be marked as pure, but is
 not, making it difficult to use Phobos from FP code.
Heh, that's interesting...
 For example, Object.opEquals should be pure, nothrow,  safe.
This is scheduled for the next release?
Not sure yet, but you should certainly be marking all your opEquals that way now.
 The inheriting purity thing helps significantly with that.
Good...we're enthusiastic to put FP's in D on the severe test...hoping to use D as 'the world's most practical FP language'. ;) Sincerely, Gour
Feb 24 2012