Notes IV

bearophile bearophileHUGS at lycos.com
Fri Jan 25 03:03:19 PST 2008


Jarrod:

>I don't really see what this fixes.<

It improves code readability, probably reducing total bug count. Two common (and well enough designed) languages do it (Python and C#) so you have to take the idea seriously before refusing it.


>It seems you just prefer to use 'in' because you're used to python.<

I am used to program in many different languages, as probably most D programmers :-)


>'len' is kind of ugly, something like 'size' would be nice.<

size is better than length, so I am okay with it.


>Couldn't you just make an object for this in the first place? I don't want to see functions being used as objects when they should be.. well, functions.<

Static variables are already available in functions, so that's just a dotted way to access those variables. That idea may be a way to keep memory usage low and to implment singletons (pattern) in a simple way :-)


>Most people don't like the forced indentation in python and I'm one of those people.<

Some people don't like it, most Python/Haskell programmers like it, I have liked it before knowing Python or the citation of Knuth :-)
Note that in my post I haven't suggested to change D to introduce significant whitespace like in Python, I have just shown a possible source of D bugs that Python avoids... if you are right when you say that's not a common bug (and I may agree with you) then no changes are necessary.


>Enforcing 'prettier' code limits personal styles<

Often enforcing a common style is positive, if you program at professional level with many hands on the same code you too can see that style standards are very used and useful. Even if you write code alone, you probably have later to lend the code to others, or receive it from them, so a more standard way of writing it improves code sharing, readability, etc. The net result is that's more likely for you to find on internet that module you just really need for your code soon right now.


>and makes for a slower implementation.<

I don't belive/understand this.


>No one wants to spend time worrying about how their code looks when sometimes they just want to get it done and move on.<

Then few people will want to read/mantain/modify the code you write, even if all you write are rarely used 20-lines long Perl scripts.
My code is elegant, well written, and I'm proud of it ;-)

Bye and than you for your answers,
a bear hug,
bearophile



More information about the Digitalmars-d mailing list