Functional programming in D and some reflexion on the () optionality.

deadalnix deadalnix at gmail.com
Tue Aug 7 11:36:27 PDT 2012


Le 07/08/2012 17:14, Dejan Lekic a écrit :
> You do not seriously expect D to copy exactly how Haskel (or any other
> similar declarative langauge) treat functions? Does it really have to be
> an exact copy? I am not trying to defend D language designer(s) here,
> just trying to say that D should have own style, if there is sense
> behind it, it does not necessarily have to conform 100% to any paradigm.
>
> The main reason for me to start using D 10 years ago was the obvious
> PRAGMATIC design of the language. I did not start using it because of
> (possible) functional orientation. Actually, I would probably turn my
> back on D if I saw it promotes declarative style more than imperative.
>
> I think the current mix of both worlds is the best direction for D.

The problem isn't about following haskell precisely or not (I think we 
shouldn't). The problem is wanting to have everything, and resulting in 
getting nothing.

Let's take haskell as example. Function are all pure. So it doesn't 
matter when a function get executed or not, and, as a result, haskell 
don't need a explicit function call like () in D.

Some people find that great, and want it to be the case in D. So D drop 
() usage.

Now, as D don't enforce purity, when does the function get executed is 
important. As a result, complicated scheme is implemented to know when 
does the function get executed, wand when it doesn't (You'll notice *4* 
families of scheme for that in D).

As a result, the design is overly complex, and defined nowhere. Just to 
have that haskell feature, that work well in haskell because of some 
other properties of the language D don't have.


More information about the Digitalmars-d mailing list