Re: Using std.math: FloatingPointControl.enableExceptions

2015-12-10 Thread rumbu via Digitalmars-d-learn
On Friday, 11 December 2015 at 06:28:09 UTC, Shriramana Sharma wrote: Hello. I'm trying to figure out how to use FloatingPointControl.enableExceptions. Upon enabling severeExceptions I would expect the division by zero to be signaled, but neither do I get a SIGFPE nor does ieeeFlags show the e

Using std.math: FloatingPointControl.enableExceptions

2015-12-10 Thread Shriramana Sharma via Digitalmars-d-learn
Hello. I'm trying to figure out how to use FloatingPointControl.enableExceptions. Upon enabling severeExceptions I would expect the division by zero to be signaled, but neither do I get a SIGFPE nor does ieeeFlags show the exception having been signaled. What am I doing wrong? import std.stdio

Re: %s not producing string representation of enum?

2015-12-10 Thread Shriramana Sharma via Digitalmars-d-learn
Basile B. wrote: > You should rather use std.traits.EnumMembers to iterate the > members of an enum: Wow this is great! I was thinking that enum.max + 1 is not really befitting D's elegant approach to programming. Ali should really update that section of his book to use EnumMembers. This will

Re: Very very noobie question about how imports work.

2015-12-10 Thread tcak via Digitalmars-d-learn
On Friday, 11 December 2015 at 04:09:19 UTC, Chris Wright wrote: On Fri, 11 Dec 2015 03:20:29 +, J Smith wrote: How do I make it so that I can import and use the contents of lib.d inside of testlib.d. If you are not compiling everything in one step, the -I flag allows you to specify path

Re: Very very noobie question about how imports work.

2015-12-10 Thread Chris Wright via Digitalmars-d-learn
On Fri, 11 Dec 2015 03:20:29 +, J Smith wrote: > How do I make it so that I can import and use the contents of lib.d > inside of testlib.d. If you are not compiling everything in one step, the -I flag allows you to specify paths to look for imports. For instance: $ dmd -lib src/package_name

Re: Very very noobie question about how imports work.

2015-12-10 Thread tcak via Digitalmars-d-learn
On Friday, 11 December 2015 at 03:20:29 UTC, J Smith wrote: Say I have a project with the files structured like this. package-name/ src/ package-name/ lib.d test/ testlib.d How do I make it so that I can import and use the contents of lib.d inside of testlib

Very very noobie question about how imports work.

2015-12-10 Thread J Smith via Digitalmars-d-learn
Say I have a project with the files structured like this. package-name/ src/ package-name/ lib.d test/ testlib.d How do I make it so that I can import and use the contents of lib.d inside of testlib.d. As you can tell I'm very new to D, and kind of new to

Re: "is not callable using a non-shared object"

2015-12-10 Thread Ali Çehreli via Digitalmars-d-learn
On 12/10/2015 02:07 PM, Entity325 wrote: > Both threads need to be able to run asynchronously themselves, so message > passing using std.concurrency isn't an option. I can still imagine a case where the receiver checks the message queue with a timeout of 0, which is non-blocking. > My problem

"is not callable using a non-shared object"

2015-12-10 Thread Entity325 via Digitalmars-d-learn
Usually the DMD compiler errors are very helpful, but I guess nothing can be perfect. In this case, I have a class I'm trying to declare. The class is intended to be a transport and storage medium, to allow information to be passed and updated asynchronously between two threads. One of the thre

Re: %s not producing string representation of enum?

2015-12-10 Thread Basile B. via Digitalmars-d-learn
On Thursday, 10 December 2015 at 14:46:26 UTC, Basile B. wrote: On Thursday, 10 December 2015 at 14:24:43 UTC, Shriramana Sharma wrote: Hello. I'm using DMD 2.069.2. As per http://ddili.org/ders/d.en/enum.html the following code is supposed to output the *names* of the suits: import std.stdio

Re: %s not producing string representation of enum?

