Re: type conversions

2012-04-30 Thread Ary Manzana
On 4/30/12 8:08 AM, Jonathan M Davis wrote: On Monday, April 30, 2012 01:42:38 WhatMeWorry wrote: I'm trying to get my head around D's type conversion. What is the best way to convert a string to a char array? Or I should say is this the best way? string s = "Hello There"; char[] c; c = string

Re: struct to/from void, object to/from void

2012-04-30 Thread Mike Wey
On 04/30/2012 03:01 AM, Era Scarecrow wrote: On Monday, 30 April 2012 at 00:28:15 UTC, Jason King wrote: myobject.sizeof returns 4 (in 32 bit DMD) for every object I've tested, so I'm inclined to suspect its a bog-standard pointer, just what I'm looking to save and retrieve. Anybody else want to

Compute in one pass 3 tokens position

2012-04-30 Thread bioinfornatics
Hi, I would like to know how compute in on pass 3 tokens position in a sequence. curently i do: File f = File( "reader.d", "r" ); scope(exit) f.close(); char[1024] buffer; char[] content = f.rawRead(buffer); char[sizediff_t] token = ['(', '{', ';']; auto position = map!( a => content.countUntil( a

Re: Passing array as const slows down code?

2012-04-30 Thread Steven Schveighoffer
On Fri, 27 Apr 2012 20:03:48 -0400, Joseph Rushton Wakeling wrote: On 28/04/12 00:29, Era Scarecrow wrote: Last try adding ref after const; At the off chance it's shallow copying, this should remove that. Ahhh, that works. Thank you! Back story: originally the reputation() function jus

Re: mysql binding/wrapper?

2012-04-30 Thread Steven Schveighoffer
On Sat, 28 Apr 2012 13:42:41 -0400, Adam D. Ruppe wrote: On Saturday, 28 April 2012 at 16:19:37 UTC, simendsjo wrote: Would you mind if the module was added to vibe, and thus relicensed to MIT? No idea if the vibe folks would actually want that though :) My stuff is all free to take as fa

Re: mysql binding/wrapper?

2012-04-30 Thread simendsjo
On Mon, 30 Apr 2012 16:08:34 +0200, Steven Schveighoffer wrote: On Sat, 28 Apr 2012 13:42:41 -0400, Adam D. Ruppe wrote: On Saturday, 28 April 2012 at 16:19:37 UTC, simendsjo wrote: Would you mind if the module was added to vibe, and thus relicensed to MIT? No idea if the vibe folks wo

is there a difference between those two notations

2012-04-30 Thread Christian Köstlin
reduce!((int a, int b){return a+b;})(iota(100)) reduce!("a+b")(iota(100)) thanks in advance christian koestlin

Re: mysql binding/wrapper?

2012-04-30 Thread James Oliphant
On Mon, 30 Apr 2012 16:18:16 +0200, simendsjo wrote: > On Mon, 30 Apr 2012 16:08:34 +0200, Steven Schveighoffer > wrote: > >> On Sat, 28 Apr 2012 13:42:41 -0400, Adam D. Ruppe >> wrote: >> >>> On Saturday, 28 April 2012 at 16:19:37 UTC, simendsjo wrote: Would you mind if the module was add

Re: is there a difference between those two notations

2012-04-30 Thread Jesse Phillips
On Monday, 30 April 2012 at 15:19:02 UTC, Christian Köstlin wrote: reduce!((int a, int b){return a+b;})(iota(100)) reduce!("a+b")(iota(100)) thanks in advance christian koestlin The answer to your question should be no. The second is transformed into a delegate like the first during compilat

Re: mysql binding/wrapper?

2012-04-30 Thread simendsjo
On Mon, 30 Apr 2012 18:19:29 +0200, James Oliphant wrote: Actually, it looks like the vibe folks are using my fork of Steve Teales mysqln. I had hoped to contact Steve first, so that these changes existed in one place. https://github.com/JollieRoger All of the changes exist in individual bran

Re: type conversions

2012-04-30 Thread Jonathan M Davis
> Can the documentation of std.conv be fixed? > > http://dlang.org/phobos/std_conv.html#to > > I mean, all the toImpl methods are documented, but in "to" it clearly > says "Client code normally calls to!TargetType(value) (and not some > variant of toImpl." I think all the documentation should be

Re: is there a difference between those two notations

2012-04-30 Thread Jonathan M Davis
On Monday, April 30, 2012 17:19:00 Christian Köstlin wrote: > reduce!((int a, int b){return a+b;})(iota(100)) > reduce!("a+b")(iota(100)) > > thanks in advance The first one directly creates a lambda, whereas the second one uses a string mixin with std.function.binaryFunc to create a lambda. The

DWT: synchronized toHash nothrow

2012-04-30 Thread Jesse Phillips
So I've been wanting to switch to DTW from DFL, but that isn't too relevant. I though I could start with a update of the library for 2.059. This has ended up going into areas of synchronous and nothrow that I'm not as familiar. I have hit public hash_t toHash(){ synchronized(this){ retu

Re: DWT: synchronized toHash nothrow

2012-04-30 Thread Alex Rønne Petersen
On 30-04-2012 20:18, Jesse Phillips wrote: So I've been wanting to switch to DTW from DFL, but that isn't too relevant. I though I could start with a update of the library for 2.059. This has ended up going into areas of synchronous and nothrow that I'm not as familiar. I have hit public hash_t

Help: running a method from the importing file's method "space"

2012-04-30 Thread Rowan
Hi all, Two things first: 1) I am quite new to D and have been using Java at school and a bit of C++ at home so some things confuse me. Please bear with me. 2) Apologies about the ambiguity of the title, I have no idea how to ask this in just one line so I'll elaborate here: What I want to do

