From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Olivier Dion via General Guile related discussions Newsgroups: gmane.lisp.guile.user Subject: Re: Recommended project structure Date: Thu, 08 Jun 2023 23:33:47 -0400 Message-ID: <87fs71e2ck.fsf@laura> References: Reply-To: Olivier Dion Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27345"; mail-complaints-to="usenet@ciao.gmane.io" To: wolf , guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Jun 09 05:34:32 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7StT-0006tD-Ar for guile-user@m.gmane-mx.org; Fri, 09 Jun 2023 05:34:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7Ssz-0005dW-I9; Thu, 08 Jun 2023 23:34:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7Ssy-0005dK-B3 for guile-user@gnu.org; Thu, 08 Jun 2023 23:34:00 -0400 Original-Received: from smtp.polymtl.ca ([132.207.4.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7Ssw-0003KV-Py for guile-user@gnu.org; Thu, 08 Jun 2023 23:34:00 -0400 Original-Received: from localhost (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 3593Xlox003507; Thu, 8 Jun 2023 23:33:51 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 3593Xlox003507 In-Reply-To: X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at Fri, 9 Jun 2023 03:33:47 +0000 Received-SPF: pass client-ip=132.207.4.11; envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19022 Archived-At: On Fri, 09 Jun 2023, wolf 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. > 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. -- Olivier Dion oldiob.dev