On Friday, 18 August 2017 at 09:18:42 UTC, Timon Gehr wrote:
Any downsides?
...
- It introduces a new type that would not really be necessary.
This is avoidable, at the cost of a little more verbosity:
D newbie here: is there a non-negligible cost to creating a
stateless struct type?
On Friday, 18 August 2017 at 09:18:42 UTC, Timon Gehr wrote:
---
module util;
// ...
template Imports(T...){
import std.string,std.algorithm;
mixin([T].map!(x=>"public import "~x~";").join);
// or, starting from DMD 2.076, you could use static
foreach instead:
// static
On 18.08.2017 03:11, Johnson Jones wrote:
private struct oo{
import std.stdio: writeln, write;
import std.algorithm: filter, map;
// …
}
void main(){
oo.write("result: ");
oo.writeln(oo.map!(x=>x/2)(oo.filter!(x=>x%2==0)([1,2,3,4,5,6,10])));
}
Wow, that might solve the
On 18.08.2017 01:25, jmh530 wrote:
On Thursday, 17 August 2017 at 21:49:38 UTC, Timon Gehr wrote:
private struct oo{
import std.stdio: writeln, write;
import std.algorithm: filter, map;
// …
}
void main(){
oo.write("result: ");
On Thursday, 17 August 2017 at 21:49:38 UTC, Timon Gehr wrote:
On 17.08.2017 23:03, aberba wrote:
On Wednesday, 16 August 2017 at 13:57:17 UTC, jmh530 wrote:
On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
This looks really clean for code modularity.
import io = std.stdio :
On Thursday, 17 August 2017 at 21:49:38 UTC, Timon Gehr wrote:
private struct oo{
import std.stdio: writeln, write;
import std.algorithm: filter, map;
// …
}
void main(){
oo.write("result: ");
oo.writeln(oo.map!(x=>x/2)(oo.filter!(x=>x%2==0)([1,2,3,4,5,6,10])));
}
Would
On 17.08.2017 23:03, aberba wrote:
On Wednesday, 16 August 2017 at 13:57:17 UTC, jmh530 wrote:
On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
This looks really clean for code modularity.
import io = std.stdio : {writeln, write}, ...
What does this add? A line like below would
On Thursday, 17 August 2017 at 21:03:33 UTC, aberba wrote:
On Wednesday, 16 August 2017 at 13:57:17 UTC, jmh530 wrote:
On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
This looks really clean for code modularity.
import io = std.stdio : {writeln, write}, ...
What does this add?
On Wednesday, 16 August 2017 at 13:57:17 UTC, jmh530 wrote:
On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
This looks really clean for code modularity.
import io = std.stdio : {writeln, write}, ...
What does this add? A line like below would be confusing.
import io = std.stdio
This was hard to keep reading, but ultimately enjoyable, because
your arguments stem from interpretations and opinions of my point
rather than the points I was making.
It is interesting that you feel I've claimed your point is
baseless when I made no attempt to say such. Would help if I
On Thursday, 17 August 2017 at 11:40:11 UTC, rjframe wrote:
It doesn't quite work; it provides access to all names in the
module, and
write/writeln is introduced into the global namespace; e.g.,
it's
interpreted as
`import io = std.stdio; import std.stdio : write, writeln;`
On Wed, 16 Aug 2017 12:04:13 +, jmh530 wrote:
>
> Well I knew that renamed imports were allowed, but I didn't realize you
> could do re-named selective imports (the " : writeln,
> write" part of it). I just double-checked and it worked. I don't recall
> it working in the past.
>
> I see that
On Wednesday, 16 August 2017 at 19:05:54 UTC, Jesse Phillips
wrote:
On Tuesday, 15 August 2017 at 20:33:18 UTC, Johnson wrote:
On Tuesday, 15 August 2017 at 03:37:39 UTC, rikki cattermole
wrote:
But then that only helps with one specific instance. D is full
of language features, I do not see
On Wednesday, 16 August 2017 at 18:38:23 UTC, Johnson Jones wrote:
Not really, I'm not doing selective imports.
[snip]
I'll preface this by saying that I think Jesse Phillips' point is
a good one. The fact that you can already do it with the language
(as you note about having a separate
On Tuesday, 15 August 2017 at 20:33:18 UTC, Johnson wrote:
On Tuesday, 15 August 2017 at 03:37:39 UTC, rikki cattermole
wrote:
But then that only helps with one specific instance. D is full
of language features, I do not see why everyone is so against
them. Without them, D would be empty,
On Wednesday, 16 August 2017 at 17:14:49 UTC, jmh530 wrote:
On Wednesday, 16 August 2017 at 14:42:51 UTC, Mike Wey wrote:
Wouldn't that just move the problem?
You then get an package that imports gtk.Window and a other
package that imports gdk.Window, and if you want to use both
you still
On Wednesday, 16 August 2017 at 14:42:51 UTC, Mike Wey wrote:
Wouldn't that just move the problem?
You then get an package that imports gtk.Window and a other
package that imports gdk.Window, and if you want to use both
you still need to add a renamed import or a static import in
your own
On 16-08-17 09:58, Gary Willoughby wrote:
On Tuesday, 15 August 2017 at 03:37:39 UTC, rikki cattermole wrote:
On 15/08/2017 2:59 AM, Johnson wrote:
Not only that, but it requires adding more files to the command line.
I currently have 3 import files to separate the gtk from gdk that and
the
On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
This looks really clean for code modularity.
import io = std.stdio : {writeln, write}, ...
What does this add? A line like below would be confusing.
import io = std.stdio : {writeln, write}, writefln;
The following code compiles
On Wednesday, 16 August 2017 at 09:54:41 UTC, aberba wrote:
On Tuesday, 15 August 2017 at 21:12:24 UTC, jmh530 wrote:
On Tuesday, 15 August 2017 at 20:33:18 UTC, Johnson wrote:
Or instead of a new language feature, the gtk-d guys could
have package files ;)
But then that only helps with
On Wednesday, 16 August 2017 at 10:12:01 UTC, Joel Nilsson wrote:
On Tuesday, 15 August 2017 at 21:12:24 UTC, jmh530 wrote:
In the past, I've thought it would be convenient to have
something like
import io = std.stdio : writeln, write;
and allow someone to write
io.write("foo");
On Tuesday, 15 August 2017 at 21:12:24 UTC, jmh530 wrote:
In the past, I've thought it would be convenient to have
something like
import io = std.stdio : writeln, write;
and allow someone to write
io.write("foo");
io.writeln("bar");
This is already in the language:
On Tuesday, 15 August 2017 at 21:12:24 UTC, jmh530 wrote:
On Tuesday, 15 August 2017 at 20:33:18 UTC, Johnson wrote:
Or instead of a new language feature, the gtk-d guys could
have package files ;)
But then that only helps with one specific instance. D is full
of language features, I do
On Tuesday, 15 August 2017 at 03:37:39 UTC, rikki cattermole
wrote:
On 15/08/2017 2:59 AM, Johnson wrote:
Not only that, but it requires adding more files to the
command line.
I currently have 3 import files to separate the gtk from gdk
that and the only reason they exist is to combine them
On Tuesday, 15 August 2017 at 20:33:18 UTC, Johnson wrote:
Or instead of a new language feature, the gtk-d guys could
have package files ;)
But then that only helps with one specific instance. D is full
of language features, I do not see why everyone is so against
them. Without them, D
On Tuesday, 15 August 2017 at 03:37:39 UTC, rikki cattermole
wrote:
On 15/08/2017 2:59 AM, Johnson wrote:
Not only that, but it requires adding more files to the
command line.
I currently have 3 import files to separate the gtk from gdk
that and the only reason they exist is to combine them
On 15/08/2017 2:59 AM, Johnson wrote:
Not only that, but it requires adding more files to the command line.
I currently have 3 import files to separate the gtk from gdk that and
the only reason they exist is to combine them in to one named import ;/
Doesn't seem like much but that's 3 extra
Not only that, but it requires adding more files to the command
line.
I currently have 3 import files to separate the gtk from gdk that
and the only reason they exist is to combine them in to one named
import ;/
Doesn't seem like much but that's 3 extra files that don't really
need to
Why can't we name multiple imports?
import x = a, b, c;
only a is part of x, b and c are not named!
this can cause some major problems(or the lack of a correctly
solution).
For example,
gdk and gtk both have window. Both imports are needed and both
define many public imports that create a
29 matches
Mail list logo