Re: Help: running a method from the importing file's method "space"

2012-04-30 Thread Era Scarecrow
On Monday, 30 April 2012 at 18:30:29 UTC, Rowan wrote: -- File: MyLib.d: -- module MyLib; import core.runtime; import core.sys.windows.windows; //import std.string; So if I want to make any file (in this case "test.d", which can just import MyLib after I have -lib'd

Re: mysql binding/wrapper?

2012-04-30 Thread James Oliphant
On Mon, 30 Apr 2012 18:57:57 +0200, simendsjo wrote: > Yes, your patches has been merged. Of course it would be best to have > everything database complete already, but I'm glad it's been merged > as-is for now - it might take a long time (and has already) before a > generic database interface is

Re: Help: running a method from the importing file's method "space"

2012-04-30 Thread Era Scarecrow
On Monday, 30 April 2012 at 18:50:24 UTC, Era Scarecrow wrote: Add 'import test;' to your MyLib module. Although that seems like it's connecting a library to something it shouldn't... In which case perhaps a delegate passed to the library to call myProg? Doesn't seem right either. What i

Re: mysql binding/wrapper?

2012-04-30 Thread Ary Manzana
On 4/30/12 11:57 PM, simendsjo wrote: On 4/29/12 11:48 PM, dnewbie wrote: On Saturday, 28 April 2012 at 15:30:13 UTC, simendsjo wrote: stuff/blob/master/mysql.d http://my.opera.com/run3/blog/2012/03/13/d-mysql I use it in a bank account application. It works. On Mon, 30 Apr 2012 18:19:29 +0

Re: is there a difference between those two notations

2012-04-30 Thread Christian Köstlin
On 04/30/2012 07:04 PM, Jonathan M Davis wrote: On Monday, April 30, 2012 17:19:00 Christian Köstlin wrote: reduce!((int a, int b){return a+b;})(iota(100)) reduce!("a+b")(iota(100)) thanks in advance The first one directly creates a lambda, whereas the second one uses a string mixin with std.

Re: Help: running a method from the importing file's method "space"

2012-04-30 Thread Rowan
Add 'import test;' to your MyLib module. That does work, but I didn't want to change the source of MyLib, I dunno maybe what I'm asking isn't possible.

Re: mysql binding/wrapper?

2012-04-30 Thread simendsjo
On Mon, 30 Apr 2012 20:53:02 +0200, James Oliphant wrote: On Mon, 30 Apr 2012 18:57:57 +0200, simendsjo wrote: Yes, your patches has been merged. Of course it would be best to have everything database complete already, but I'm glad it's been merged as-is for now - it might take a long time

Re: Help: running a method from the importing file's method "space"

2012-04-30 Thread Era Scarecrow
On Monday, 30 April 2012 at 19:22:35 UTC, Rowan wrote: Add 'import test;' to your MyLib module. That does work, but I didn't want to change the source of MyLib, I dunno maybe what I'm asking isn't possible. Is there a reason the library needs to call outside of it's own library access? Whe

Re: mysql binding/wrapper?

2012-04-30 Thread simendsjo
On Mon, 30 Apr 2012 20:55:45 +0200, Ary Manzana wrote: Looking at the code of mysql.d I see a big switch with many cases like "case 0x01: // TINYINT". But then there's the SQLType enum with those constants. Why the enum values are not used in the cases? (and also in other parts of the co

