Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
seesaw's beautiful docstrings
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dimitrios Jim Piliouras  
View profile   Translate to Translated (View Original)
 More options Jul 25 2012, 4:50 am
From: Dimitrios Jim Piliouras <jimpil1...@gmail.com>
Date: Wed, 25 Jul 2012 11:50:55 +0300
Local: Wed, Jul 25 2012 4:50 am
Subject: seesaw's beautiful docstrings

Hi all,

I've just watched Dave Ray's mini demo of seesaw on infoQ and what amazed
me (apart from the actual library) was the gorgeous documentation that is
attached to all the functions. Dave has done an amazing job - even though
it is essentially a swing wrapper you can get a lot done without knowing
any swing at all!!! This is pretty good stuff...I was wondering if there is
an easier way to generate docstrings like that without alligning spaces and
tab manuallys and more importantly without inlining them with the
functions.  I know it sounds a bit silly but if your source code is
dominated by docs then it is really hard to navigate up and down...I am
generally trying to keep my docs minimal with only plain english and rarely
more than 3-4 lines. However, after seeing what Dave has done I feel rather
jealous! Whenever I tried to produce docs like his the result is rather
ugly unless i systematically fiddle with it through trial and error...So in
essence 2 questions:

-Is there a way write the docs in a separate place (different section of
the document or different document altogether)?
-Is there another way to style your documentation text other than manual
evolutionary means (trial and error)?

Just in case Dave is lurking around,
-You actually wrote and styled  all that documentation by hand?

Jim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent PETIT  
View profile  
 More options Jul 25 2012, 5:17 am
From: Laurent PETIT <laurent.pe...@gmail.com>
Date: Wed, 25 Jul 2012 11:17:34 +0200
Local: Wed, Jul 25 2012 5:17 am
Subject: Re: seesaw's beautiful docstrings

2012/7/25 Dimitrios Jim Piliouras <jimpil1...@gmail.com>

Third option : use an editor/IDE which allows you to "fold" docs (one by
one / fold all / unfold all), and / or to navigate in your source code via
"code outlines"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dimitrios Jim Piliouras  
View profile   Translate to Translated (View Original)
 More options Jul 25 2012, 5:32 am
From: Dimitrios Jim Piliouras <jimpil1...@gmail.com>
Date: Wed, 25 Jul 2012 12:32:52 +0300
Local: Wed, Jul 25 2012 5:32 am
Subject: Re: seesaw's beautiful docstrings

Hmmm I see...you're saying that this is all due to my minimalistic repl
enviroment (raw terminal embedded in gedit + leiningen2)...I know eclipse
does folding and stuff but what about when you want to hit <enter> to break
a line and then you want to align some other sentence underneath? will it
show on the raw terminal exactly as it shows on the eclipse text-editor?
I'm asking because in gedit the only way i can predict where things go is
whenever i have a continuous string (no line breaks)...

Jim

On Wed, Jul 25, 2012 at 12:17 PM, Laurent PETIT <laurent.pe...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Meikel Brandmeyer (kotarak)  
View profile  
 More options Jul 25 2012, 5:56 am
From: "Meikel Brandmeyer (kotarak)" <m...@kotka.de>
Date: Wed, 25 Jul 2012 02:56:45 -0700 (PDT)
Local: Wed, Jul 25 2012 5:56 am
Subject: Re: seesaw's beautiful docstrings

Hi,

you should choose a fixed width font. Then you can line up sentences
without problems using spaces. Inconvenient, but doable.

Kind regards
Meikel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tassilo Horn  
View profile  
 More options Jul 25 2012, 8:16 am
From: Tassilo Horn <tass...@member.fsf.org>
Date: Wed, 25 Jul 2012 14:16:52 +0200
Local: Wed, Jul 25 2012 8:16 am
Subject: Re: seesaw's beautiful docstrings

Laurent PETIT <laurent.pe...@gmail.com> writes:
>> -Is there a way write the docs in a separate place (different section
>> of the document or different document altogether)?

Sure.

