unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: wolf <wolf@wolfsden.cz>
To: Olivier Dion <olivier.dion@polymtl.ca>
Cc: guile-user@gnu.org
Subject: Re: Recommended project structure
Date: Fri, 9 Jun 2023 14:55:42 +0200	[thread overview]
Message-ID: <ZIMhTt9rVobn-WsR@ws> (raw)
In-Reply-To: <87fs71e2ck.fsf@laura>

[-- Attachment #1: Type: text/plain, Size: 2851 bytes --]

On 2023-06-08 23:33:47 -0400, Olivier Dion wrote:
> On Fri, 09 Jun 2023, wolf <wolf@wolfsden.cz> wrote:
> > Greetings,
> >
> > I am starting a small, personal project and I want to write it in GNU Guile,
> > since I really like it so far.  However, since one of the major goals is for
> > this to be a learning experience and doing it "the right way", I wanted to ask
> > about recommended/standard project structure for Guile projects.  I found
> > this[0] tutorial, but it is from 2017, which is quite some time back (I feel
> > old).
> 
> Actually, what I like about Guile, there is no "the right way" like in
> Python.  Whatever is best for the developers is the right way, not some
> weird standard made by people with their view of the world.
> 
> Anyhow, if you're looking for a common structure, it is actually
> simple.  The root of your project acts like a load path.  So say you
> have two modules.  (foo) and (foo fuz), then you will have foo.scm for
> (foo) and foo/fuz.scm for (foo fuz).
> 
> If you don't like having source files in the root directory
> (i.e. foo.scm), then simply consider a sub-directory of your project as
> the load path for Guile.  For example you could have everything under
> src/.  Therefore, src/foo.scm for (foo) and src/foo/fuz.scm for (foo
> fuz).  However, this kind of break the magic for me.
> 
> Following this, you can then easily configure Geiser in Emacs to add
> the root of your project (or sub-directory) to Guile load path.
> Everything is natural that way.
> 
> What is nice about this structure is that you can have helper modules
> that are not meant for user.  I have for example a scripts/, tests/ and
> tools/ directories in my projects.  That way I can start a REPL and
> use-module my tools/ (debugging, plotting, etc.) or execute a scripts/
> (running tests, benchmarks, etc.).  Everything can be done in the REPL!
> 
> Note that this structure require a little more work when you're doing
> out of tree build, e.g. with autotools.  But for a small Guile project,
> that should not be a problem.

Ah, thank you for the write up.  It is very useful to know how someone actually
does it in practice.  Especially the ease of using REPL in this setup.

In general like autotools, so I will probably try to incorporate them somehow.

> 
> > So I wanted to ask, does the tutorial describe best practices even in 2023?  If
> > not, what would be a good reading on this topic?
> 
> I do not see any link in your message so I can not say.

That is pretty embarrassing mistake on my part, the link is:
https://www.erikedrosa.com/2017/10/29/guile-projects-with-autotools.html .

> 
> -- 
> Olivier Dion
> oldiob.dev

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-06-09 12:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 22:43 Recommended project structure wolf
2023-06-09  3:33 ` Olivier Dion via General Guile related discussions
2023-06-09 12:55   ` wolf [this message]
2023-06-09 16:17     ` Olivier Dion via General Guile related discussions
2023-06-09 19:33       ` David Pirotte
2023-06-16 23:04         ` wolf
2023-06-09 16:41 ` Thompson, David
2023-06-09 18:40 ` Nala Ginrut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZIMhTt9rVobn-WsR@ws \
    --to=wolf@wolfsden.cz \
    --cc=guile-user@gnu.org \
    --cc=olivier.dion@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).