On 05/09/2015 05:52 PM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 14:15:21 UTC, Ali Çehreli wrote:
On 05/09/2015 04:59 AM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 11:49:48 UTC, Timon Gehr wrote:
assert((function int(int
x)=x?x*__traits(parent,{})(x-1):1)(10)==3628800);
The second const isn't needed in D, the first one will carry
through for it too.
const char* in D is equivalent to that C declaration.
const(char)* in D is what const char* in C would be.
On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
On Linux, I'm able to edit a file descriptor after I've created
it to tell it to read/write asynchronously, I cant seem to find
anything similar on windows however.
Asynchronous I/O on Windows is called Overlapped I/O. It is a
bit
On Sat, 09 May 2015 21:32:42 -0400, Mike n...@none.com wrote:
it looks like what you are trying to implement is what `synchronized`
already provides:
http://ddili.org/ders/d.en/concurrency_shared.html#ix_concurrency_shared.synchronized
Mike
Yes, but synchronized uses a mutex. Spin locks
On Saturday, 9 May 2015 at 18:19:16 UTC, Baz wrote:
You need a loop that run until the PID is invalid.
You could also call WaitForSingleObject on the process handle
https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032%28v=vs.85%29.aspx
The HANDLE it expects can be gotten from
On 05/09/2015 04:18 PM, ParticlePeter wrote:
const char *const* someConstPtr;
Disecting:
1) const char : There are these chars that cannot be modified
2) * : There are these pointers to such const chars.
3) const: Those pointers cannot point to anything else
4) * : There are these pointers
On Sat, 09 May 2015 15:38:05 -0400, Mike n...@none.com wrote:
On Saturday, 9 May 2015 at 18:41:59 UTC, bitwise wrote:
Also, I wasn't able to find any thorough documentation on shared, so if
someone has a link, that would be helpful.
Here are a few interesting links:
Iain Buclaw (lead
On Saturday, 9 May 2015 at 18:41:59 UTC, bitwise wrote:
What does 'shared' do to member variables?
Makes them `shared`. :P
It makes sense to me to put it on a global variable, but what
sense does it make putting it on a member of a class?
Globals are not the only way to pass data to other
On Saturday, 9 May 2015 at 19:59:58 UTC, tcak wrote:
Stupidly, shared variables' value cannot be increased/decreased
directly. Compiler says it is deprecated, and tells me to use
core.atomic.atomicop. You will see this as well.
How's that stupid? Sounds like the compiler is doing its job
Hi,
const char *const* someConstPtr;
Error: no identifier for declarator char*
Error: declaration expected, not '*'
How would I translate this properly to d?
Cheers, PP
On Sat, 09 May 2015 15:59:57 -0400, tcak t...@gmail.com wrote:
If a variable/class/struct etc is not shared, for variables and struct,
you find their initial value. For class, you get null.
For first timers (I started using shared keyword more than 2 years ago),
do not forget that: a shared
On Saturday, 9 May 2015 at 20:17:59 UTC, bitwise wrote:
On Sat, 09 May 2015 15:38:05 -0400, Mike n...@none.com wrote:
On Saturday, 9 May 2015 at 18:41:59 UTC, bitwise wrote:
Also, I wasn't able to find any thorough documentation on
shared, so if someone has a link, that would be helpful.
On Saturday, 9 May 2015 at 21:48:05 UTC, Timon Gehr wrote:
Well, it is much slower due to all the allocated closures, owed
to the fact that the implementations of 'fix' on that page are
expected to mirror a particular famous implementation in
untyped lambda calculus.
In case you have a use
On 2015-05-09 05:44, Baz wrote:
On Saturday, 9 May 2015 at 06:21:11 UTC, extrawurst wrote:
On Saturday, 9 May 2015 at 00:16:28 UTC, Etienne wrote:
I'm trying to compile a library that I think used to work with
-m32mscoff flag before I reset my machine configurations.
On Saturday, 9 May 2015 at 11:20:10 UTC, Dennis Ritchie wrote:
Hi,
Can lambda functions or delegates in D to call themselves?
Can I write something like this:
-
import std.stdio;
void main() {
auto fact = function (int x) = x * { if (x) fact(x - 1); };
assert(fact(10) ==
On Saturday, 9 May 2015 at 06:21:11 UTC, extrawurst wrote:
On Saturday, 9 May 2015 at 00:16:28 UTC, Etienne wrote:
I'm trying to compile a library that I think used to work with
-m32mscoff flag before I reset my machine configurations.
https://github.com/etcimon/memutils
Whenever I run `dub
On 05/08/15 23:56, Brian Schott via Digitalmars-d-learn wrote:
On Friday, 8 May 2015 at 12:44:31 UTC, Artur Skawina wrote:
On 05/08/15 03:53, Brian Schott via Digitalmars-d-learn wrote:
The problem occurs when I want to register multiple modules to scan for
functions. The grammar does not
Hi,
Can lambda functions or delegates in D to call themselves?
Can I write something like this:
-
import std.stdio;
void main() {
auto fact = function (int x) = x * { if (x) fact(x - 1); };
assert(fact(10) == 3628800);
}
Dennis Ritchie wrote:
auto fact = function (int x) = x * { if (x) fact(x - 1); };
int fact (int x) { return x * ( x1 ? fact(x - 1): 1); };
-manfred
On 05.05.2015 02:03, Dzugaru wrote:
I have to compile it myself from sources or is it available somewhere?
Was playing with fibers using VisualD + DMD and lack of contract
checking (for example call() on fiber in state TERM) leads to bizarre
crashes :(
The latest (beta) version of Visual D
On 05/09/2015 01:20 PM, Dennis Ritchie wrote:
Hi,
Can lambda functions or delegates in D to call themselves?
Can I write something like this:
-
import std.stdio;
void main() {
auto fact = function (int x) = x * { if (x) fact(x - 1); };
assert(fact(10) == 3628800);
}
On Saturday, 9 May 2015 at 11:49:48 UTC, Timon Gehr wrote:
assert((function int(int
x)=x?x*__traits(parent,{})(x-1):1)(10)==3628800);
Thanks. Yes, it is similar to what I wanted :)
This isn't specifically a D question, but seeing as it's for a D
library I figure it can go here :)
On Windows, I want to be able to spawn a console and then
interact with its stdin/out asynchronously, similar to how
forkpty [1] works on linux.
I'm improving my dexpect library [2] to work
On 10/05/2015 12:13 a.m., wobbles wrote:
This isn't specifically a D question, but seeing as it's for a D library
I figure it can go here :)
On Windows, I want to be able to spawn a console and then interact with
its stdin/out asynchronously, similar to how forkpty [1] works on linux.
I'm
On Saturday, 9 May 2015 at 12:25:32 UTC, wobbles wrote:
On Saturday, 9 May 2015 at 12:16:52 UTC, Rikki Cattermole wrote:
On 10/05/2015 12:13 a.m., wobbles wrote:
This isn't specifically a D question, but seeing as it's for
a D library
I figure it can go here :)
On Windows, I want to be able
On Saturday, 9 May 2015 at 12:16:52 UTC, Rikki Cattermole wrote:
On 10/05/2015 12:13 a.m., wobbles wrote:
This isn't specifically a D question, but seeing as it's for a
D library
I figure it can go here :)
On Windows, I want to be able to spawn a console and then
interact with
its stdin/out
On Saturday, 9 May 2015 at 14:15:21 UTC, Ali Çehreli wrote:
On 05/09/2015 04:59 AM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 11:49:48 UTC, Timon Gehr wrote:
assert((function int(int
x)=x?x*__traits(parent,{})(x-1):1)(10)==3628800);
Thanks. Yes, it is similar to what I wanted :)
On Saturday, 9 May 2015 at 14:47:21 UTC, Russel Winder wrote:
On Sat, 2015-05-09 at 07:15 -0700, Ali Çehreli via
Digitalmars-d-learn wrote:
On 05/09/2015 04:59 AM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 11:49:48 UTC, Timon Gehr wrote:
assert((function int(int
On 05/09/2015 07:47 AM, Russel Winder via Digitalmars-d-learn wrote:
Of course none of the implementation can calculate factorial(24) as
they are using hardware values which are bounded and cannot store
reasonable numbers.
Could use iota. Oh no we can't as BigNums are not integral.
I don't
On Saturday, 9 May 2015 at 12:48:16 UTC, Kagamin wrote:
On Saturday, 9 May 2015 at 12:26:58 UTC, wobbles wrote:
What I mean is, if the cmd.exe hasnt flushed it's output, my
cmdPid.stdout.readln (or whatever) will block until it does. I
dont really want this.
Are you sure cmd is the culprit?
On Friday, 8 May 2015 at 11:25:26 UTC, Per Nordlöw wrote:
Could the scope keyword be used here?
Could the work done in DIP-25 be reused here, Walter?
I had `scope!(const ...)` in my original proposal [1] to handle
exactly this problem. The latest iteration doesn't have it as an
explicit
On Sat, 2015-05-09 at 07:15 -0700, Ali Çehreli via Digitalmars-d-learn wrote:
On 05/09/2015 04:59 AM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 11:49:48 UTC, Timon Gehr wrote:
assert((function int(int
x)=x?x*__traits(parent,{})(x-1):1)(10)==3628800);
Thanks. Yes, it is similar
On Saturday, 9 May 2015 at 12:26:58 UTC, wobbles wrote:
What I mean is, if the cmd.exe hasnt flushed it's output, my
cmdPid.stdout.readln (or whatever) will block until it does. I
dont really want this.
Are you sure cmd is the culprit? It should have sensible
buffering. Also do you want just
On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
On Saturday, 9 May 2015 at 12:48:16 UTC, Kagamin wrote:
On Saturday, 9 May 2015 at 12:26:58 UTC, wobbles wrote:
What I mean is, if the cmd.exe hasnt flushed it's output, my
cmdPid.stdout.readln (or whatever) will block until it does.
I
On 05/09/2015 04:59 AM, Dennis Ritchie wrote:
On Saturday, 9 May 2015 at 11:49:48 UTC, Timon Gehr wrote:
assert((function int(int
x)=x?x*__traits(parent,{})(x-1):1)(10)==3628800);
Thanks. Yes, it is similar to what I wanted :)
Also interesting:
http://rosettacode.org/wiki/Y_combinator#D
On 05/09/2015 10:45 AM, Russel Winder via Digitalmars-d-learn wrote:
On Sat, 2015-05-09 at 09:49 -0700, Ali Çehreli via Digitalmars-d-learn wrote:
[…]
BigInt factorial(size_t n)
{
return bigInts(1).take(n).reduce!((a, b) = a *= b);
}
I wonder if that should be a * b rather than a *=
On Saturday, 9 May 2015 at 13:01:27 UTC, wobbles wrote:
On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
On Saturday, 9 May 2015 at 12:48:16 UTC, Kagamin wrote:
On Saturday, 9 May 2015 at 12:26:58 UTC, wobbles wrote:
What I mean is, if the cmd.exe hasnt flushed it's output, my
On Sat, 2015-05-09 at 09:49 -0700, Ali Çehreli via Digitalmars-d-learn wrote:
[…]
BigInt factorial(size_t n)
{
return bigInts(1).take(n).reduce!((a, b) = a *= b);
}
I wonder if that should be a * b rather than a *= b?
It turns out that 2.067 fixes the integrality of BigInts so:
What does 'shared' do to member variables?
It makes sense to me to put it on a global variable, but what sense does
it make putting it on a member of a class? What happens if you try to
access a member of a class/struct instance from another thread that is not
marked 'shared'?
Also, I
On Saturday, 9 May 2015 at 18:41:59 UTC, bitwise wrote:
Also, I wasn't able to find any thorough documentation on
shared, so if someone has a link, that would be helpful.
Here are a few interesting links:
Iain Buclaw (lead developer for GDC) with his interpretation:
On Saturday, 9 May 2015 at 18:41:59 UTC, bitwise wrote:
What does 'shared' do to member variables?
It makes sense to me to put it on a global variable, but what
sense does it make putting it on a member of a class? What
happens if you try to access a member of a class/struct
instance from
On Saturday, 9 May 2015 at 00:16:28 UTC, Etienne wrote:
I'm trying to compile a library that I think used to work with
-m32mscoff flag before I reset my machine configurations.
https://github.com/etcimon/memutils
Whenever I run `dub test --config=32mscoff` it gives me an
assertion failure,
42 matches
Mail list logo