Erlang re docs
Lloyd R. Prentice
Sat Jan 30 18:43:26 CET 2021
Thanks for the question.
I don’t like to criticize without having something constructive to contribute. Let me start by saying that I do understand that documentation of software is difficult for many reasons. Nevertheless, here are crucial questions we must ask when we set out to write documentation, indeed, write anything:
— Why am I writing this?
— Who am I writing this for?
— What is the context in which this will be read?
— What would I like my readers to gain by reading this work?
— What do my readers already understand?
— What style/formatting conventions do my readers expect?
— Have I structured my work logically?
— Have I drafted my work as clearly and concisely as I know how?
— Will my readers understand the technical terms or trade jargon that I’m temped to use?
> ...it has a nice interface, just a few functions with clear names.
My guess, Dieter, is that the re doc works for you because you already have enough knowledge and experience to understand, say, when, where, and why you would want to compile a Regexp or run a (Subject, re). So, you scan down and see compile/1 and your needs are met. But you did have to scan down through some 14 blocks of dense text to find compile/1|2. But— given your need to refresh your memory about use of the compile/1|2 functions, did you really need to scan over the second and third paragraphs under Description? Maybe these should be a footnote.
As one who comes to Erlang re with less experience— I’m totally baffled by compile/1, inspect/2, and run/2|3. What in the world are they? How can they be useful to me? I can kind of sus replace/3|4 and split/2|3, but geez man, all that fine print is brain numbing. And most of the text from Perl-Like Regular Expression Syntax on down looks to me like a tutorial and densely written at that. Do I really need to know that stuff to program, say, an Erlang markdown interpreter?
I could say much more. But my take is that the re doc tries to convey much more information than warranted by a reference doc. This suggests, perhaps, the need for additional documentation such as a cookbook-like re tutorial for Erlang noobies and a technical white paper or some such for folks who need to get their hands greasy with internals.
As I scan down through the list of Erlang standard libraries I see any number of which I’d apply the same critique. So an offer to standard library doc writers: Show me when, why, and how to use your library, and I’ll do my best to help you write clear documentation.
Sent from my iPad
> On Jan 30, 2021, at 12:30 AM, Dieter Schön <dieter@REDACTED> wrote:
> Good morning,
> I just looked at the erlang re documentation and I think it has a nice interface,
> just a few functions with clear names.
> I always have trouble to remember which of python's re.match and re.search does what.
> For my taste, there are also enough examples included. Just the PCRE options are a bit overwhelming.
> It would help if you could elaborate on the areas where you have problems.
> Kind regards,
>> On 28.01.21 23:26, Lloyd R. Prentice wrote:
>> I’ve used regular expressions including Erlang regex off and on over the years—enough to get the job done but barely enough to claim competence.
>> But I’m sorry— the documentation for re is total inside baseball. Can’t make heads nor tails.
>> Can someone please please suggest or write a tutorial with lots of examples for mortals who just want to get the job done?
>> Happy to collaborate but can only contribute my ignorance.
>> All the best,
>> Sent from my iPad
More information about the erlang-questions