On 10.08.2011 20:02, bearophile wrote:
Dmitry Olshansky:
To get a small no-crap-included beta package see download section of
https://github.com/blackwhale/FReD for .7zs.
When you write some English text you don't write a single block of text, you
organize it into paragraphs, and paragraphs into chapters, chapters into
sections, sections into books, etc. Time ago I have understood that paragraphs
are very good in source code too.
So I suggest you to add a blank line here and there inside your functions to separate
them into paragraphs. I can't give you a style rule, you will need to create your own
style, but often a function that's more than 10 lines line long needs one or more blank
lines inside (some people say that every time you see one of such paragraphs in a
function, especially if it has a comment before it, then you need to perform an
"extract method" to improve the code. I believe this is a bad advice).
While I haven't asked for review, I do appreciate comments. I have to
say I did no cleanup or otherwise shape up the code, I'm still working
on semantic side part of problems:)
Honestly I can't get why you are so nervous about code style anyway, you
seem to bring this up way to often.
About spaces personally I dislike eating extra vertical space for
"clarity", curly braces on it's own line is already way too much.
I see no contracts in the code (I mean the ones with assert inside, instead of
enforce). I suggest Walter to fix this situation. One idea is to include two
versions of Phobos lib in the zip of the dmd distribution, one with asserts
compiled in and one without, and let DMD import from the correct library
according to the compilation flags.
Some solution to this problem is getting urgent, because Phobos is growing
without the use of one of the nicest features of D (contract programming).
Solving this problem is more urgent than having an excellent regex library in
Phobos. If people don't use contract programming much, is because you can't use
it in Phobos.
Have to respectfully disagree on this, don't try to nail everything on
contracts. They are nice but have little value over plain assert
_unless_ we are talking about classes and _inheritance_, which isn't the
case here. And there are lots of asserts here, but much more of input is
enforced since it's totally expected to supply wrong pattern (or have an
outside user to type in the pattern).
Bye,
bearophile
--
Dmitry Olshansky