[GSOC] regular expressions beta is here

bearophile bearophileHUGS at lycos.com
Wed Aug 10 09:02:56 PDT 2011


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).

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.

Bye,
bearophile


More information about the Digitalmars-d mailing list