--8<---------------cut here---------------start------------->8---
(defn plus1 [x] (+ x 1))
(alter-meta! #'plus1 assoc :doc "Adds one to x.")
--8<---------------cut here---------------end--------------->8---

> Third option : use an editor/IDE which allows you to "fold" docs (one
> by one / fold all / unfold all), and / or to navigate in your source
> code via "code outlines"

That's probably the better approach.

Bye,
Tassilo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent PETIT  
View profile   Translate to Translated (View Original)
 More options Jul 25 2012, 9:02 am
From: Laurent PETIT <laurent.pe...@gmail.com>
Date: Wed, 25 Jul 2012 15:02:47 +0200
Local: Wed, Jul 25 2012 9:02 am
Subject: Re: seesaw's beautiful docstrings

2012/7/25 Dimitrios Jim Piliouras <jimpil1...@gmail.com>

> Hmmm I see...you're saying that this is all due to my minimalistic repl
> enviroment (raw terminal embedded in gedit + leiningen2)...I know eclipse
> does folding and stuff but what about when you want to hit <enter> to break
> a line and then you want to align some other sentence underneath? will it
> show on the raw terminal exactly as it shows on the eclipse text-editor?
> I'm asking because in gedit the only way i can predict where things go is
> whenever i have a continuous string (no line breaks)...

tbh, Counterclockwise does not yet have folding (tho it is a WIP in a
contributor's branch I haven't yet had the time to review - shame on me)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dimitrios Jim Piliouras  
View profile  
 More options Jul 25 2012, 5:13 pm
From: Dimitrios Jim Piliouras <jimpil1...@gmail.com>
Date: Thu, 26 Jul 2012 00:13:44 +0300
Local: Wed, Jul 25 2012 5:13 pm
Subject: Re: seesaw's beautiful docstrings

ooo thanks Tassilo...I knew that the docstring is stored as metadata but I
did not know I could mutate it after the binding is set..this is very cool
on its own!

As far as IDEs go i will have a look around even though i was quite happy
with my minimal setup...I also tend to use clooj when on the road which is
steadily getting better...I gave ccw several chances as I was totally in
love with eclipse in my java days, but even though I do like the editor and
all the clever things it can do, I still cannot get my head round how to
work efficiently on the eclipse repl...I specifically remember spawning a
new repl every time i was loading a namespace which seemed very odd cos i
had to close them all at the end... emacs on the other hand seems more like
a religion rather than an editor!!! The thing is my timetable atm does not
allow any deviations and it would big deviation if i was to decide to learn
emacs any time soon....

thank you both for your precious time and suggestions... cheers!

Jim

On Wed, Jul 25, 2012 at 4:02 PM, Laurent PETIT <laurent.pe...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent PETIT  
View profile  
 More options Jul 25 2012, 6:26 pm
From: Laurent PETIT <laurent.pe...@gmail.com>
Date: Thu, 26 Jul 2012 00:26:05 +0200
Local: Wed, Jul 25 2012 6:26 pm
Subject: Re: seesaw's beautiful docstrings

2012/7/25 Dimitrios Jim Piliouras <jimpil1...@gmail.com>

> ooo thanks Tassilo...I knew that the docstring is stored as metadata but I
> did not know I could mutate it after the binding is set..this is very cool
> on its own!

> As far as IDEs go i will have a look around even though i was quite happy
> with my minimal setup...I also tend to use clooj when on the road which is
> steadily getting better...I gave ccw several chances as I was totally in
> love with eclipse in my java days, but even though I do like the editor and
> all the clever things it can do, I still cannot get my head round how to
> work efficiently on the eclipse repl...I specifically remember spawning a
> new repl every time i was loading a namespace which seemed very odd cos i
> had to close them all at the end...

Then by all means give ccw another try


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Ray  
View profile  
 More options Jul 25 2012, 9:06 pm
From: Dave Ray <dave...@gmail.com>
Date: Wed, 25 Jul 2012 18:06:02 -0700
Local: Wed, Jul 25 2012 9:06 pm
Subject: Re: seesaw's beautiful docstrings

For what it's worth, the docstrings are indeed hand-formatted, but that's
pretty easy with vim or any decent editor. The size of the docstrings is a
bit of a problem. At one point on Twitter Fogus suggested that Trammel
could help off-load documentation elsewhere, but I never was motivated
enough to pursue it.

Cheers,
Dave


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Derricutt  
View profile  
 More options Jul 25 2012, 10:25 pm
From: Mark Derricutt <m...@talios.com>
Date: Thu, 26 Jul 2012 14:25:56 +1200
Local: Wed, Jul 25 2012 10:25 pm
Subject: Re: seesaw's beautiful docstrings
On 25/07/12 9:17 PM, Laurent PETIT wrote:
> Third option : use an editor/IDE which allows you to "fold" docs (one
> by one / fold all / unfold all), and / or to navigate in your source
> code via "code outlines"

I was just musing on wanting a Hopscotch style IDE for clojure:

http://theoryinpractise.tumblr.com/post/28023552869/everytime-i-tinke...

The IDE gives a nice code browser, navigating between namespaces and
functions in a collapsible manner along with a REPL.

Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frank Siebenlist  
View profile  
 More options Jul 25 2012, 11:40 pm
From: Frank Siebenlist <frank.siebenl...@gmail.com>
Date: Wed, 25 Jul 2012 20:40:40 -0700
Local: Wed, Jul 25 2012 11:40 pm
Subject: Re: seesaw's beautiful docstrings
We have an smalltalk-like clojure namespace/var/type-browser for docstrings/clojuredocs/source at "https://github.com/franks42/clj-ns-browser" that may be of use… which happens to be built on top of seesaw.

-FrankS.

On Jul 25, 2012, at 7:25 PM, Mark Derricutt wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Derricutt  
View profile  
 More options Jul 26 2012, 12:44 am
From: Mark Derricutt <m...@talios.com>
Date: Thu, 26 Jul 2012 16:44:20 +1200
Local: Thurs, Jul 26 2012 12:44 am
Subject: Re: seesaw's beautiful docstrings
On 26/07/12 3:40 PM, Frank Siebenlist wrote:
> We have an smalltalk-like clojure namespace/var/type-browser for docstrings/clojuredocs/source at "https://github.com/franks42/clj-ns-browser" that may be of use which happens to be built on top of seesaw.

Hey that looks awesome! I saw it mentioned awhile back but it's come a
long way since I last peeked.

Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tassilo Horn  
View profile  
 More options Jul 26 2012, 5:10 am
From: Tassilo Horn <tass...@member.fsf.org>
Date: Thu, 26 Jul 2012 11:10:43 +0200
Local: Thurs, Jul 26 2012 5:10 am
Subject: Re: seesaw's beautiful docstrings

Laurent PETIT <laurent.pe...@gmail.com> writes:

Hi!

> Third option : use an editor/IDE which allows you to "fold" docs (one
> by one / fold all / unfold all), and / or to navigate in your source
> code via "code outlines"

BTW, I just noticed that you can use Emacs' hs-minor-mode to fold
top-level forms.  For example, when you fold

  (defmacro when-not
    "Evaluates test. If logical false, evaluates body in an implicit do."
    {:added "1.0"}
    [test & body]
      (list 'if test nil (cons 'do body)))

