diff mbox series

[bug#63330,4/4] gnu: Add lager.

Message ID 848cb412c5732ef45f170dfb6838a3691ca3f71e.1683389080.git.liliana.prikler@gmail.com
State New
Headers show
Series Functional programming? In my C++?! It's more likely than you think! | expand

Commit Message

Liliana Marie Prikler May 6, 2023, 1:43 p.m. UTC
* gnu/packages/cpp.scm (lager): New variable.
---
 gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Maxim Cournoyer May 7, 2023, 3:34 p.m. UTC | #1
Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> * gnu/packages/cpp.scm (lager): New variable.
> ---
>  gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> index 0ab7d0785b..fe6a0edd31 100644
> --- a/gnu/packages/cpp.scm
> +++ b/gnu/packages/cpp.scm
> @@ -101,6 +101,7 @@ (define-module (gnu packages cpp)
>    #:use-module (gnu packages web)
>    #:use-module (gnu packages xml)
>    #:use-module (gnu packages xorg)
> +  #:autoload   (gnu packages serialization) (cereal)
>    #:use-module (ice-9 match))

Does autoload buys us something here?  Otherwise I'd stick with the
conventional use-module, to avoid future instances of cargo-culting :-).

In my opinion, that's a direction that should be pursued in Guile
(autoloading modules by default when declarative modules (no side
effects allowed) are used) rather than in every Guile applications out
there.

Otherwise this series LGTM, with the minor comments I left earlier taken
into account.
Liliana Marie Prikler May 7, 2023, 3:57 p.m. UTC | #2
Am Sonntag, dem 07.05.2023 um 11:34 -0400 schrieb Maxim Cournoyer:
> Hi Liliana,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > * gnu/packages/cpp.scm (lager): New variable.
> > ---
> >  gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
> > 
> > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
> > index 0ab7d0785b..fe6a0edd31 100644
> > --- a/gnu/packages/cpp.scm
> > +++ b/gnu/packages/cpp.scm
> > @@ -101,6 +101,7 @@ (define-module (gnu packages cpp)
> >    #:use-module (gnu packages web)
> >    #:use-module (gnu packages xml)
> >    #:use-module (gnu packages xorg)
> > +  #:autoload   (gnu packages serialization) (cereal)
> >    #:use-module (ice-9 match))
> 
> Does autoload buys us something here?  Otherwise I'd stick with the
> conventional use-module, to avoid future instances of cargo-culting
> :-).
It only frees us from the import cycle that would exist otherwise.

> In my opinion, that's a direction that should be pursued in Guile
> (autoloading modules by default when declarative modules (no side
> effects allowed) are used) rather than in every Guile applications
> out there.
Not sure I understand what you're saying, nor the impact of it.

Cheers
Maxim Cournoyer May 7, 2023, 5:10 p.m. UTC | #3
Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Sonntag, dem 07.05.2023 um 11:34 -0400 schrieb Maxim Cournoyer:
>> Hi Liliana,
>> 
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>> 
>> > * gnu/packages/cpp.scm (lager): New variable.
>> > ---
>> >  gnu/packages/cpp.scm | 32 ++++++++++++++++++++++++++++++++
>> >  1 file changed, 32 insertions(+)
>> > 
>> > diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
>> > index 0ab7d0785b..fe6a0edd31 100644
>> > --- a/gnu/packages/cpp.scm
>> > +++ b/gnu/packages/cpp.scm
>> > @@ -101,6 +101,7 @@ (define-module (gnu packages cpp)
>> >    #:use-module (gnu packages web)
>> >    #:use-module (gnu packages xml)
>> >    #:use-module (gnu packages xorg)
>> > +  #:autoload   (gnu packages serialization) (cereal)
>> >    #:use-module (ice-9 match))
>> 
>> Does autoload buys us something here?  Otherwise I'd stick with the
>> conventional use-module, to avoid future instances of cargo-culting
>> :-).
> It only frees us from the import cycle that would exist otherwise.

OK, that's a good reason to have it.

>> In my opinion, that's a direction that should be pursued in Guile
>> (autoloading modules by default when declarative modules (no side
>> effects allowed) are used) rather than in every Guile applications
>> out there.
> Not sure I understand what you're saying, nor the impact of it.

I meant that it'd be nice if Guile gave us lazy loading by default
instead of relying on humans to use #:autoload where it makes sense.
Simon Tournier May 11, 2023, 1:23 p.m. UTC | #4
Hi,

On dim., 07 mai 2023 at 13:10, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

>>> > +  #:autoload   (gnu packages serialization) (cereal)
>>> >    #:use-module (ice-9 match))
>>> 
>>> Does autoload buys us something here?  Otherwise I'd stick with the
>>> conventional use-module, to avoid future instances of cargo-culting
>>> :-).
>> It only frees us from the import cycle that would exist otherwise.
>
> OK, that's a good reason to have it.

Maybe a comment would be helpful to remember that answer. :-)

Elsewhere, we use:

--8<---------------cut here---------------start------------->8---
    (inputs
     (list ;; XXX: We can't simply #:use-module due to a cycle somewhere.
           (module-ref
            (resolve-interface '(gnu packages engineering))
            'cgns)
           cli11
[...]           
--8<---------------cut here---------------end--------------->8---

see paraview-5.9, d-tools, make-autoconf-wrapper, etc.


Cheers,
simon
Liliana Marie Prikler May 14, 2023, 10:31 a.m. UTC | #5
Am Donnerstag, dem 11.05.2023 um 15:23 +0200 schrieb Simon Tournier:
> Maybe a comment would be helpful to remember that answer. :-)
Point taken.

Pushed the series with a follow-up commit to add said comment.

Cheers
diff mbox series

Patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 0ab7d0785b..fe6a0edd31 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -101,6 +101,7 @@  (define-module (gnu packages cpp)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
+  #:autoload   (gnu packages serialization) (cereal)
   #:use-module (ice-9 match))
 
 (define-public argagg
@@ -1448,6 +1449,37 @@  (define-public zug
 sequential transformations.")
      (license license:boost1.0))))
 
+(define-public lager
+  (let ((commit "2016df38be90ee176bcb73ea414be2318bc1ef31")
+        (revision "0"))
+    (package
+     (name "lager")
+     (version (git-version "0.0.0" revision commit))
+     (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/arximboldi/lager")
+                    (commit commit)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "1b7zxwqrbm7db7wxqbsrk7jjd3znvvi1cwj7jg6zkmf0199071a5"))))
+     (build-system cmake-build-system)
+     (arguments (list #:test-target "check"
+                      #:configure-flags #~(list "-Dlager_BUILD_EXAMPLES=no")
+                      #:phases
+                      #~(modify-phases %standard-phases
+                          (add-after 'unpack 'delete-failing-tests
+                            (lambda _
+                              (delete-file-recursively "test/event_loop"))))))
+     (inputs (list boost immer zug))
+     (native-inputs (list cereal))
+     (home-page "https://sinusoid.es/lager")
+     (synopsis "Library for value-oriented design")
+     (description "Lager is a library for value-oriented design implementing
+the unidirectional data-flow architecture.  Apart from a store and various
+event loops it also provides lenses and cursors.")
+     (license license:expat))))
+
 (define-public atomic-queue
   (package
     (name "atomic-queue")