artanis
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: controller syntax (for guix)


From: Nala Ginrut
Subject: Re: controller syntax (for guix)
Date: Tue, 13 Sep 2022 13:13:59 +0800
User-agent: mu4e 1.4.15; emacs 27.1

Hi Mortimer!
I think there're something different from your understanding.

Mortimer Cladwell writes:

> Below I am talking about my toy Artanis app "myapp" found at
> https://github.com/mbcladwell/myapp
>
> If I generate the pages.scm controller using 'art draw controller...' I get
> the templated first lines that I modify to look like:
>
> ------8<--------------pages.scm-----START----------------8<-------------
> ; Controller intro definition of pages
> ;; Please add your license header here.
> ;; This file is generated automatically by GNU Artanis.
> (define-artanis-controller pages) ; DO NOT REMOVE THIS LINE!!!
>
> (use-modules (artanis utils)(artanis artanis)(myapp lib mylib))
> ------8<--------------------------END----------------8<-------------

If you put customized lib in lib/ path, usually lib/myapp is the default
path. For an instance, (current-toplevel)/lib/myapp/utils.scm, you
should import (myapp utils).
The load path init should be handled by `art work'.


> There are two potential sources of guix warnings when controllers using
> this syntax are packaged and installed by guix:
>
> 1. error: define-artanis-controller: unbound variable
> hint: Did you forget `(use-modules (artanis mvc controller))'?

Could you try to test the vanilla repo? IIRC, I recently fixed similar issue.

> 2. hint: File `.../pages.scm' should probably start with: (define-module
> (myapp app controllers pages))

I guess this pages.scm is your own module. The module definition line
should be generated by Artanis inexplicitly, you shouldn't write it by yourself.

> Note that these are warnings only, the app runs fine.  However if you have
> 10 controllers in your app you will get 10 warnings with each invocation of
> guix package i, -r, -s or guix pull.    I think that might be disconcerting
> for casual guix users.
>
> These warnings can be eliminated by rewriting the controller as a module:

This kind of fix breaks too many things.
I think it's better to find out the reason why it throw warnings in
Guix. Everything works fine without Guix, so there's must be a reason.

> i.e. I comment out the define-module section and explicitly move it into
> the controller.  Note this breaks your desire for encapsulation. There are
> probably work-arounds but I haven't thought that through yet.  These
> changes have not been tested extensively, only on myapp which does not have
> models, so I am uncertain of the #:autoload modification.
>
> Your thoughts?  OK to change controller syntax?

No, it's too simple to fix like that. ;-)


Best regards.


--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]