I am honestly drooling for it,
my $thing = do {
my $intermediate_1 = foo(...);
my $intermediate_2 = bar($intermediate_1, ...);
baz($intermediate_2);
};
type code is something I use quite a lot to be able to name the intermediates while keeping them from escaping into the containing scope. So
let thing = do {
let intermediate_1 = foo(...);
let intermediate_2 = bar(intermediate_1, ...);
baz(intermediate_2);
};
is going to make me a very happy camper.
My other major irritation these days is that 'let' is a statement in JS, whereas 'my' is an expression in perl, and I'm very used to writing
if (my $token = $user->admin_token) {
...
}
and similar constructs. In JS currently I have to write
let token;
if (token = user.admin_token()) {
...
}
(and wrap that entire construct in its own block if I don't want the 'token' variable to continue to exist afterwards, which generally I don't)
The javascript-viable version of that is probably to have a special cased 'if let' just like 'for let' was added already.
I'm unaware of a proposal for that - yet.
Though the 'match' proposal currently in flight IIRC assumes 'do BLOCK' is available, and that will probably give me something sufficient to stop grumbling about that one.
(learning lisp, then applying the same "lexically scope as tight as possible" aesthetic I developed there to my perl code, then trying to use ... pretty much anything else ... has been an irritating experience on occasion ;)