[plt-scheme] Scheme sources readability

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Sep 7 11:37:40 EDT 2008

One of the PLT people can answer better than I can, but a few quick 
comments from someone who did a lot of work in other languages before 
moving to Scheme...

Docstrings: There is no standard way to do this.  PLT has an interesting 
new documentation system, Scribble, that has you writing documentation 
outside of the source code files, and I believe I heard a rumor that 
they might do more with embedding the documentation in the files.  There 
are various homebrew ways to embed documentation in various Scheme 
implementations.  For PLT, you could also look at contracts and Typed 
Scheme as ways to embed some documentation.

Design patterns: You might find that many of the design patterns that 
were originally developed with C++ and then Java in mind are irrelevant 
to Scheme and Common Lisp.  As for learning Scheme features, idioms, and 
ways of thinking, a good starting point is HTDP.org.  If you don't work 
through HTDP, one tip I have (which might be controversial) is to learn 
how to write Scheme code without mutations (try not to use things like 
"set!").  Once you've got the hang of that, learn syntactic extension, 
which leads to a higher echelon of programming.

Coding conventions: That could fall under idioms and ways of thinking.  
For how to format code, use the automatic indentation in DrScheme or 
Emacs, and snuggle up ")" to immediately following the last 
non-whitespace character.  For how to name things, there are many 
conventions.  You'll notice that most people put all their identifiers 
in lowercase, with "-" to separate words.  When you see "/" in an 
identifier, it can usually be read as the English word "with".  Lots of 
people name identifiers for parameters beginning with the word 
"current".  ":" in an identifier is often used for things like accessing 
a field of a record, such as "person:firstname" and "person:lastname".  
PLT also has some naming conventions for use with their classes, units, 
and signatures.

Evolution: Scheme is used as a testbed by many programming language 
researchers, so there are constant innovations, some of which become 
adopted as mainstream or in some circles.  For this reason, who can say 
whether it is "early stages".  What I can say is that some Scheme 
implementations are generally more powerful and stable than languages 
that are considered .  I suspect what you will find with Scheme is not 
that the language is immature, but that there are not as many people 
using it as, say, Java.  This can be a curse, but it is also a 
blessing.  (For example of why it is a blessing: I was recently bitten 
when using a popular non-Scheme framework.  It took a while to realize 
that not all the developers had rigorous solutions like Scheme 
developers like PLT usually would, and that the user community chatter 
on average was not very knowledgeable.)


Posted on the users mailing list.