guile-devel
[Top][All Lists]
Advanced

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

Re: [FEATURE] List all available languages


From: Andy Wingo
Subject: Re: [FEATURE] List all available languages
Date: Thu, 31 Jan 2013 11:32:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi :)

On Fri 25 Jan 2013 17:46, Nala Ginrut <address@hidden> writes:

> Users just need a way to know what languages could be specified to
> --language option.

Can you update the patch to use the language-for-humans? accesor that
Mark pushed recently?

> From a6b321e51a19d3726620a68f8db4902877872460 Mon Sep 17 00:00:00 2001
> From: Nala Ginrut <address@hidden>
> Date: Fri, 25 Jan 2013 18:38:22 +0800
> Subject: [PATCH] List all available languages.
>
> * ice-9/command-line.scm: list available languages for 'guile' cmd.
>
> * scripts/compile.scm: list all available languages for 'guild compile' cmd.
>
> * NOTE: 'guile --list-languages' won't list inner languages, but 'guild 
> compile -l'
>         will do that.

It's cool to add notes, but don't prefix it with a `*' as if "NOTE" were
a file name :)  Also please wrap messages to 72 characters.

> +(define (list-languages select)
> +  (let lp((rest (map (lambda (x) (string-append x "/language")) %load-path))
> +          (result '()))
> +    (cond
> +     ((null? rest) (apply (@ (srfi srfi-1) lset-union) string=? result))
> +     (else 
> +      (let ((ll ((@ (ice-9 ftw) scandir) (car rest) select)))
> +        (lp (cdr rest) (if ll (cons ll result) result)))))))
> +

This helper should go in (system base language), I think.

>  (define* (compile-shell-switches args #:optional (usage-name "guile"))
>    (let ((arg0 "guile")
>          (script-cell #f)
> @@ -306,6 +323,12 @@ If FILE begins with `-' the -s switch is mandatory.
>                     (cons `(current-language ',(string->symbol (car args)))
>                           out)))
>  
> +           ((string=? "--list-languages" arg) ; list all languages
> +            (for-each (lambda (l)
> +                        (format #t "~a~%" l))
> +                      (list-languages not-inner-lang?))
> +            (exit 0))
> +
>             ((string=? arg "-ds")        ; do script here
>              ;; We put a dummy "load" expression, and let the -s put the
>              ;; filename in.

Do we need a command-line argument or should the languages just appear
in the --help ?  I would think that appearing in the help would be
sufficient, no?

> @@ -157,6 +169,7 @@ Compile each Guile source file FILE into a Guile object.
>    -W, --warn=WARNING   emit warnings of type WARNING; use `--warn=help'
>                         for a list of available warnings
>  
> +  --list-languages     list all available languages
>    -f, --from=LANG      specify a source language other than `scheme'
>    -t, --to=LANG        specify a target language other than `objcode'
>    -T, --target=TRIPLET produce bytecode for host TRIPLET

Likewise here.

Sorry to be picky, but this adds interface to the Guile main program and
is run whenever Guile is run, so we need to be really careful.

Andy
-- 
http://wingolog.org/



reply via email to

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