Import proposals (Ideas)

Dave Dave_member at pathlink.com
Mon Jul 10 11:01:33 PDT 2006


Regan Heath wrote:
> Sub-thread for ideas.

My preference for syntax and semantics would be:

// regular import w/ optional alias (*)
import std.stdio, std.c.stdlib as stdlib, std.date;

// symbol specific lookup w/ optional alias (**)
import from std.stdio writef, writefln as print, readf;

// combined
import std.stdio, from std.thread wait as wait, pause, std.date as date;

* Importing an entire module as an alias would then require a FQN to 
access any of the members, for example given the above:
malloc(...); // error
std.c.stdlib.malloc(...); // error
stdlib.malloc(...); // Ok

** A specific symbol that was not aliased would require a FQN to access. 
For example from above:
std.stdio.writef(...);

This is heavily based on the ideas of others and a summation of my 
understanding of the relevant threads.

Thanks,

- Dave



More information about the Digitalmars-d mailing list