On Thursday, 16 July 2015 at 17:22:50 UTC, jklp wrote:
On Thursday, 16 July 2015 at 17:04:09 UTC, Taylor Hillegeist
wrote:
[...]
Your proto is wrong. Your forgot the FFI convention (__cdecl =
extern(C)).
Try this instead:
---
extern(C)
alias Proto = void function(char*, int);
Proto func =
On Thu, 16 Jul 2015 00:18:30 +
seashell86 via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
So I've been mostly just toying around with D as it seems like it
will end up being a strong language for game development both now
and even moreso in the future. That being said,
On 2015-07-15 23:57, badlink wrote:
Hello, I can't figure how to write a template function that accept
either strings or array of strings.
This is my current code:
bool hasItemParent(T)(const(char)[] itemId, const(T)[] parentId)
if (is(typeof(T) == char) || (isArray!T is(typeof(T[]) ==
Hi, do you think it's possible to implemented something like Lua Tables
(a hashed heterogeneous associative array) in D?
I know that Lua is dynamic and interpreted, hence it's a lot simpler to
do than with a compiled language but I'm wondering if we could express
such a generic data-structure
I noticed just making many threads cause an error.
Are there any limit for the number of threads?
import std.concurrency;
import core.thread;
void fun() { Thread.sleep(5000.msecs); }
void testThread() {
foreach(i; 0..2000) {
spawn(fun);
}
}
On Thursday, 16 July 2015 at 07:36:39 UTC, Jonathan M Davis wrote:
Yes. Every thread gets a copy of the non-shared static
variables, and all of the non-shared static constructors get
run for each thread.
- Jonathan M Davis
Thank you for reply. Now i know.
I did some test using C++ as you
On 2015-07-16 09:46, Jonathan M Davis via Digitalmars-d-learn wrote:
I've never heard of a language that overloaded member variables, and given
how class polymorphism works, I don't see how it would even be possible
without making it so that all accesses to a variable actually call a
function
On Thursday, 16 July 2015 at 09:52:59 UTC, ponce wrote:
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André Hübenthal
wrote:
Why?
The syntax for delegate literals with braces is
listenHTTP(settings, (req, res) {
res.writeBody(Hello, World!);
});
Thanks. Those small details you
You can certainly use thread but in most use cases, concurrency or
parallelism will accomplish the same in a much saner/safer way. (they're
wrappers around core.thread anyway).
Don't know of any tutorials about core.thread, about the other two you can
find help here : http://ddili.org/ders/d.en/
On Wednesday, 15 July 2015 at 15:58:17 UTC, Daniel Kozák wrote:
On Wed, 15 Jul 2015 15:45:43 +
rumbu ru...@rumbu.ro wrote:
struct S { int a, b; }
auto s = cast(S)10;
//compiles and sets s.a to 10.
It works also for any other type, if the structure contains a
member of that type in the
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André Hübenthal
wrote:
Why?
The syntax for delegate literals with braces is
listenHTTP(settings, (req, res) {
res.writeBody(Hello, World!);
});
On Thu, 16 Jul 2015 07:57:10 +
aki via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
I can't resolve the compile errors:
import core.thread;
class DerivedThread : Thread {
int count = 0;
this() {
super(run);
}
private void run()
On Thursday, 16 July 2015 at 08:21:26 UTC, maarten van damme
wrote:
Have you checked out std.parallelism and std.concurrency?
I know std.concurrency to use spawn. If I cannot use Thread,
I'll implement by spawn. But want to try Thread class because
it seems similar to Java's Thread class.
I
Hi
After a couple of years using and keeping an eye on D I have
grown into a functional oriented programmer. I began with
JavaScripts semi pseudo functional style, then Clojures dynamic
functional style, Haskells burritos and now Scala.
I have began to dislike Haskell for the academic
On Thursday, July 16, 2015 06:53:50 aki via Digitalmars-d-learn wrote:
I noticed just making many threads cause an error.
Are there any limit for the number of threads?
import std.concurrency;
import core.thread;
void fun() { Thread.sleep(5000.msecs); }
void testThread() {
foreach(i;
On Thursday, July 16, 2015 01:20:10 seashell86 via Digitalmars-d-learn wrote:
On Thursday, 16 July 2015 at 00:39:29 UTC, H. S. Teoh wrote:
On Thu, Jul 16, 2015 at 12:18:30AM +, seashell86 via
Digitalmars-d-learn wrote:
[...]
The reason is that class variables cannot be overridden,
I can't resolve the compile errors:
import core.thread;
class DerivedThread : Thread {
int count = 0;
this() {
super(run);
}
private void run() {
inc(); //testThread.d(8): Error: shared method
testThread.DerivedThread.inc is not callable using a
Have you checked out std.parallelism and std.concurrency?
2015-07-16 9:57 GMT+02:00 aki via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com:
I can't resolve the compile errors:
import core.thread;
class DerivedThread : Thread {
int count = 0;
this() {
On Thursday, 16 July 2015 at 06:48:12 UTC, Robert M. Münch wrote:
Hi, do you think it's possible to implemented something like
Lua Tables (a hashed heterogeneous associative array) in D?
I know that Lua is dynamic and interpreted, hence it's a lot
simpler to do than with a compiled language
On Wednesday, July 15, 2015 16:21:29 aki via Digitalmars-d-learn wrote:
I want to make sure about the semantics of unshared variables.
import std.concurrency;
import core.thread;
ubyte[1024 * 1024] buf1MB;
void fun() { Thread.sleep(5000.msecs); }
void testThread() {
foreach(i; 0..2000) {
On 2015-07-16 07:20:15 +, Fusxfaranto said:
An associative array of Variant[string] ought to do the job well enough.
http://dlang.org/phobos/std_variant.html
Thanks a lot. Somehow didn't see that...
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On Thursday, 16 July 2015 at 09:57:55 UTC, Jarl André Hübenthal
wrote:
On Thursday, 16 July 2015 at 09:52:59 UTC, ponce wrote:
On Thursday, 16 July 2015 at 09:49:03 UTC, Jarl André
Hübenthal wrote:
Why?
The syntax for delegate literals with braces is
listenHTTP(settings, (req, res) {
Beleive it or not the code below does work. However I get an
access violation after every run? any Ideas why?
+Code to Run DLL
function+++
import core.runtime;
import std.stdio;
import core.memory;
import std.c.windows.windows;
int main()
{
On Thursday, 16 July 2015 at 17:04:09 UTC, Taylor Hillegeist
wrote:
void function(ref char[], int) Testf
= cast(void function(ref char[], int))
GetProcAddress(h, Test); //Function Says HELLO WORLD
void __cdecl Test(char MyOutput[], int32_t len);
Those signatures
On Thursday, 16 July 2015 at 17:04:09 UTC, Taylor Hillegeist
wrote:
Beleive it or not the code below does work. However I get an
access violation after every run? any Ideas why?
+Code to Run DLL
function+++
import core.runtime;
import
On Thursday, 16 July 2015 at 07:43:10 UTC, Jonathan M Davis wrote:
[...]
On linux you can alter the limit by using ulimit command. -a
option shows the current limits.
Thank you for all answers.
Removing typeof do resolve the problem when the second parameter
is a simple string.
However when passing an array of string the error still occur:
Error: template cache.MetadataCache.hasItemParent cannot deduce
function from argument types !()(string, string[]).
On Thursday, 16 July 2015 at 20:17:54 UTC, Jarl André Hübenthal
wrote:
return coll.find().map!(doc = deserialize!(BsonSerializer,
Resource)(doc));
Solved by wrapping return statement in array(...)
On Thursday, 16 July 2015 at 17:28:52 UTC, jklp wrote:
Also i guess that the dll returns a null terminated string so
the result has to be
read like this:
---
import std.string;
printf(%s\n, fromStringz(STUFF.ptr));
---
That's not needed with printf, since it works with null
terminated
On Thursday, 16 July 2015 at 19:25:42 UTC, Taylor Hillegeist
wrote:
Also if you have any good resources regarding this topic I
would be interested.
my book goes into it briefly *shameless plug*
https://www.packtpub.com/application-development/d-cookbook
The interfacing with C page on the
I have the following code, working under Win and Linux:
---
import std.process: environment;
immutable string p;
static this() {
version(Win32) p = environment.get(APPDATA);
version(linux) p = /home/ ~ environment.get(USER);
version(OSX) p = ?;
}
---
what would be the OSX
On Wednesday, 15 July 2015 at 21:57:50 UTC, badlink wrote:
Hello, I can't figure how to write a template function that
accept either strings or array of strings.
This is my current code:
bool hasItemParent(T)(const(char)[] itemId, const(T)[] parentId)
if (is(typeof(T) == char) || (isArray!T
Also checkout inout functions:
http://dlang.org/function.html#inout-functions
On Thursday, 16 July 2015 at 17:28:52 UTC, jklp wrote:
On Thursday, 16 July 2015 at 17:22:50 UTC, jklp wrote:
On Thursday, 16 July 2015 at 17:04:09 UTC, Taylor Hillegeist
wrote:
[...]
Your proto is wrong. Your forgot the FFI convention (__cdecl =
extern(C)).
Try this instead:
---
On 07/16/2015 12:35 PM, Jarl =?UTF-8?B?QW5kcsOpIEjDvGJlbnRoYWwi?=
jarl.an...@gmail.com wrote:
Hi
using mongo with vibe.d is easy. But I would like to skip the foreach on
MongoCursor?
I mean, I want to use map!, filter! and reduce! on the resulting docs.
Is there a fast way to convert
After a thorough reading of the documentation I found an even
simpler solution:
bool hasItemParent(T)(const(char)[] itemId, T parentId)
if (is(T : const(char)[]) || is(T : const(char[])[]))
{ ... }
Now it accepts all these: char[], const(char)[],
immutable(char)[], char[][], const(char)[][]
On Thursday, 16 July 2015 at 17:04:09 UTC, Taylor Hillegeist
wrote:
void function(ref char[], int) Testf
= cast(void function(ref char[], int))
GetProcAddress(h, Test); //Function Says HELLO WORLD
char[] STUFF;
STUFF.length = 5000;
Testf( STUFF ,
Hi
using mongo with vibe.d is easy. But I would like to skip the
foreach on MongoCursor?
I mean, I want to use map!, filter! and reduce! on the resulting
docs. Is there a fast way to convert MongoCursor to an array
without resolving to ugly for loops with appender! ?
On Thursday, 16 July 2015 at 20:00:38 UTC, Ali Çehreli wrote:
On 07/16/2015 12:35 PM, Jarl
=?UTF-8?B?QW5kcsOpIEjDvGJlbnRoYWwi?= jarl.an...@gmail.com
wrote:
Hi
using mongo with vibe.d is easy. But I would like to skip the
foreach on
MongoCursor?
I mean, I want to use map!, filter! and
On Thursday, 16 July 2015 at 20:17:54 UTC, Jarl André Hübenthal
wrote:
On Thursday, 16 July 2015 at 20:00:38 UTC, Ali Çehreli wrote:
On 07/16/2015 12:35 PM, Jarl
=?UTF-8?B?QW5kcsOpIEjDvGJlbnRoYWwi?= jarl.an...@gmail.com
wrote:
Hi
using mongo with vibe.d is easy. But I would like to skip the
On Thursday, 16 July 2015 at 06:48:12 UTC, Robert M. Münch wrote:
Hi, do you think it's possible to implemented something like
Lua Tables (a hashed heterogeneous associative array) in D?
I know that Lua is dynamic and interpreted, hence it's a lot
simpler to do than with a compiled language
On Thursday, 16 July 2015 at 18:41:47 UTC, Gary Willoughby wrote:
bool hasItemParent(A, B)(A itemId, B parentId)
if (isSomeString!(A) (isSomeString!(B) || isArray!(B)
isSomeString!(ElementType!(B
Thank you ! I completely missed isSomeString.
I think the definition can be safely
On Thursday, 16 July 2015 at 20:00:38 UTC, Ali Çehreli wrote:
On 07/16/2015 12:35 PM, Jarl
=?UTF-8?B?QW5kcsOpIEjDvGJlbnRoYWwi?= jarl.an...@gmail.com
wrote:
Hi
using mongo with vibe.d is easy. But I would like to skip the
foreach on
MongoCursor?
I mean, I want to use map!, filter! and
On Thursday, 16 July 2015 at 21:12:05 UTC, anonymous wrote:
I have the following code, working under Win and Linux:
---
import std.process: environment;
immutable string p;
static this() {
version(Win32) p = environment.get(APPDATA);
version(linux) p = /home/ ~ environment.get(USER);
On Thursday, 16 July 2015 at 21:48:06 UTC, byron wrote:
On Thursday, 16 July 2015 at 07:57:13 UTC, aki wrote:
[...]
If I remember a synchronized method requires this to be
shared, you should be fine using a synchronized block in the
method for non-shared instances. But using atomicOp
On Thursday, 16 July 2015 at 21:12:05 UTC, anonymous wrote:
I have the following code, working under Win and Linux:
---
import std.process: environment;
immutable string p;
static this() {
version(Win32) p = environment.get(APPDATA);
version(linux) p = /home/ ~ environment.get(USER);
On Thursday, 16 July 2015 at 07:57:13 UTC, aki wrote:
I can't resolve the compile errors:
import core.thread;
class DerivedThread : Thread {
int count = 0;
this() {
super(run);
}
private void run() {
inc(); //testThread.d(8): Error: shared
47 matches
Mail list logo