The Many Faces of D - slides

bearophile bearophileHUGS at lycos.com
Sun Oct 3 07:30:12 PDT 2010


Russel Winder:

>I continue to be intrigued by people who believe that code, unlike text, is more readable in a monospace font.  Personally I think monospace fonts make code unreadable,<

I guess it's a matter of personal preferences. But non-proportional fonts have two advantages: 
- it's easy to count spaces, vertical alignments and so on;
- often if the non-proportional is well designed it's simpler to tell apart glyphs like Jl1j0oO;:.


> Given an imperative language with no tail recursion capability

Both DMD and LDC (and probably GDC too) currently are able to turn some cases of tail recursion to iterative code.


>         def sumOfSquares ( sequence ) :
>             return sum ( [ item * item for item in sequence ] )

Since many years and many versions of Python the pythonic way to write that is to use a lazy iterable:

    def sumOfSquares (sequence):
        return sum(item * item for item in sequence)


I have suggested few times a list/lazy comp syntax for D too, and I have tried to explain why it's a good thing (it helps "chunking" in the mind of the programmer).

Bye,
bearophile


More information about the Digitalmars-d mailing list