[Issue 16663] New: [REG 2.072] std.unit.toUpper rejects an alias this to a string

2016-11-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16663

  Issue ID: 16663
   Summary: [REG 2.072] std.unit.toUpper rejects an alias this to
a string
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

struct String
{
string data;
alias data this;
}

void main()
{
import std.uni : toUpper;
auto u = toUpper(String("a"));
}

works with DMD 2.071.2
with DMD 2.072 we get an error.

--


Re: If Statement with Declaration

2016-11-06 Thread Enamex via Digitalmars-d
On Sunday, 6 November 2016 at 05:07:10 UTC, Andrei Alexandrescu 
wrote:


The declaration with "if" seems to be a recent fashion. I've 
first seen it in Go and now C++17 took a shine to it - 
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r0.html. A DIP would do good to cite that related work.


It seems a low impact feature. Also, the Go/C++ syntaxes seem 
suboptimal to me because they are stuttering:


if variable := fun(); variable != 42 {
  ...
}

or (C++):

if (auto variable = fun(); variable != 42) {
  ...
}

Why does the word "variable" need to appear twice? It seems 
simpler to allow punctuation around existing syntax:


// possible future D
if ((auto variable = fun()) != 42) {
  ...
}

Defining a variable in an expression wouldn't be allowed 
everywhere (but might be contemplated later as an possibility, 
which is a nice thing about this syntax).


Andrei


I remember an old suggestion/DIP allowing 'with' statements to 
introduce/declare symbols/variables.


Might be a cleaner extension to existing language:

with(auto x = f()) if(foo(x)) {}
else with(auto r = root(t)) if(leaf(r) || blah < bar) {}