2015-12-10 Thread Basile B. via Digitalmars-d-learn
On Thursday, 10 December 2015 at 14:24:43 UTC, Shriramana Sharma wrote: Hello. I'm using DMD 2.069.2. As per http://ddili.org/ders/d.en/enum.html the following code is supposed to output the *names* of the suits: import std.stdio; void main() { enum Suit { spades, hearts, diamonds, clubs }

Re: %s not producing string representation of enum?

2015-12-10 Thread Daniel Kozak via Digitalmars-d-learn
V Thu, 10 Dec 2015 19:54:43 +0530 Shriramana Sharma via Digitalmars-d-learn napsáno: > Hello. I'm using DMD 2.069.2. As per > http://ddili.org/ders/d.en/enum.html the following code is supposed > to output the *names* of the suits: > > import std.stdio; > void main() > { > enum Suit { spades

Re: %s not producing string representation of enum?

2015-12-10 Thread Daniel Kozak via Digitalmars-d-learn
V Thu, 10 Dec 2015 19:54:43 +0530 Shriramana Sharma via Digitalmars-d-learn napsáno: > Hello. I'm using DMD 2.069.2. As per > http://ddili.org/ders/d.en/enum.html the following code is supposed > to output the *names* of the suits: > > import std.stdio; > void main() > { > enum Suit { spades

Re: How to return user name from vibed session?

2015-12-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:46:19 UTC, Suliman wrote: because set return void, and get return T? No, it has nothing to do with the return type declarations. It's about whether or not the compiler has enough information to deduce the types. V get(V, K)(K key, V defaultVal); auto i

%s not producing string representation of enum?

2015-12-10 Thread Shriramana Sharma via Digitalmars-d-learn
Hello. I'm using DMD 2.069.2. As per http://ddili.org/ders/d.en/enum.html the following code is supposed to output the *names* of the suits: import std.stdio; void main() { enum Suit { spades, hearts, diamonds, clubs } foreach (suit; Suit.min .. Suit.max + 1) { writefln("%s", suit); } }

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:43:58 UTC, Suliman wrote: On Thursday, 10 December 2015 at 13:34:02 UTC, Mike Parker wrote: On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ", req.session.get!stri

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:34:02 UTC, Mike Parker wrote: On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ", req.session.get!string("username")); is still actual. When you have a template t

Re: How to return user name from vibed session?

2015-12-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ", req.session.get!string("username")); is still actual. When you have a template that looks like this: V get(V, K)(K key) {...} The compiler is abl

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
Oh, my issue. Right variant of setting session is: if(dbuser == "admin") // admin name hardcoded { _auth.isAuthorizated = true; req.session.set("username", "admin"); } else { req.session.set("username", dbuser); //set current username in parameter of ses

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 12:30:51 UTC, Suliman wrote: On Thursday, 10 December 2015 at 12:21:40 UTC, Adrian Matoga wrote: On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user

Re: How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
On Thursday, 10 December 2015 at 12:21:40 UTC, Adrian Matoga wrote: On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username", "admin

Re: How to return user name from vibed session?

2015-12-10 Thread Adrian Matoga via Digitalmars-d-learn
On Thursday, 10 December 2015 at 11:36:20 UTC, Suliman wrote: Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username", "admin"); But I can't understand how to get user name from it: abstract s

How to return user name from vibed session?

2015-12-10 Thread Suliman via Digitalmars-d-learn
Vibed have method get for user session http://vibed.org/api/vibe.http.session/SessionStore I set user name for session like this: req.session.set("username", "admin"); But I can't understand how to get user name from it: abstract std.variant.VariantN!(20) get( string id, string name, laz

Re: Reason for 'static struct'

2015-12-10 Thread Daniel Kozak via Digitalmars-d-learn
Yes, exactly. Some people even use static if it is not needed because it is harmless. And remove it only when enclosing context is demand. Dne 9. 12. 2015 22:40 napsal uživatel "Jon D via Digitalmars-d-learn" < digitalmars-d-learn@puremagic.com>: > On Wednesday, 9 December 2015 at 21:23:03 UTC, Da