r/perl • • Jul 31 '21

Cool new Javascript feature

Post image
24 Upvotes

17 comments sorted by

6

u/nrdvana Jul 31 '21

Sometimes I wonder if the focus of perl5 people should be packing the ecmascript steering committee and just gradually introduce all of perl5’s features into the standards track for ecmascript. Then someone with too much free time can write a translator from XS to WebAssembly, and we live happily ever after.

5

u/s-ro_mojosa Jul 31 '21

You mean like WebPerl?

1

u/nrdvana Jul 31 '21

Ha! that’s awesome. But I think it would be better to add perl features to javascript because then you could actually bring the entire javascript developer population along with you, and use perl-ish features in production code that is manipulating the DOM etc.

3

u/Tyler_Zoro Jul 31 '21

The feature I want in JavaScript is Raku's (ne Perl 6) grammars.

But yeah, JavaScript syntax combined with Perl's quality of life features would certainly be nice. Next up: Perl's stack-frame-replacing goto (though please call it something other than goto... one of Perl's biggest mistakes was having the same name for goto LABEL and goto &function.

1

u/daxim πŸͺ cpan author Jul 31 '21

Next up: […] stack-frame-replacing

ES's moral equivalent is TCO. (…: The Musical!)

1

u/Tyler_Zoro Jul 31 '21

This is true in all languages, but it's important to remember that optimizations are limited (especially in cases where parse/optimize/execute happens in the same execution unit, meaning that you cannot afford expensive optimization analysis). Having a way to signal to the compiler that you wish to begin executing in a function without the calling overhead is tremendously valuable to such needs.

1

u/daxim πŸͺ cpan author Jul 31 '21

should be packing the ecmascript steering committee

http://enwp.org/TC39 Yes please, there are some individuals who have no clue what they're doing, like the one writing the harmony spec for Proxy (somewhere on http://wiki.ecmascript.org ca. 2014, can't find it anymore), or the one who decided to standardise bigint without bigrat.

a translator from XS to WebAssembly

already exists, frosty reception on Reddit

3

u/frezik Jul 31 '21

This and the /x modifier on regexes are features that other languages don't know they need.

5

u/daxim πŸͺ cpan author Jul 31 '21

Hypocrisy much? It's okay when Perl adopts a feature from Ada, but when ES does it, it's not?

4

u/Tyler_Zoro Jul 31 '21

I think it's one of the best quality of life ideas in programming, and always have... who are you addressing?

4

u/daxim πŸͺ cpan author Jul 31 '21

the submitter

7

u/Tyler_Zoro Jul 31 '21

Did I miss something? All I see is "Cool new Javascript feature" ... did they say something elsewhere to indicate that they thought it was not "okay"?

It is a cool new JavaScript (well, ES2021) feature and it is an old Perl feature and it was an even older Ada feature... There's nothing wrong with any of that.

0

u/[deleted] Jul 31 '21

[deleted]

1

u/Tyler_Zoro Jul 31 '21

I mean, it's obviously an ironic headline, but the earlier commenter was assuming a level of cynical sarcasm on the part of /u/Negative12DollarBill (and even chastising them for it) that I just don't see as being warranted. It's like someone walking up to you on the street, seeing you wearing bell-bottoms and you say, "fun new fashion!" You can respond as if they're insulting you or as if they're pointing out that it's retro with irony. The former seems to be the less generous interpretation.

I would have posted the exact same thing, and I can tell you with certainty that if I had, it would not be intended as any slight against ES/JavaScript but as a nod to the fact that Perl was well ahead of its time.

0

u/kapitaali_com Jul 31 '21

esoteric COBOL separator

0

u/slimscsi Jul 31 '21

What is `1@@@@@@`?

0

u/zerohourrct Aug 01 '21

There's a reason computer's and calculators are base 2*5. And why we resolve it as one million.