[Top][All Lists]

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

Re: Neat hacks for a birthday

From: Ludovic Courtès
Subject: Re: Neat hacks for a birthday
Date: Fri, 10 Feb 2012 21:45:05 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux)


Nala Ginrut <address@hidden> skribis:

> The easy way is to write a loadable builtin command for Bash which can do
> the simple Scheme evaluation work with Guile core. And I finished it: git://
> PS: 'BIG' for Bash Inner Guile

Excellent.  :-)


> It's so easy that almost useless, one may use Guile REPL rather than BIG or
> 'guile -c' to eval expressions. But as Ludo said "a proof of concept". ;-)

Yes, that’s the idea.  :-)

> All I expected is the harder way. But I'm not quite familiar with
> Bash architecture, so I just provide some suggestions and wishes here:
> We may modify "parser.y" to add S-exp parsing


> If we can use S-exp in Bash, I think these would be interesting:
> x=5
> echo "$((+ 1 ${x}))" ==> 6
> echo "$((expt 2 ${x}))" ==> 32

Instead of adding an s-exp parser in Bash, how about adding a single new
syntax form, say “$) EXPR ($” (there are few available tokens!), that
would parse EXPR with scm_read, and evaluate it with scm_eval?

> Moreover, maybe modify the evaluator of Bash and transform "define" to
> define a variable in Bash? Then the namespace is unified in Bash, when Bash
> code passes exp into Guile, all variables within will be evaluated to the
> actual value and Guile will eval the exp. But I think that would bereave
> lexical scope of Scheme code.

Actually, Emacs’ Eshell does something like that for ELisp
functions–i.e., one can invoke both ‘ls’ and ‘find-file’, seamlessly.

Food for thought.  :-)


reply via email to

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