Inline imports redivivus

Ali Çehreli acehreli at yahoo.com
Fri Mar 11 13:01:43 UTC 2022


On 3/10/22 22:48, Zach Tollen wrote:

 > ::std.datetime:SysTime          // if we put the `::` first it becomes
 > viable
 >                                  // it's a different version of the `$`
 >

Perhaps a second meaning for ..? And is : really necessary? So, would 
the following work?

   ..std.datetime.Systime

Now it seems to have a different meaning from "importing" though. In 
this case it feels like we are "using" Systime from that module. And the 
rationale for .. can be:

- Single dot already means "this module".
- Two dots may mean "outside of this module".

Going off topic and without knowing whether this topic has already been 
brought up, should inline imports automatically be made available to the 
callers of functions? Arbitrarily using the $ syntax:

module my.module;

void foo($bar:SomeSymbol a) {
}

Since 'foo' is public to the users of my.module, should we expect the 
users be able to call 'foo' without importing SomeSymbol separately 
themselves? And the next question may be what if SomeSymbol is 
accessible to my.module but not to my users (e.g. if it's 'package'). 
So, if it should automatically be imported for the users, should 
SomeSymbol automatically be raised to 'public' status for the users of 
'foo'?

Ali



More information about the Digitalmars-d mailing list