Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread ketmar via Digitalmars-d-learn
On Fri, 30 Jan 2015 15:26:11 -0500, Steven Schveighoffer wrote:

 D absolutely needs a way to say this is ONLY for implementation, it's
 not part of the API. private fits this bill EXACTLY.

yep. every sane person recognizing D private symbols as hidden. and 
then... BOOM! The Hidden Gems Of D.

signature.asc
Description: PGP signature


Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread Steven Schveighoffer via Digitalmars-d-learn

On 1/30/15 12:49 PM, Jonathan M Davis via Digitalmars-d-learn wrote:

On Friday, January 30, 2015 12:30:35 FG via Digitalmars-d-learn wrote:

On 2015-01-30 at 12:08, Vladimir Panteleev wrote:

On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:

Bug or correct behaviour?


Bug: https://issues.dlang.org/show_bug.cgi?id=1238


https://github.com/D-Programming-Language/dmd/pull/3743

The fix is pretty much a one-liner.
Probably 2.067 will already include it, right?


Last I heard, no one had been able to convince Walter that private symbols
should be hidden. They aren't in C++, but C++ doesn't have access levels for
anything other than classes, so the effect is _very_ different.


Another HUGE difference is that C++ generally splits API from 
implementation. When you import .h files, you don't also import private 
symbols which may be defined or used in the .cpp file.


D absolutely needs a way to say this is ONLY for implementation, it's 
not part of the API. private fits this bill EXACTLY.


Please do it.

-Steve


Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, January 30, 2015 12:30:35 FG via Digitalmars-d-learn wrote:
 On 2015-01-30 at 12:08, Vladimir Panteleev wrote:
  On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:
  Bug or correct behaviour?
 
  Bug: https://issues.dlang.org/show_bug.cgi?id=1238

 https://github.com/D-Programming-Language/dmd/pull/3743

 The fix is pretty much a one-liner.
 Probably 2.067 will already include it, right?

Last I heard, no one had been able to convince Walter that private symbols
should be hidden. They aren't in C++, but C++ doesn't have access levels for
anything other than classes, so the effect is _very_ different. Though maybe
someone convinced Walter that the status quo is stupid, and I didn't see it.
I don't know. Pretty much everyone else thinks that it should be changed, so
it'll probably be changed at some point, but who knows when. The fact that
there's a PR for it will help, but it obviously isn't being dealt with
particularly quickly, so there's really no way to know when it'll be merged
(and it doesn't even fix the whole problem with private symbols - just some
of it). It could be merged tomorrow, or it could be months from now.

- Jonathan M Davis



Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread Suliman via Digitalmars-d-learn

foreach(f; files))
{
if (canFind(to!string(f),  ))
{
writeln(whitespace found:);
writeln(f);
			Thread.sleep( dur!(msecs)( 50 ) );  // sleep for 50 
milliseconds

}
else
continue;
}

Error: module app struct std.regex.Thread(DataIndex) is private
Error: no property 'sleep' for type 'void'

What's wrong? Why sleeping do not work?


Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread FG via Digitalmars-d-learn

On 2015-01-30 at 12:08, Vladimir Panteleev wrote:

On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:

Bug or correct behaviour?


Bug: https://issues.dlang.org/show_bug.cgi?id=1238


https://github.com/D-Programming-Language/dmd/pull/3743

The fix is pretty much a one-liner.
Probably 2.067 will already include it, right?


Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread FG via Digitalmars-d-learn

Error: module app struct std.regex.Thread(DataIndex) is private


Did you import core.thread?


Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread FG via Digitalmars-d-learn

On 2015-01-30 at 11:55, FG wrote:

Error: module app struct std.regex.Thread(DataIndex) is private


Did you import core.thread?


This is silly. Thread is internal to std.regex, yet when importing both 
std.regex and core.thread, you still get an error:

src.d(10): Error: core.thread.Thread at ..\thread.d(514) conflicts with 
std.regex.Thread(Dat
aIndex) at ..\src\phobos\std\regex.d(4588)

The way around is of course the use of a fully qualified name:

core.thread.Thread.sleep( dur!(msecs)( 50 ) );

but there really should be no need for this, since std.regex.Thread is private. 
Bug or correct behaviour?


Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, January 30, 2015 10:39:44 Suliman via Digitalmars-d-learn wrote:
   foreach(f; files))
   {
   if (canFind(to!string(f),  ))
   {
   writeln(whitespace found:);
   writeln(f);
   Thread.sleep( dur!(msecs)( 50 ) );  // sleep for 50
 milliseconds
   }
   else
   continue;
   }

 Error: module app struct std.regex.Thread(DataIndex) is private
 Error: no property 'sleep' for type 'void'

 What's wrong? Why sleeping do not work?

Did you import std.regex but not core.thread? Or did you import std.regex
with a local import and core.thread with a module-level import?

Unfortunately, private symbols are visible and can cause symbol conflicts
(even though they can't actually be used), so sometimes we end up with
conflicts due to private symbols. Being more specific - e.g.
core.Thread.sleep() - should fix the problem. But it's also possible that
you failed to import core.thread in the first place, in which case,
Thread.sleep isn't even visible to your code.

- Jonathan M Davis



Re: Thread.sleep( dur!(msecs)( 50 ) ); // sleep for 50 milliseconds

2015-01-30 Thread Vladimir Panteleev via Digitalmars-d-learn

On Friday, 30 January 2015 at 11:04:47 UTC, FG wrote:

Bug or correct behaviour?


Bug: https://issues.dlang.org/show_bug.cgi?id=1238