tomhrr / dale

Lisp-flavoured C
BSD 3-Clause "New" or "Revised" License
1.02k stars 48 forks source link

Support c++/rust-like namespaces #174

Open porky11 opened 7 years ago

porky11 commented 7 years ago

in rust and c++ it's also possible to use namespaces like this:

//use only Y from namespace X
//c++
using X::Y;

//rust
use X::Y;
//and if I also want to use Z
use X::{Y,Z};

How I would do it:

;;import a and b from x, c from y
(using ((x (a b)) (y c))
  …body)

If there was something like symbol-macrolet and some function to concatenate symbols this could be implemented on top of it.

(symbol-macrolet ((a (conc-symbol-with . x a)) (b (conc-symbol-with . x b)) (c (conc-symbol-with . y c)))
  …body)