bug-bash
[Top][All Lists]
Advanced

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

Re: feature suggestion: ability to expand a set of elements of an array


From: Martin D Kealey
Subject: Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices
Date: Fri, 28 Jun 2024 17:02:47 +1200

On Thu, 27 Jun 2024, 17:08 Oğuz, <oguzismailuysal@gmail.com> wrote:

> On Thursday, June 27, 2024, Martin D Kealey <martin@kurahaupo.gen.nz>
> wrote:
>
>> [...]
>
>
> That's too much to read
>

You're under no obligation to read what I write, but then kindly don't
pretend that you're "replying" to me.

Perl is not a good example to follow.
>

Perl isn't a perfect language, but it's an immense improvement over the
Shell language, even with Bash's enhancements, and more to the point, it's
an example that proves that it's possible to evolve and rebuild a language
to escape from various archaic crazinesses.

In particular modern Perl scripts no longer use dynamic scoping, unquoted
words that may or may not be string literals, or magic variables to
globally tweak behaviours. (Those things are still there, but it's possible
to avoid using them because there are better ways to get the same results.)

Why not extend the arithmetic expansion syntax to allow generating multiple
> results when subscripting indexed arrays?
>

Why limit this to subscripts?
Why not use that for generating lists directly?

Like `${a[1; 2; 4]}', `${a[3..5; 7]}', `${a[1..10..3]}', etc. These would
> expand like `$@' when in double quotes and like `$*' when being assigned to
> a variable.
>

Why limit this to numeric indexing?
Why not support associative arrays?

-Martin


reply via email to

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