Selective import aliases
Rename imported symbols and use a file-level constant from another source.
Why use this example
Use this pattern to test contract composition, external calls, events, and return values inside one reproducible run. The entry isolates selective import aliases so its input, result, and state changes stay easy to compare.
Solidity to run
import { NumberLibrary as Numbers, FILE_VALUE as importedValue } from "./Numbers.sol"
Numbers.triple(importedValue)Official Solidity reference
Compare this focused investigation with the complete language definition in the Solidity documentation.
Importing other source filesIncluded local files
Solidity REPL creates these files before compiling the main entry, so its imports resolve without additional setup.
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.20;
uint256 constant FILE_VALUE = 14;
library NumberLibrary {
function triple(uint256 value) internal pure returns (uint256) {
return value * 3;
}
}
What to expect
The selective import renames the library and constant, then triples the imported value 14 to return 42.
Continue the investigation
Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.
Read about calls and logs Reproducible investigation