what's displayed is just

  (defmacro when-not...)

That's pretty nice, but its not very clojure specific.  For example, if
metadata precedes the var name, it doesn't work.

  (def
   ^{:arglists '([coll])
     :doc "Return the last item in coll, in linear time"
     :added "1.0"
     :static true}
   last (fn ^:static last [s]
          (if (next s)
            (recur (next s))
            (first s))))

becomes just

  (def ...)

But hideshow.el has some customization possibilities, so probably it
could be tuned to do more clojure-specific folding.

Bye,
Tassilo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Gabriele  
View profile  
 More options Jul 27 2012, 12:43 pm
From: John Gabriele <jmg3...@gmail.com>
Date: Fri, 27 Jul 2012 09:43:18 -0700 (PDT)
Local: Fri, Jul 27 2012 12:43 pm
Subject: Re: seesaw's beautiful docstrings

On Wednesday, July 25, 2012 8:16:52 AM UTC-4, Tassilo Horn wrote:

> Laurent PETIT writes:

> >> -Is there a way write the docs in a separate place (different section
> >> of the document or different document altogether)?

> Sure.

> --8<---------------cut here---------------start------------->8---
> (defn plus1 [x] (+ x 1))
> (alter-meta! #'plus1 assoc :doc "Adds one to x.")
> --8<---------------cut here---------------end--------------->8---

Wow, that's nice...

Reminds me of the paths that Python and Perl have taken regarding this
issue.

Python goes with having very short docstrings, but then longer separate
documentation available elsewhere. I'm personally not crazy about this
approach, because I usually end up wanting to know more than the rather
skimpy docstrings tell me.

Perl 5 doesn't have docstrings, but they do have an embedded "POD" markup
doc format, the content of which often serves as docstrings (though POD is
also used for longer external docs as well). I'm much happier with the
richer Perl 5 docs, but the issue of having all those docs clog up your
code had led to a best practice of just moving them all to the end of the
file.

Tassilo's note that you can use `alter-meta!` for roughly the same thing
seems similar to the Perl 5 approach giving you the best of both worlds:

  * you end up with more complete docstrings (making your users happier),
  * that don't clog up your code (or require code-folding to achieve that
end), and
  * that still go in the same source file (thus keeping your code and api
docs together).

I'd imagine that it wouldn't be too difficult to create a tool to extract
docstrings out into alter-metas at the bottom, or the reverse --- gather up
alter-metas at the bottom and stitch them into their respective function
defns, if that's your preference.

I like it. Make your docstrings as long as they need to be (perhaps add
some examples?). Even format them in markdown to make them more readable in
the repl.

---John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »