<div dir="ltr"><span style="font-size:12.8px">`#std.stdio.File` doesn't work, we don't know where is the module separator: </span><br><div><span style="font-size:12.8px">that could mean `module </span><span style="font-size:12.8px">std` with a class stdio with a field File.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">so the syntax would have be:</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">`std.stdio SYMBOL File`</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">frankly I don't care which symbol, so long it looks like that. And as I said, `std.stdio::File` is reasonable since it's used for similar purpose in rust and C++</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> </span><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 13, 2017 at 10:21 PM, Chris M via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tuesday, 14 February 2017 at 03:49:28 UTC, Timothee Cour wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What about allowing syntax sugar as an alternative to relying on the new `from/Module` inline import idiom:<br>
<br>
```<br>
void fun(T)(std.stdio::File input, T value) if (std.traits::isIntegral!T)<br>
{...}<br>
```<br>
<br>
instead of:<br>
<br>
```<br>
void fun(T)(Module!"std.stdio".File input, T value) if<br>
(Module!"std.traits".isIntegra<wbr>l!T) {...}<br>
```<br>
<br>
Rationale:<br>
<br>
* this reads much better (less noise); same as `=>` syntax for lambdas<br>
<br>
* this is expected to be a very common pattern, so might as well make it as simple as possible<br>
<br>
* not particular on which symbol is used, could be something else, so long it doesn't involve writing a string such as from!"std.traits". But :: will be familiar to those coming from C++/rust etc.<br>
<br>
* from!"" is too loose and can be abused arbitrarily:<br>
<br>
```<br>
// this compiles<br>
void fun(){<br>
  from!"std.stdio; pragma(msg,`abuse...`); import std.stdio".File a;<br>
}<br>
```<br>
<br>
Furthermore this is useful in other scenarios, namely when an import is<br>
used only once in a context:<br>
```<br>
auto fun(){  return std.file::getcwd; }<br>
```<br>
is more DRY; instead of:<br>
```<br>
auto fun(){ static import std.file;  return std.file.getcwd; }<br>
auto fun(){ return Module!"std.file".getcwd; }<br>
```<br>
<br>
NOTE: if :: is not feasible for whatever reason, let's consider other symbols without prejudice to this proposal.<br>
</blockquote>
<br></span>
Well, as Jack said there's no real clean way to do this without cluttering the function signatures more. However if this does happen through a language change, :: would look kind of awkward imo. I'd go with the following idea instead.<br>
<br>
void fun(T)(#std.stdio.File input, T value)<br>
if (#std.traits.isIntegral!T)<br>
{...}<br>
<br>
Doesn't necessarily have to be the octothorpe, but I think it looks a bit cleaner.<br>
</blockquote></div><br></div>