liveBook · Manning

Eval

eval is a language operation or built-in function that interprets and executes a code representation within a specified execution context.

How 2 Manning books explain it

The Well-Grounded Rubyist, Fourth Edition

eval is a Ruby method that parses and executes Ruby code supplied as a string within a specified execution context.

How it is used
Uses runtime string evaluation for dynamic expressions, method creation, method invocation, and execution within captured local-variable contexts.
How deep it goes
Explains direct execution, Binding-based scope resolution, related eval methods, and security hazards without detailing parser or VM internals.
Examples
Demonstrates arithmetic evaluation, dynamically named methods, and access to a top-level local variable through binding.
What you can do after
Evaluate/understand how Ruby executes code strings, supplies bindings, and exposes dangerous injection paths.

Read how The Well-Grounded Rubyist, Fourth Edition explains eval →

Python How-To

eval is Python's built-in function that evaluates a string or code object as a Python expression and returns its result.

How it is used
Uses eval to recover Python data represented by strings during text processing.
How deep it goes
Explains string evaluation, iterable pitfalls, syntax errors, and security risks, but does not develop evaluation internals.
Examples
Demonstrates list, tuple, and dictionary strings, constructor failures, malformed syntax, and manual comma-separated parsing.
What you can do after
Apply it via Python's built-in eval to trusted strings representing Python expressions.

Read how Python How-To explains eval →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.