Thread overview
Power of D
Apr 25, 2012
bioinfornatics
Apr 26, 2012
Ary Manzana
Apr 26, 2012
Era Scarecrow
Apr 26, 2012
David
Apr 26, 2012
Nicolas Sicard
Apr 26, 2012
Era Scarecrow
Apr 26, 2012
Brad Anderson
Apr 26, 2012
Jonathan M Davis
April 25, 2012
i search some example of something easy (more easy)  to do in D an not
in another language if possible
- D - C++
- D - Haskell
- D - Java
- D - python

thanks a lot

April 26, 2012
On 4/26/12 1:51 AM, bioinfornatics wrote:
> i search some example of something easy (more easy)  to do in D an not
> in another language if possible
> - D - C++

...

> - D - Haskell
> - D - Java
> - D - python

A segmentation fault is really easy to do in D but hard in those languages. :-P
April 26, 2012
On Wednesday, 25 April 2012 at 17:52:36 UTC, bioinfornatics wrote:
> i search some example of something easy (more easy)  to do in D an not
> in another language if possible
> - D - C++
> - D - Haskell
> - D - Java
> - D - python
>
> thanks a lot

 Associative arrays?

C++:
#include <map>
#include <string>

map<string, string> m;

Java:
import java.util.*;


Map<String, String> map = new HashMap<String, String>();

D:
string[string] map

(Don't know the other two... sorry)
--

 Source/syntax parsing (compared to C++ involving templates/generics).

 Let's see, what else. Utility functions as pseudo members? Since in other language you'd have to include all utility functions in with the class, and try to give it all functionality right away. Anything your missing you may have to inherit from another class (with those functions) or call as regular functions.
April 26, 2012
On Wednesday, April 25, 2012 19:51:18 bioinfornatics wrote:
> i search some example of something easy (more easy)  to do in D an not
> in another language if possible
> - D - C++
> - D - Haskell
> - D - Java
> - D - python
> 
> thanks a lot

Pretty much everything that Andrei talks about in this recent presentation:

http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2012/Three-Unlikely- Successful-Features-of-D?format=html5

The starkest example is compile-time stuff - CTFE, string mixins, and some of the templated stuff. But even something as simple as scope statements are a pretty massive improvement which is impossible in any other language that I've ever used. You can use try-catch-finally blocks (which is what scope statements lower to anyway), but the code is _way_ messier and more error-prone that way.

- Jonathan M Davis
April 26, 2012
Am 26.04.2012 07:55, schrieb Era Scarecrow:
> Associative arrays?
>
> C++:
> #include <map>
> #include <string>
>
> map<string, string> m;
>
> Java:
> import java.util.*;
>
>
> Map<String, String> map = new HashMap<String, String>();
>
> D:
> string[string] map
>
> (Don't know the other two... sorry)
> --


Python:

map = dict() # or
map = {}
April 26, 2012
On Thursday, 26 April 2012 at 10:50:49 UTC, David wrote:
> Am 26.04.2012 07:55, schrieb Era Scarecrow:
>> Associative arrays?
>>
>> C++:
>> #include <map>
>> #include <string>
>>
>> map<string, string> m;
>>
>> Java:
>> import java.util.*;
>>
>>
>> Map<String, String> map = new HashMap<String, String>();
>>
>> D:
>> string[string] map
>>
>> (Don't know the other two... sorry)
>> --
>
>
> Python:
>
> map = dict() # or
> map = {}

I think that many D powerful features are also easily done in Python or have easy to use equivalents, thanks to built-in dictionaries, list comprehensions, eval, etc. and so many available libraries. Albeit at the price of a sloooow execution comparing to D (unless you can utilize native extensions).

April 26, 2012
On Thursday, 26 April 2012 at 12:30:02 UTC, Nicolas Sicard wrote:
> I think that many D powerful features are also easily done in Python or have easy to use equivalents, thanks to built-in dictionaries, list comprehensions, eval, etc. and so many available libraries. Albeit at the price of a sloooow execution comparing to D (unless you can utilize native extensions).

 Heavily used features on a certain scale or larger _should_ be built into the language. C++ added new/delete for memory management, but didn't give you any good containers; Although the STL is there (Honestly without watching a good explanation of how the STL is suppose to work, I got totally lost, and nothing made sense).

 Honestly dealing with the issues of C++ templates, syntax and macros makes me feel like I'm driving with square wheels (It's a bumpy ride). To quote Adam Savage (Mythbusters) "Square wheels are stupid".

 Unfortunately something in my brain makes learning unfamiliar languages that don't follow the structured syntax similar to C/Java/C++/D. I get utterly lost and my head as feels like it's dividing by zero.
April 26, 2012
On Wed, Apr 25, 2012 at 11:55 PM, Era Scarecrow <rtcvb32@yahoo.com> wrote:

> On Wednesday, 25 April 2012 at 17:52:36 UTC, bioinfornatics wrote:
>
>> i search some example of something easy (more easy)  to do in D an not
>> in another language if possible
>> - D - C++
>> - D - Haskell
>> - D - Java
>> - D - python
>>
>> thanks a lot
>>
>
>  Associative arrays?
>
> C++:
> #include <map>
> #include <string>
>
> map<string, string> m;
>
>
You actually want unordered_map<string, string> if you want the equivalent of D's string[string].

Regards,
Brad Anderson