Runtime Function Redefinition in Programming: Perl's Dynamic Capabilities vs. Go's Static Nature
By
todsacerdoti
A five-star bake. Worth schmearing, sharing, saving.
Summary
The article explores the concept of redefining functions at runtime in programming languages, contrasting Perl's dynamic capabilities with Go's static nature. It discusses how Perl allows functions to be rewritten during execution, enabling techniques like aggressive memoization that can propagate through a codebase. The author reflects on the trade-offs between dynamic flexibility and static safety, using personal experience with Perl to illustrate how runtime function modification can lead to performance improvements at the cost of increased memory usage and reduced dynamism.
Key quotes
· 4 pulledI once wrote a Perl subroutine that would memoize the subroutine that called it.
A well-placed call to aggressively_memoize could back-propagate to the whole codebase, spreading functional purity like a virus.
The resulting program would get faster as it used more memory and became increasingly static.
That was possible because Perl, like many interpreted languages, allows functions to be rewritten at runtime.
You might also wanna read
Dynamic Borrow-Checking in a Toy Programming Language: Implementing Rust-like Memory Safety Without Static Types
This article presents a demonstration of a toy programming language that implements borrow-checking without static type-checking. The langua
C++26 Standard Draft Finalized with Reflection, Memory Safety, Contracts, and New Concurrency Framework
The C++26 standard draft has been completed, introducing major new features including reflection capabilities that allow C++ to describe its
Understanding Fil-C: A Simplified Model of Memory-Safe C/C++ Implementation
The article presents a simplified model of Fil-C, a memory-safe implementation of C/C++. It explains that while the real Fil-C uses a compil
Sky: An Experimental Elm-Inspired Programming Language That Compiles to Go
Sky is an experimental programming language that combines Go's pragmatism with Elm's elegance to create a fullstack functional programming l
Analyzing Rust's Coherence and Orphan Rules: Ecosystem Development Challenges and Proposed Solutions
This article critiques Rust programming language's coherence rules and orphan rules, which prevent implementing traits for types defined in
SBCL Fibers: Implementation Design for Lightweight Cooperative Threads
This is a draft design document describing the implementation of lightweight userland cooperative threads (called 'fibers') for SBCL (Steel
