unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Nikita Karetnikov <nikita@karetnikov.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: bug-guix@gnu.org
Subject: Enhanced 'warning' (was: [PATCH] Add 'guix hash'.)
Date: Thu, 18 Apr 2013 09:01:51 +0400	[thread overview]
Message-ID: <871ua85t4w.fsf@karetnikov.org> (raw)
In-Reply-To: 874nflx8e3.fsf@gnu.org

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

> I think it’d be nice to have a ‘warning’ procedure in (guix ui), so
> things are uniform.

It think it might be better to have a single 'warning' macro which could
handle several cases (errors, warnings and similar things).  (Actually,
'guix hash' should use errors, not warnings.)

Here is a simplified version:

(define-syntax define-output-macro
  (syntax-rules ()
    ((_ name prefix)
     (define-syntax name
       (lambda (x)
         (syntax-case x (_ N_)
           ((name (_ str))
            (with-syntax ((prefix (datum->syntax x prefix)))
              #'(display (string-append prefix str "\n"))))
           ((name (N_ str1 str2))
            (with-syntax ((prefix (datum->syntax x prefix)))
              #'(display (string-append prefix str1 str2 "\n"))))))))))

;; (Is there a way not to repeat 'with-syntax'?)

(define-output-macro warning "warning: ")
(define-output-macro error* "error: ")

scheme@(guile-user)> (warning (_ "foo"))
warning: foo

scheme@(guile-user)> (error* (N_ "foo" "bar"))
error: foobar

And here is a problem...  Is it possible to compose a macro (e.g.,
'error*') with (exit 1) without touching the internals of
'define-output-macro'?

Here is an example with a function:

(define (error**)
  (display "Error!\n"))

(define (error-n-exit)
  (begin
	(error**)
	(exit 1)))

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  parent reply	other threads:[~2013-04-18  4:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01  5:06 [PATCH] Add 'guix hash' Nikita Karetnikov
2013-04-03  8:34 ` Ludovic Courtès
2013-04-05 14:04   ` Nikita Karetnikov
2013-04-05 14:14     ` Nikita Karetnikov
2013-04-05 16:15       ` Ludovic Courtès
2013-04-10 11:48         ` Nikita Karetnikov
2013-04-10 11:54           ` Ludovic Courtès
2013-04-10 12:21             ` Nikita Karetnikov
2013-04-10 17:30               ` Ludovic Courtès
2013-04-05 16:13     ` Ludovic Courtès
2013-04-09 16:28       ` Nikita Karetnikov
2013-04-11 20:35         ` Ludovic Courtès
2013-04-12  5:24           ` master: FAIL: tests/guix-package.sh (was: [PATCH] Add 'guix hash'.) Nikita Karetnikov
2013-04-12  6:48             ` master: FAIL: tests/guix-package.sh Nikita Karetnikov
2013-04-12 16:24             ` Ludovic Courtès
2013-04-18  5:01       ` Nikita Karetnikov [this message]
2013-04-18  5:06         ` Enhanced 'warning' Nikita Karetnikov
2013-04-18 11:55         ` Ludovic Courtès
2013-04-18 19:27           ` Nikita Karetnikov
2013-04-18 20:59             ` Ludovic Courtès
2013-04-19 20:16               ` [PATCH] ui: Add a 'define-diagnostic' macro. (was: Enhanced 'warning') Nikita Karetnikov
2013-04-20  5:48                 ` [PATCH] ui: Add a 'define-diagnostic' macro Nikita Karetnikov
2013-04-20  9:10                   ` Ludovic Courtès
2013-04-20 17:33                     ` Nikita Karetnikov
2013-04-20 19:55                       ` Ludovic Courtès
2013-04-20  9:09                 ` Ludovic Courtès
2013-04-21 18:14       ` [PATCH] Add 'guix hash' Nikita Karetnikov
2013-04-21 19:02         ` Ludovic Courtès

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=871ua85t4w.fsf@karetnikov.org \
    --to=nikita@karetnikov.org \
    --cc=bug-guix@gnu.org \
    --cc=ludo@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).