Inline subroutines

Опубликовано: 30 Июнь 2022
на канале: Liebranca
10
0

It's a hack and a WIP.

Imagine you write a short sub, just a couple lines of code to save you typing. Well, here's the ringer: even if it's just a one-liner, making it a subroutine incurs an overhead. Delightful, eh?

The solution is not making a subroutine call, opting to expand the code within the line (in-line it, that is) whenever the subroutine is 'called'.

The tradeoff obviously is codesize for speed, as now the code is written once but pasted everywhere. But hey, if your PC can run Visual Studio without going into cardiac arrest then it can take this. Plus, it's more mantainable than manually copying and pasting the same block everywhere, and way more natural than using incomplete and malformed macro packages from CPAN that don't even let you share definitions across modules.

So yeah, win-win.

Source code: https://github.com/Liebranca/avtomat

#perl #inline #gnulinux


На этой странице сайта вы можете посмотреть видео онлайн Inline subroutines длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Liebranca 30 Июнь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 10 раз и оно понравилось 0 зрителям. Приятного просмотра!