How many HOFs in Phobos?

bearophile bearophileHUGS at lycos.com
Wed Feb 2 02:49:08 PST 2011


Andrei:

Thank you for your answers. Learning to use Phobos algorithms very well takes months.

>You have edit distance that laughs Haskell's out the door,<

The edit distance code in Phobos2 is about 129 lines long (without comments and blank lines), while that Haskell version I've shown is 3 lines long and it was never designed to be library code. Probably there are ways to write a longer Haskell version of the edit distance that's no more than about two times slower than any D version.
On the other hand the dlibs1 library version of the edit distance I've shown is about 10 times faster than the Phobos2 edit distance for that benchmark (but it's less flexible, it doesn't deal with UTF8/16) (and I've seen less troubles with memory allocation too).

I have closed enhancement request 5510, keeping zombie enhancement requests open is bad :-)


> More like it spurs the language to allow better local instantiation.

I think you refer to a recent nice enhancement request. But I am not sure that's enough to regain the dynamism of run-time function pointers.

Bye,
bearophile


More information about the Digitalmars-d mailing list