Re: [RFC PATCH 02/28] cli: Add LIL shell

Simon Glass
2021-07-05T15:33:02Z

Hi,

On Sat, 3 Jul 2021 at 13:33, Wolfgang Denk <wd@denx.de> wrote:
>
> Dear Sean,
>
> In message <8bbdb7a1-5085-a3b7-614f-12ae9aee8e8b@gmail.com> you wrote:
> >
> > > For a partial list, see
> > >
> > > [1] https://github.com/Forty-Bot/lil/commits/master
> >
> > Whoops, looks like I completely misread what you were asking here. I
> > don't have an exhaustive list of differences, but here are some similar
> > things expressed in both languages:
> >
> > sh tcl
> >
> > foo=bar set foo bar
> > echo $foo echo $foo
> >
> > if [ 1 -gt 2 ]; then if {1 > 2} {
> > echo a echo a
> > else } {
> > echo b echo b
> > fi }
> >
> > foo() { proc foo {first second} {
> > echo $1 $2 echo $first $second
> > } }
> >
> > for file in $(ls *.c); do foreach file [glob *.c] {
> > echo $file echo $file
> > done }
> >
> > fact() {
> > if [ $1 -eq 0 ]; then
> > echo 1
> > else
> > echo $(($1 * $(fact $(($1 - 1)))))
> > fi
> > }
> >
> > proc fact {n} {
> > if {$n} {
> > expr {$n * [fact [expr {$n - 1}]]}
> > } {
> > return 1
> > }
> > }
> >
> > Hopefully this gives you a bit of a feel for the basic differences.
>
> Well, I know TCL, and there has been a zillion of reasons to move
> _from_ that language many, many years ago. Intoducing this as new
> "shell" language in U-Boot does not look attractive to me.
> Actually, it gives me the creeps.

I was no fan of TCL either but this does seem like a reasonable idea to me.

Obviously whoever wrote it was very concerned about compiler
performance as there seem to be no comments?

Reviewed-by: Simon Glass <sjg@chromium.org>

Regards,
Simon