[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen

2016-11-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16651

ag0ae...@gmail.com changed:

   What|Removed |Added

   Keywords||pull
   Assignee|nob...@puremagic.com|ag0ae...@gmail.com

--- Comment #3 from ag0ae...@gmail.com ---
https://github.com/dlang/druntime/pull/1690

--


Re: Sockets and using them...

2016-11-06 Thread Era Scarecrow via Digitalmars-d-learn

On Sunday, 6 November 2016 at 09:51:41 UTC, sarn wrote:
It sounds like you want to do the same thing: design a protocol 
that includes some kind of message that's agreed to mean, "Yo, 
make a new connection on this port."  Basically, any 
off-the-shelf textbook on network protocol design will help you.




Quirks of different NAT implementations cause huge pain to 
everyone who tries to deploy a peer-to-peer system.


 Yeah, I was hoping it would be 'redirect to this port instead' 
so you wouldn't have to make a new connection. With port 
forwarding and other issues involved, I can see a big problem. 
Once you are using a port I'm pretty sure it will be locked 
(although if multiple can share the same port, I'd be fine with 
that too, as long as I know what IP address it came from).


 I suppose I can simply write it and try to get it working...


Re: Bug after update to 2.072?

2016-11-06 Thread Alex via Digitalmars-d-learn

On Sunday, 6 November 2016 at 08:48:14 UTC, SimonN wrote:
I'm not sure how to pass arbitrary dustmite arguments through 
dub to dustmite. `dub dustmite -h' lists arguments.


When dustmite reduces your project to the empty project, maybe 
try this from the dustmite website: "You can also surround code 
that is not to be removed around the magic words 
DustMiteNoRemoveStart and DustMiteNoRemoveStop. Note that if 
you place them in comments, you won't be able to use 
--strip-comments."


Ok, cool. But as I'm of the opinion, that my code is not buggy,  
I don't know, which code to keep.




On Sunday, 6 November 2016 at 06:28:32 UTC, Alex wrote:
object.Exception@DustMite/dustmite.d(270): Initial test fails 
(try using --no-redirect for details)


This means that dustmite doesn't recognize the unreduced source 
as buggy. As a sanity test, dustmite runs the given test on the 
unreduced project, and requires this test to succeed.


I'm not the alone with the opinion of my code. LDC compiles my 
code and the binary runs without any problem.


Furthermore: If I take the file .../dlang/dmd/core/atomic.d from 
the sources of version 2.071.2 and replace with this version the 
file from the current version of 2.072.0;
then recompile my project by dmd and run it - it works. When 
using the new version, binary stops working after recompilation

This behavior is reproducible.

So my question is: how can I debug atomic.d better to locate the 
error more precisely.
Do not get me wrong, I still assume, that I have to change my own 
code. But the only entry point for debugging I can see at the 
moment is the file atomic.d.


Re: Sockets and using them...

2016-11-06 Thread sarn via Digitalmars-d-learn

On Sunday, 6 November 2016 at 06:02:48 UTC, Era Scarecrow wrote:
 So I've got a project where I want to create basically a 
decentralized chat program where every program is a host and a 
client. When you connect all connections can go through to 
route the chat to everyone else.


 So to make this work I've looked over the sockets package and 
I don't quite follow how you'd make it so it works a lot like a 
web browser, aka when you get a connection you redirect to a 
different port so you have 1 listening port for new connections 
so it can act as a server. What settings or configuration would 
I need to be able to do that?


Web browsers do redirects at the application level.  It's in 
HTTP, which is a protocol built on top of the layer sockets 
provide.


It sounds like you want to do the same thing: design a protocol 
that includes some kind of message that's agreed to mean, "Yo, 
make a new connection on this port."  Basically, any 
off-the-shelf textbook on network protocol design will help you.


One thing I can tell you now, though, is that NATs will be your 
big problem if you try to deploy your system for real.  Most 
machines still use IPv4 and don't have publicly accessible IP 
addresses, so they use network address translation to access the 
internet.  Quirks of different NAT implementations cause huge 
pain to everyone who tries to deploy a peer-to-peer system.


But don't let me put you off :)


Re: Bug after update to 2.072?

2016-11-06 Thread SimonN via Digitalmars-d-learn
I'm not sure how to pass arbitrary dustmite arguments through dub 
to dustmite. `dub dustmite -h' lists arguments.


When dustmite reduces your project to the empty project, maybe 
try this from the dustmite website: "You can also surround code 
that is not to be removed around the magic words 
DustMiteNoRemoveStart and DustMiteNoRemoveStop. Note that if you 
place them in comments, you won't be able to use 
--strip-comments."


On Sunday, 6 November 2016 at 06:28:32 UTC, Alex wrote:
object.Exception@DustMite/dustmite.d(270): Initial test fails 
(try using --no-redirect for details)


This means that dustmite doesn't recognize the unreduced source 
as buggy. As a sanity test, dustmite runs the given test on the 
unreduced project, and requires this test to succeed.


-- Simon


Re: https://issues.dlang.org/show_bug.cgi?id=2504: reserve for associative arrays

2016-11-06 Thread safety0ff via Digitalmars-d

On Sunday, 6 November 2016 at 03:28:20 UTC, Jon Degenhardt wrote:
On Sunday, 6 November 2016 at 02:12:12 UTC, Alexandru 
Caciulescu wrote:


I see this topic started a clash of opinions regarding the 
future of AAs. After Andrei suggested a free-list 
implementation I had a good idea of how to proceed but now I 
am not so sure since this discussion isn't converging to a 
single idea/implementation.



[Snip]

I think this suggestion is consistent with Steve 
Schveighoffer's suggestion earlier in the thread.


--Jon


I agree with what Jon Degenhardt said. It also seems to be in 
agreement with what Shachar Shemesh and Steven Schveighoffer 
wrote regarding the implementation of a reserve function for the 
built in AAs.


Re: Release D 2.072.0

2016-11-06 Thread Daniel Kozak via Digitalmars-d-announce

Dne 6.11.2016 v 07:58 Sönke Ludwig via Digitalmars-d-announce napsal(a):


Am 03.11.2016 um 14:18 schrieb Andre Pany:

On Thursday, 3 November 2016 at 12:17:29 UTC, Sönke Ludwig wrote:

Am 03.11.2016 um 06:58 schrieb Andre Pany:

Temp-folder builds are only done if the special shebang invocation
syntax is used (i.e. "dub file.d 

Unfortunately yes, the behavior of dub included in dmd 2.072 is not as
expected (windows & linux).

/+ dub.sdl:
name "app"
+/
void main(){}

dub --single app.d

Running
..\..\..\..\..\Users\abcdef\AppData\Local\Temp\.dub\build\app-~master\application-debug-windows-x86-dmd_2072-A4FA96FDE8C9353FB025486E4835F2E0\app.exe 





Same behavior for dub build --single app.d

Kind regards
André


I checked now and the version included in the (Windows) DMD bundle 
indeed reports as 1.0.0, so the fix is not present. But the next DMD 
point release will include 1.1.1, which includes all changes to date. 
I'll also put binaries of 1.1.0 on code.dlang.org in a few minutes.


Is there a place when one can check this? I mean in which repository 
this is placed?




[Issue 15576] extern(C++, namespace) wrong mangling of variables (Windows)

2016-11-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15576

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

   What|Removed |Added

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

--


[Issue 15576] extern(C++, namespace) wrong mangling of variables (Windows)

2016-11-06 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15576

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

https://github.com/dlang/dmd/commit/b725551c35874fdce085a1475f6bd0db398e0f64
Fix issue 15576 - Skip over the parent expression when parent is NSpace.

https://github.com/dlang/dmd/commit/dcb58fc97636d9fbe1ee3405be1152c966f456dd
Merge pull request #6232 from LemonBoy/cppmangle

Fix issue 15576 - Skip over the parent expression when parent is NSpace.

--


Re: Release D 2.072.0

2016-11-06 Thread Sönke Ludwig via Digitalmars-d-announce

Am 03.11.2016 um 14:18 schrieb Andre Pany:

On Thursday, 3 November 2016 at 12:17:29 UTC, Sönke Ludwig wrote:

Am 03.11.2016 um 06:58 schrieb Andre Pany:

Temp-folder builds are only done if the special shebang invocation
syntax is used (i.e. "dub file.d 

Unfortunately yes, the behavior of dub included in dmd 2.072 is not as
expected (windows & linux).

/+ dub.sdl:
name "app"
+/
void main(){}

dub --single app.d

Running
..\..\..\..\..\Users\abcdef\AppData\Local\Temp\.dub\build\app-~master\application-debug-windows-x86-dmd_2072-A4FA96FDE8C9353FB025486E4835F2E0\app.exe



Same behavior for dub build --single app.d

Kind regards
André


I checked now and the version included in the (Windows) DMD bundle 
indeed reports as 1.0.0, so the fix is not present. But the next DMD 
point release will include 1.1.1, which includes all changes to date. 
I'll also put binaries of 1.1.0 on code.dlang.org in a few minutes.


Re: Bug after update to 2.072?

2016-11-06 Thread Alex via Digitalmars-d-learn
On Sunday, 6 November 2016 at 01:13:51 UTC, Vladimir Panteleev 
wrote:

Try --program-status=139

(139 is 128 + 11)


tried
dub dustmite ../dm3 --program-status=139
which yields in
object.Exception@DustMite/dustmite.d(270): Initial test fails 
(try using --no-redirect for details)


4   dustmite0x0001086fc3e8 _Dmain 
+ 3480
5   dustmite0x00010878c1df 
D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 39
6   dustmite0x00010878c10b void 
rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) + 35
7   dustmite0x00010878c184 void 
rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).runAll() + 44
8   dustmite0x00010878c10b void 
rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) + 35
9   dustmite0x00010878c071 
_d_run_main + 497
10  dustmite0x0001086fccdf main + 
15
11  libdyld.dylib   0x7fffb4a1d254 start 
+ 0

12  ??? 0x0002 0x0 + 2


Sockets and using them...

2016-11-06 Thread Era Scarecrow via Digitalmars-d-learn
 So I've got a project where I want to create basically a 
decentralized chat program where every program is a host and a 
client. When you connect all connections can go through to route 
the chat to everyone else.


 So to make this work I've looked over the sockets package and I 
don't quite follow how you'd make it so it works a lot like a web 
browser, aka when you get a connection you redirect to a 
different port so you have 1 listening port for new connections 
so it can act as a server. What settings or configuration would I 
need to be able to do that?