How can I do literate programming?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I do literate programming?

Martin Drautzburg
Hello all,

having a very short memory I need to write quite a lot of comments. I loved
the way to do this in Haskell, where you essentially write a LaTeX document
which happens to contains some code snippets and which still is an executable
program.

In squeak I used to  write "pretty" class comments, using sections with titles
in bold fonts and hypertext links where another class or method was referenced
in the text.

In Pharo and in the latest squeaks this no longer seems to work. Bold fond
silently disappears when saving the comment, hypertext seems to be gone
entirely in Pharo.

Comments in methods are moved aound by the configurable formatter, i.e. I
found no way to place comments BETWEEN statements.

Now I certaninly don't want to complain. But I would be happy if someone could
give me some advice on how to comment code in a stylish way.

--
Martin

Reply | Threaded
Open this post in threaded view
|

Re: How can I do literate programming?

Stéphane Ducasse
We need to improve on that level but this requires to fix the formatter and we do not cycle for that.
Now we would love that.

Guys have been working on a mark down parser so that class comments and help can be optional displayed nicely.
Now the first thing is to write class and methods comments.


> Hello all,
>
> having a very short memory I need to write quite a lot of comments. I loved
> the way to do this in Haskell, where you essentially write a LaTeX document
> which happens to contains some code snippets and which still is an executable
> program.

So in Smalltalk you can write full expressions in comments and class example methods.

>
> In squeak I used to  write "pretty" class comments, using sections with titles
> in bold fonts and hypertext links where another class or method was referenced
> in the text.
>
> In Pharo and in the latest squeaks this no longer seems to work. Bold fond
> silently disappears when saving the comment, hypertext seems to be gone
> entirely in Pharo.
>
> Comments in methods are moved aound by the configurable formatter, i.e. I
> found no way to place comments BETWEEN statements.
>
> Now I certaninly don't want to complain. But I would be happy if someone could
> give me some advice on how to comment code in a stylish way.
>
> --
> Martin
>


Reply | Threaded
Open this post in threaded view
|

Re: How can I do literate programming?

Stephan Eggermont-3
In reply to this post by Martin Drautzburg
You should probably use a MOOSE image if you want to do the modern equivalent
of literate programming. Instead of comments, drive your code from (behavioural)
tests, create glamour & mondrian browsers to visualize the  design and quality
attributes of the code and use magritte style descriptions to declaratively describe
your domain. Then generate LaTeX & pictures from this for the paper trail.

Stephan Eggermont  
Reply | Threaded
Open this post in threaded view
|

Re: How can I do literate programming?

Tudor Girba-2
Excellent recipe :)

Doru


On 21 Apr 2012, at 15:30, Stephan Eggermont wrote:

> You should probably use a MOOSE image if you want to do the modern equivalent
> of literate programming. Instead of comments, drive your code from (behavioural)
> tests, create glamour & mondrian browsers to visualize the  design and quality
> attributes of the code and use magritte style descriptions to declaratively describe
> your domain. Then generate LaTeX & pictures from this for the paper trail.
>
> Stephan Eggermont  

--
www.tudorgirba.com

"We can create beautiful models in a vacuum.
But, to get them effective we have to deal with the inconvenience of reality."