[Issue 9253] Review Phobos algorithms and make them transient-safe where possible

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9253

hst...@quickfur.ath.cx changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|WONTFIX |---

--- Comment #5 from hst...@quickfur.ath.cx ---
There must be some misunderstanding here.  What has annotations got to do with
transient ranges?

Transient ranges, as referred to in this bug, are ranges where .front may
mutate once .popFront is called, thereby making it invalid for code to cache
.front by assigning to a local variable and referring to the variable later
after .popFront is called.  AFAIK there are no annotations that can be used for
this.

Many algorithms that currently break with transient ranges actually *can* be
re-implemented in a way that doesn't break, and without undue overhead. 
Tracking these algorithms is the purpose of this issue.

--


[Issue 15425] std.traits.hasIndirections fails to recognize nested structs

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15425

--- Comment #2 from Marc Schütz  ---
(In reply to RazvanN from comment #1)
> Maybe I am getting this wrong, but both S1 and S2 are free of indirections
> for as far as I can tell. Even if the sizeof includes the context pointer,
> it is not a user defined part of the struct.
> 
> hasIndirections does the following for structs:
> 
> static if (is(T == struct) || is(T == union))
> enum hasIndirections = anySatisfy!(.hasIndirections, FieldTypeTuple!T);
> 
> As you can see, all the field types are tested (the context pointer is not
> an actual field of the struct), so in my opinion the output of your program
> is correct.

hasIndirections is used (among other things) to check whether a memory
allocation needs to be registered with the GC (e.g. in RefCounted), or whether
an object can be safely sent to another thread (e.g. hasUnsharedAliasing). For
these purposes, it is crucial that it checks _all_ indirections, not just the
explicitly declared ones.

In std.traits, there is a whole bunch of helper traits like hasRawAliasing,
hasRawUnsharedAliasing, hasAliasing with partially overlapping functionality. I
don't know what each one is supposed to be used for; maybe hasIndirections
actually does what it should. But if so, then it's clearly used wrongly in
other places (e.g. RefCounted).

--


[Issue 12625] [scope] [DIP1000] implicit slicing of RValue static array should be illegal

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12625

--- Comment #20 from Steven Schveighoffer  ---
For those not following the PR in Phobos discussion, an interesting alternative
idea has been floated by ZombineDev:

char[16] get();

string s = get();

// can be lowered to:
auto _tmp = get();
scope string s = _tmp[];

Which should work and keep existing code intact. Requires dip1000 I believe.

--


[Issue 17797] New: [REG 2.073.2] double print to stdout when reading stdin in another thread

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17797

  Issue ID: 17797
   Summary: [REG 2.073.2] double print to stdout when reading
stdin in another thread
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ga...@mail.ru

Consider the following program:

-
import std.stdio, core.thread;

void main(){
auto thread = new Thread().start;
writeln("Output");
writeln("Output2");
writeln("Output3");
while(true){}
}

void func(){
foreach(line; stdin.byLineCopy){}
}
-

The correct output is:
-
Output
Output2
Output3
-

This starts a thread to read from stdin, and then writes several lines to
stdout in the main thread and enters and infinite loop.

When compiled with dmd 2.073.1 or earlier, everything is fine.
Starting from dmd 2.073.2, the output is unstable but usually not correct.
Locally, I usually observe the following output:

-
Output
Output2
Output3
Output2
-

Or sometimes:

-
Output
Output2
Output2
Output3
-

Here are the steps to reproduce, tested on 64-bit Windows with a 32-bit
compiler.

1. Use dmd 2.073.2 or later.
2. Compile like "dmd program.d" (compiler switches don't seem to matter).
3. Run a command prompt, like "cmd.exe".
4. Execute "program.exe" (importantly, without any I/O redirection).

Original thread at D.Learn:
https://forum.dlang.org/post/ozbhjgvqmurphkeos...@forum.dlang.org

--


[Issue 17790] [scope] Escaping pointer possible through array of aggregates

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17790

--- Comment #2 from github-bugzi...@puremagic.com ---
Commit pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/66d203585f3f12dc4e3b56dc1178bebbedc1f1ba
fix Issue 17790 - [scope] Escaping pointer possible through array of aggregates

--


[Issue 17790] [scope] Escaping pointer possible through array of aggregates

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17790

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 15425] std.traits.hasIndirections fails to recognize nested structs

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15425

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
Maybe I am getting this wrong, but both S1 and S2 are free of indirections for
as far as I can tell. Even if the sizeof includes the context pointer, it is
not a user defined part of the struct.

hasIndirections does the following for structs:

static if (is(T == struct) || is(T == union))
enum hasIndirections = anySatisfy!(.hasIndirections, FieldTypeTuple!T);

As you can see, all the field types are tested (the context pointer is not an
actual field of the struct), so in my opinion the output of your program is
correct.

--


[Issue 10762] std.range.iota should support any type that has ordered comparisons, incrementing, and addition

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10762

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |FIXED

--


[Issue 11422] std.array.assocArray with const tuple values

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11422

--- Comment #2 from RazvanN  ---
(In reply to RazvanN from comment #1)
> On git HEAD I get "Error: static assert  "assocArray: value type must be
> mutable"", so this seems to have been fixed. Closing.

I meant for both calls of assocArray.

--


[Issue 10930] std.array.replace cannot simple replace an element in array

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10930

ZombineDev  changed:

   What|Removed |Added

 CC||petar.p.ki...@gmail.com

--- Comment #5 from ZombineDev  ---
The main issue with `replaceInPlace(arr, 1, 2, [2])` is that:
1. The simple usage requires a dynamic allocation for the `[2]` array. The user
could use a separate static array and pass a slice to it, or use `only(2)`, but
it's not convenient for such simple use case
2. A `replaceInPlace` overload takes a single element, instead of a range can
be made much faster by using specialized SIMD instructions, which is worth
considering

--


[Issue 17666] std.c.linux.socket has no replacement

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17666

--- Comment #8 from Sebastiaan Koppe  ---
Finally had some time to take a look. Pretty awesome. Thanks.

But why in core.sys.linux.netinet.in_ is some stuff behind static
if(__USE_MISC)? As far as I can tell that conditional evaluates to false, and
there is a structure in there - ip_mreq - that I need.

Also, the static if(__USE_MISC) at
https://github.com/dlang/druntime/blob/master/src/core/sys/linux/netinet/in_.d#L168
is already inside a static if (__USE_MISC) conditional block.

--


[Issue 10930] std.array.replace cannot simple replace an element in array

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10930

--- Comment #4 from RazvanN  ---
This should do the trick:

auto arr = [ 1, 1, 1 ];
replaceInPlace(arr, 1, 2, [2]);

writeln(arr);

I suggest we close this.

Sorry for the above comment. It was a copy-paste mistake.

--


[Issue 10930] std.array.replace cannot simple replace an element in array

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10930

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #3 from RazvanN  ---
This should do the trick:

auto arr = [ 1, 1, 1 ];
arr = replace(arr, 1, 2);

writeln(arr);

I suggest we close this.

--


[Issue 11422] std.array.assocArray with const tuple values

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11422

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |FIXED

--- Comment #1 from RazvanN  ---
On git HEAD I get "Error: static assert  "assocArray: value type must be
mutable"", so this seems to have been fixed. Closing.

--


[Issue 17194] [scope] Fwd reference error with nested struct

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17194

--- Comment #4 from radu.raca...@gmail.com ---
I think the original description is different than Elie's example.

For one, the argument is sent by ref - the issue I was describing is related to
the interaction of 'scope' and 'ref'.

I expected that 'scope ref V' be the same as 'scope V*'

--


[Issue 12625] [scope] [DIP1000] implicit slicing of RValue static array should be illegal

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12625

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #19 from Walter Bright  ---
https://github.com/dlang/dmd/pull/7110

--


[Issue 17194] [scope] Fwd reference error with nested struct

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17194

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #3 from Walter Bright  ---
This is a bit of a hopeless circular tangle. 'scope' is ignored if the type has
no pointers. So S is checked for pointers. S.a is of type S2, which then must
be checked for pointers. Checking S2 for pointers means evaluating each member
to see if it is a field, which gets us back to looking at the 'scope'.

Not sure if this is reasonably fixable.

--


[Issue 17796] New: ldc's -oq (write full module path for objects) breaks linking

2017-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17796

  Issue ID: 17796
   Summary: ldc's -oq (write full module path for objects) breaks
linking
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: blocker
  Priority: P1
 Component: visuald
  Assignee: nob...@puremagic.com
  Reporter: iamthewilsona...@hotmail.com

ldc's `-oq` flag to enable writing the fully qualified module name as the name
for the .obj confuses visuald.

It tells the linker to look for
`\build\path\mod.obj` instead of 
`\build\path\fully.qualified.name.mod.obj`.

for a module with declaration `module fully.qualified.name.mod;`.

This prevents any projects that require `-oq` (due to their module layout) from
linking with visual studio / visuald. One can still use dub (which just calls
the compiler directly, it knows what its doing) manually on the command line to
successfully build and link.

--