Re: Help: running a method from the importing file's method "space"

2012-04-30 Thread Rowan
On Monday, 30 April 2012 at 18:54:41 UTC, Era Scarecrow wrote: On Monday, 30 April 2012 at 18:50:24 UTC, Era Scarecrow wrote: Add 'import test;' to your MyLib module. Although that seems like it's connecting a library to something it shouldn't... In which case perhaps a delegate passed to t

Re: Help: running a method from the importing file's method "space"

2012-04-30 Thread Rowan
With MyLib obviously containing the MyLibInit(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR CmdLine, int CmdShow) method.

Re: is there a difference between those two notations

2012-04-30 Thread bearophile
Christian Köstlin: reduce!((int a, int b){return a+b;})(iota(100)) reduce!("a+b")(iota(100)) Today the syntaxes I prefer are: iota(100).reduce!q{a + b}() iota(100).reduce!((a, b) => a + b)() But hopefully in some we'll have an efficient sum() function too in Phobos: iota(100).sum() Bye,

Re: Derelict2 openGL3 issues

2012-04-30 Thread Stephen Jones
On Tuesday, 24 April 2012 at 08:45:44 UTC, Denis Shelomovskij wrote: One day I'll finish my OpenGL wrapper for D. It will give you better abilities in creating OpenGL 3 contexts than most C++ frameworks (SDL, GLFW etc.) and, I hope, will get rid of passing pointers to functions. It will be do

Re: is there a difference between those two notations

2012-04-30 Thread Timon Gehr
On 04/30/2012 05:19 PM, Christian Köstlin wrote: reduce!((int a, int b){return a+b;})(iota(100)) reduce!("a+b")(iota(100)) thanks in advance christian koestlin In this case there is not. But if external symbols are to be referred to inside the lambda, then the second notation cannot be used.

Frustration [Was: mysql binding/wrapper?]

2012-04-30 Thread Ary Manzana
On 5/1/12 2:44 AM, simendsjo wrote: On Mon, 30 Apr 2012 20:55:45 +0200, Ary Manzana wrote: Looking at the code of mysql.d I see a big switch with many cases like "case 0x01: // TINYINT". But then there's the SQLType enum with those constants. Why the enum values are not used in the cases? (and

Does dmd use static or dynamic linking with the Phobos Library?

2012-04-30 Thread WhatMeWorry
Is this user configurable? I came across the sentence in the D Compiler/Linking section: "The actual linking is done by running gcc" I thought that maybe this meant that I could pass a gcc option like -static or -shared through dmd, but it errored out. Thanks in advance.

Re: Does dmd use static or dynamic linking with the Phobos Library?

2012-04-30 Thread Nick Sabalausky
"WhatMeWorry" wrote in message news:ezfjpijdnokmihhrp...@forum.dlang.org... > > Is this user configurable? I came across the sentence in the D > Compiler/Linking section: > > "The actual linking is done by running gcc" > > I thought that maybe this meant that I could pass a gcc option > like -

Re: Compute in one pass 3 tokens position

2012-04-30 Thread bioinfornatics
Le lundi 30 avril 2012 à 14:52 +0200, bioinfornatics a écrit : > Hi, > I would like to know how compute in on pass 3 tokens position in a > sequence. > curently i do: > File f = File( "reader.d", "r" ); > scope(exit) f.close(); > char[1024] buffer; > char[] content = f.rawRead(buffer); > char[sized

Re: Compute in one pass 3 tokens position

2012-04-30 Thread Era Scarecrow
On Tuesday, 1 May 2012 at 02:49:19 UTC, bioinfornatics wrote: Le lundi 30 avril 2012 à 14:52 +0200, bioinfornatics a écrit : Anyone know how to know the position of 3 token in one sequence in one pass? tok1 = a tok2 = b tok3 = c seq = blah count me b=> 0 a=>2 c=>5 iterate over sequence if tok

Re: Does dmd use static or dynamic linking with the Phobos Library?

2012-04-30 Thread WhatMeWorry
On Tuesday, 1 May 2012 at 02:47:35 UTC, Nick Sabalausky wrote: "WhatMeWorry" wrote in message news:ezfjpijdnokmihhrp...@forum.dlang.org... Is this user configurable? I came across the sentence in the D Compiler/Linking section: "The actual linking is done by running gcc" I thought that ma