Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh at perl conference and few questions

On 23 April 2018 at 12:06, Peter Stephenson <p.stephenson@xxxxxxxxxxx>

> >     for x in {1..20}; do
> >         print "$x * 2 = $[x * 2]"
> >     done
> >
> > seems terrible to me compared to
> >
> >     for x ({1..20}) print "$x * 2 = $[x * 2]"
> I don't really know how widely it's used, but you get a certain amount
> using short loops without having to remember novel syntax.
> for x  in {1..20}; print "$x * 2 = $[x * 2]"
Mikael always reminds that having short_loops enabled weakens the parser
ability to detect errors, so maybe it's worth mentioning here.

> d) is there a plan to have something like namespaces ?
> It was first discussed a long time ago, but no one has bitten the
> bullet.  Simple minded namespaces --- allow dots in the variable works
> --- are trivial, but the variable code is very complicated and working
> out how to do it properly is a big task that no one has been prepared to
> look at (saying "someone else ought to do this" does not count as
> looking at it" :-)).

It's an occasion to me to tell the observation that function namespaces
would be rather more needed than variable ones. The point is that hook
plugins like z-sy-h and zsh-autosuggestions copy each widget to hook into
it. So it's ${#widgets}**2 functions out there with those plugins loaded,
and times of "lets see my functions print -rl -- ${(k)functions}" are over.

Best regards,
Sebastian Gniazdowski

Messages sorted by: Reverse Date, Date, Thread, Author