elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.67k stars 299 forks source link

Add command for loading module #750

Closed xiaq closed 3 years ago

xiaq commented 6 years ago

The use special command does two things: it 1) loads a module, and 2) associate it with a name. Because it does 2, and due to lexical scoping, it cannot take variable module names.

We need a command that only does 1) and is able to take variable module names. Let's say that the command is load-mod; then the following two lines should be equivalent:

use mod
mod: = (load-mod mod)

However, the difference is that load-mod can take a variable argument:

mod: = (load-mod $var)
xiaq commented 3 years ago

This has been implemented as use-mod.