Re: Mixin Template: cannot mixin scope(exit)?

2013-01-14 Thread Jacob Carlborg
On 2013-01-14 11:44, mist wrote: What is the rationale behind this limitation? I'm not sure but it might have something to do with template mixins introduce a new scope or similar. -- /Jacob Carlborg

Re: does alias this work correctly?

2013-01-14 Thread Zhenya
On Tuesday, 15 January 2013 at 00:04:15 UTC, Jonathan M Davis wrote: On Monday, January 14, 2013 17:57:03 Zhenya wrote: import std.stdio; struct Bar { void opDispatch(string op)() if(op == "bar") { if(this !is m_init)

Re: does alias this work correctly?

2013-01-14 Thread Jonathan M Davis
On Monday, January 14, 2013 17:57:03 Zhenya wrote: > import std.stdio; > > struct Bar > { > void opDispatch(string op)() > if(op == "bar") > { > if(this !is m_init) > writeln("non-static"); >

Re: Trouble with DLL address

2013-01-14 Thread dnewbie
The problem is FARPROC. Thank you everybody. Solution: import core.runtime; import std.c.windows.windows; import std.stdio; alias extern(Windows) int function(int) FuncPtr; alias extern(Windows) FuncPtr function() GetFuncPtr; int main(string[] args) { HMODULE dll= LoadLibrar

Re: Trouble with DLL address

2013-01-14 Thread Andrej Mitrovic
On 1/14/13, dnewbie wrote: > FuncPtr realFunction = cast(FuncPtr) getFunction(); Make that: FuncPtr realFunction = cast(FuncPtr) getFunction; Don't call the FARPROC, just cast it.

parallel() and random number generation

2013-01-14 Thread Joseph Rushton Wakeling
Hello all, One of the claims made for pseudo-random number generation in D is that rndGen (default RNG) is thread-safe, that is, each instance is unique to its thread and is seeded with unpredictableSeed, which should strongly limit the chances of two threads having correlated sequences of pse

Re: Good tutorials

2013-01-14 Thread 1100110
On 01/14/2013 12:25 PM, SaltySugar wrote: Where i can find some good tutorials and books? :) https://github.com/PhilippeSigaud/D-templates-tutorial https://github.com/PhilippeSigaud/D-templates-tutorial/blob/master/D-templates-tutorial.pdf?raw=true The second link is a direct pdf download of

Re: Mixin Template: cannot mixin scope(exit)?

2013-01-14 Thread 1100110
On 01/14/2013 04:44 AM, mist wrote: It appears that you cannot mixin *any* statement with scope([exit,success,etc]) in it. I have been rereading my copy of TDPL, and it states that mixin statements must be valid D code, and there can be multiple 'scope()' statements. Since "scope(exit) writeln

Re: structs are now lvalues - what is with "auto ref"?

2013-01-14 Thread Namespace
On Sunday, 13 January 2013 at 09:50:37 UTC, Namespace wrote: It turns out there already was a pull request that does this: https://github.com/D-Programming-Language/dmd/pull/1019 The pull request is still unmerged. Isn't this important enough or is the pull invalid? The question is still th

Re: Good tutorials

2013-01-14 Thread Jordi Sayol
Al 14/01/13 19:25, En/na SaltySugar ha escrit: > Where i can find some good tutorials and books? :) > Ali Çehreli wrote a nice book in Turkish to learn D from scratch, that is partially translated to English. http://ddili.org/ders/d.en/index.html It's available on-line and as pdf file. Regard

Re: Good tutorials

2013-01-14 Thread Peter Sommerfeld
SaltySugar wrote: Where i can find some good tutorials and books? :) http://ddili.org/ders/d.en/ http://www.amazon.com/exec/obidos/ASIN/0321635361/classicempire Peter

Re: does alias this work correctly?

2013-01-14 Thread Zhenya
On Sunday, 13 January 2013 at 22:36:03 UTC, Jonathan M Davis wrote: On Sunday, January 13, 2013 20:41:48 Zhenya wrote: On Sunday, 13 January 2013 at 19:35:08 UTC, Maxim Fomin wrote: > According to spec http://dlang.org/class.html#AliasThis > undefined lookups are forwarded to AliasThis member. B

Re: Need help with storage class definition

2013-01-14 Thread Kenji Hara
On Monday, 14 January 2013 at 14:16:32 UTC, mist wrote: While working on https://github.com/D-Programming-Language/phobos/pull/863 I have noticed that inout breaks ParameterStorageClassTuple and family. I have started working on a fix but quick comparison of http://dlang.org/declaration.html#S

Re: Need help with storage class definition

2013-01-14 Thread mist
Meh, while I was looking for this info in docs kind Kenji simply came out and fixed it, leaving no chance to learn :(

Re: does alias this work correctly?

2013-01-14 Thread Zhenya
On Sunday, 13 January 2013 at 23:21:20 UTC, Andrey wrote: I just want very much avoid renaming function,it's principle for me. So I would like to know is my sample right or no. I think that the main overall principle here is that is it impossible to have two functions which differ only by sta

Re: does alias this work correctly?

2013-01-14 Thread Zhenya
On Sunday, 13 January 2013 at 22:36:03 UTC, Jonathan M Davis wrote: On Sunday, January 13, 2013 20:41:48 Zhenya wrote: On Sunday, 13 January 2013 at 19:35:08 UTC, Maxim Fomin wrote: > According to spec http://dlang.org/class.html#AliasThis > undefined lookups are forwarded to AliasThis member. B

Need help with storage class definition

2013-01-14 Thread mist
While working on https://github.com/D-Programming-Language/phobos/pull/863 I have noticed that inout breaks ParameterStorageClassTuple and family. I have started working on a fix but quick comparison of http://dlang.org/declaration.html#StorageClass vs http://dlang.org/phobos/std_traits.html#.

Re: Mixin Template: cannot mixin scope(exit)?

2013-01-14 Thread mist
It appears that you cannot mixin *any* statement with scope([exit,success,etc]) in it. I have been rereading my copy of TDPL, and it states that mixin statements must be valid D code, and there can be multiple 'scope()' statements. Since "scope(exit) writeln();" is valid D code, and refuses t

Re: Passing shared delegates

2013-01-14 Thread mist
On Monday, 14 January 2013 at 10:13:16 UTC, Martin Drasar wrote: On 14.1.2013 8:56, Maxim Fomin wrote: Which compiler version do you use? It compiles on 2.061. It was 2.060. It compiles now on 2.061. Great! Yes, it was a known bug in pre-2.061 Big relief to have it working :)

Re: Passing shared delegates

2013-01-14 Thread Martin Drasar
On 14.1.2013 8:56, Maxim Fomin wrote: > Which compiler version do you use? It compiles on 2.061. It was 2.060. It compiles now on 2.061. Great! > In case of applying attributes to functions, mostly it is irrelevant > whether it stands first or last. So, > > void foo() shared {} > > and > > sha

Re: MS ODBC encoding issue

2013-01-14 Thread Regan Heath
I'm more than happy to upload the database file here,but I can't find how to.May I have your mail address?Appreciated for all the help! My email address in the from is valid: regan at netmail dot co dot nz -- Using Opera's revolutionary email client: http://www.opera.com/mail/

Re: Mixin Template: cannot mixin scope(exit)?

2013-01-14 Thread 1100110
On 01/14/2013 02:03 AM, Timon Gehr wrote: On 01/14/2013 07:26 AM, 1100110 wrote: On 01/13/2013 11:35 PM, 1100110 wrote: Ok, I wish to create a standard timing system so that I can measure ~how long each function takes to execute. I wish to be able to place at the start of a function version(Ti

Re: Trouble with DLL address

2013-01-14 Thread dennis luehring
Just ignore my post - too early in the morning :( Am 14.01.2013 10:19, schrieb dennis luehring: http://dlang.org/type.html int => signed 32 bits but don't you need long in D Am 14.01.2013 10:13, schrieb dnewbie: I have a DLL which exports a function GetFunction. GetFunction returns a pointer

Re: Trouble with DLL address

2013-01-14 Thread dennis luehring
http://dlang.org/type.html int => signed 32 bits but don't you need long in D Am 14.01.2013 10:13, schrieb dnewbie: I have a DLL which exports a function GetFunction. GetFunction returns a pointer to RealFunction. Now I want to run RealFunction from my D program, but for some reason I get the

Trouble with DLL address

2013-01-14 Thread dnewbie
I have a DLL which exports a function GetFunction. GetFunction returns a pointer to RealFunction. Now I want to run RealFunction from my D program, but for some reason I get the wrong address. Here is the code. dll64.c - #define WIN32_LEAN_AND_MEAN #include int __stdcall RealFunctio

Re: Mixin Template: cannot mixin scope(exit)?

2013-01-14 Thread Timon Gehr
On 01/14/2013 07:26 AM, 1100110 wrote: On 01/13/2013 11:35 PM, 1100110 wrote: Ok, I wish to create a standard timing system so that I can measure ~how long each function takes to execute. I wish to be able to place at the start of a function version(Time) mixin TimeExecution("funcName"); mixin

Re: Passing shared delegates

2013-01-14 Thread Maxim Fomin
On Monday, 14 January 2013 at 07:20:17 UTC, Martin Drašar wrote: Dne 11.1.2013 23:26, mist napsal(a): Do not have time to test code right now but first guess it is related to parsing differences for delegates and usual functions. Delegates can have shared/const applied to both delegate type its