?

Log in

No account? Create an account
Меркантильный гуру

> Recent Entries
> Archive
> Friends
> Profile
> knutov.com

June 20th, 2019


Previous Entry Share Flag Next Entry
05:58 pm - Deprecation of my() in a false conditional
Открытие дня, цитирую:

To people wondering why this syntax persisted so long: the bug produced by this syntax was actually the only way to have state variables, before the keyword state was introduced. This is why the bug was not fixed. Some people actually used it as a short syntax to implement a state variable:

$ perl -E 'sub flip_flop { my $t if 0; $t = !$t; say $t ? "flip" : "flop"} flip_flop() for 1..4'
flip
flop
flip
flop


https://dev.to/dams/comment/c3mi

А мне то казалось, что так просто код выглядит читабельнее в ряде случаев...
Tags:

(Leave a comment)


> Go to Top
LiveJournal.com