tomhrr / dale

Lisp-flavoured C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support c++/rust-like namespaces

porky11 opened this issue · comments

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)