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: Nala Ginrut
Subject: Re: [FEATURE] List all available languages
Date: Fri, 01 Feb 2013 10:34:06 +0800

On Thu, 2013-01-31 at 11:32 +0100, Andy Wingo wrote:
> 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?
> 

I talked to mark and I think I get the point of your suggestion
now(hmm...maybe), I'll update it soon.

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

oops ;-)

> > +(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.
> 

yeah~

> >  (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?
> 

My original thought was list them when --help runs, but I realized that
we have guildhall, folks may add many new external
language-frontend(they don't have to be added in Guile itself), so the
--help shows maybe ugly. 
That's why I added --list-languages.
WDYT?  

> > @@ -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





reply via email to

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