I played with reloading modules at runtime a few years back. But there are quite a few problems that really can mess things up in subtle ways:
- If you change your variable initialization, like for example adding a variable or changing a default, a saved state becomes invalid.
- If your saved state doesn't become invalid in reload, it doesn't mean your code will still work after a clean restart. The saved state may be valid, but the initialization function you just tinkered with might produce garbage.
- When doing a larger edit, you'd normally save regularly with unfinished code, just to make sure an editor or system crash doesn't loose you a lot of work.
- Autosave is a thing in some editors.
- The first error in your code can either crash the program or (much worse) mess up the in-memory state without you knowing it.
- If you working on a forking application (like a webserver or similar), you have to choose between responsiveness of changes and reducing Disk IO. Hundred or more processes hitting the disk every half second can be "not fun". Plus, if you have NOT disabled "file access time" (Linux: noatime), this is a surefire way of reducing your SSD lifespan.
I'm not discouraging the use of automatic reloads. Just saying while automatic reloads might be cool and solve some problems, they certainly introduce a set of their own. After a lot of extra gray hair, i have pretty much abandoned the concept of live-reloading code-in-development.
perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.