Re: How to check whether an empty array variable is null?

2015-10-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 11, 2015 05:10:34 tcak via Digitalmars-d-learn wrote: > On Saturday, 10 October 2015 at 20:07:11 UTC, Jonathan M Davis > wrote: > > On Saturday, October 10, 2015 15:20:02 tcak via > > Digitalmars-d-learn wrote: > >> [code] > >> int[] list; > >> > >> list = new int[0]; > >> >

Re: How to check whether an empty array variable is null?

2015-10-11 Thread Ozan via Digitalmars-d-learn
On Saturday, 10 October 2015 at 15:46:51 UTC, Meta wrote: On Saturday, 10 October 2015 at 15:20:04 UTC, tcak wrote: [code] int[] list; list = new int[0]; std.stdio.writeln("Is Null ? ", (list is null)); [/code] Result is "Is Null? true". } Do I miss the

Re: Hash-Table-Based Multiple Arguments Replacement

2015-10-11 Thread Nordlöw via Digitalmars-d-learn
On Sunday, 11 October 2015 at 05:06:04 UTC, Nordlöw wrote: On Sunday, 11 October 2015 at 00:16:44 UTC, Meta wrote: There was something like this proposed quite awhile ago (can't remember what it was, might've been extending unary/binaryFun to accept an AA), but it was rejected. With static

Re: AWS API Dlang, hmac sha256 function.

2015-10-11 Thread holo via Digitalmars-d-learn
After long fight with previous code i try to rewrite "one-to-one" python example from http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html (GET part) from begging to D with full success. Here is working code in clear D. Im using hmac function which is available from

Re: Class, constructor and inherance.

2015-10-11 Thread Meta via Digitalmars-d-learn
On Monday, 12 October 2015 at 02:14:35 UTC, holo wrote: class credential { auto accessKey = environment.get["AWS_ACCESS_KEY"]; auto secretKey = environment.get["AWS_SECRET_KEY"]; } class sigv4 : credential { private: const algorithm = "AWS4-HMAC-SHA256";

Re: Class, constructor and inherance.

2015-10-11 Thread Ali Çehreli via Digitalmars-d-learn
On 10/11/2015 08:26 PM, holo wrote: > On Monday, 12 October 2015 at 02:30:43 UTC, Meta wrote: >> On Monday, 12 October 2015 at 02:14:35 UTC, holo wrote: >>> class credential >>> { >>> auto accessKey = environment.get["AWS_ACCESS_KEY"]; >>> auto secretKey =

Re: Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
By the looks, I'm guessing you do not have much experience when it comes to OOP. I think you are wanting something a bit closer to: import std.typecons : tuple, TypeTuple; interface Credential { string encode(); } class SigV4 : Credential { this() {

Ternary if and ~ does not work quite well

2015-10-11 Thread Andre via Digitalmars-d-learn
Hi, I am not sure, whether the output of following coding is correct: import std.stdio; void main() { writeln("foo "~ true ? "bar" : "baz"); writeln("foo "~ false ? "bar" : "baz"); // assert("foo "~ true ? "bar" : "baz" == "foo bar"); does not compile } Output: bar bar I

Re: Class, constructor and inherance.

2015-10-11 Thread anonymous via Digitalmars-d-learn
On Monday 12 October 2015 07:28, Ali Çehreli wrote: > For example, you cannot get current time at run time. I think you mean compile time here.

Re: Class, constructor and inherance.

2015-10-11 Thread Ali Çehreli via Digitalmars-d-learn
On 10/11/2015 10:35 PM, anonymous wrote: On Monday 12 October 2015 07:28, Ali Çehreli wrote: For example, you cannot get current time at run time. I think you mean compile time here. Thanks. :) Ali

Re: Ternary if and ~ does not work quite well

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 6:19 PM, Andre wrote: Hi, I am not sure, whether the output of following coding is correct: import std.stdio; void main() { writeln("foo "~ true ? "bar" : "baz"); writeln("foo "~ false ? "bar" : "baz"); // assert("foo "~ true ? "bar" : "baz" == "foo bar"); does not

Re: Ternary if and ~ does not work quite well

2015-10-11 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Oct 12, 2015 at 05:19:38AM +, Andre via Digitalmars-d-learn wrote: > Hi, > > I am not sure, whether the output of following coding is correct: > > import std.stdio; > > void main() > { > writeln("foo "~ true ? "bar" : "baz"); > writeln("foo "~ false ? "bar" : "baz"); >

Re: Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
On Monday, 12 October 2015 at 02:30:43 UTC, Meta wrote: On Monday, 12 October 2015 at 02:14:35 UTC, holo wrote: class credential { auto accessKey = environment.get["AWS_ACCESS_KEY"]; auto secretKey = environment.get["AWS_SECRET_KEY"]; } class sigv4 : credential {

Re: Class, constructor and inherance.

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 4:13 PM, holo wrote: By the looks, I'm guessing you do not have much experience when it comes to OOP. I think you are wanting something a bit closer to: import std.typecons : tuple, TypeTuple; interface Credential { string encode(); } class SigV4 : Credential {

Re: Ternary if and ~ does not work quite well

2015-10-11 Thread Andre via Digitalmars-d-learn
On Monday, 12 October 2015 at 05:25:46 UTC, H. S. Teoh wrote: On Mon, Oct 12, 2015 at 05:19:38AM +, Andre via Digitalmars-d-learn wrote: [...] [...] It's best to parenthesize when mixing other operators with ?, because ? has a pretty low precedence and may "steal" arguments from

Re: Ternary if and ~ does not work quite well

2015-10-11 Thread anonymous via Digitalmars-d-learn
On Monday 12 October 2015 07:23, Rikki Cattermole wrote: > On 12/10/15 6:19 PM, Andre wrote: [...] >> // assert("foo "~ true ? "bar" : "baz" == "foo bar"); does not compile [...] > I read it as: > > assert("foo "~ (true ? ("bar") : ("baz" == "foo bar"))); > > Oh hey look: >

Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
Hello I'm trying to write my first class. I want to use it as module and build anothers on top of it. I read that default functions attributes are not inherited. Is it that same for constructor? This is how my class (not finished) is looking right now: class credential { auto

Re: Class, constructor and inherance.

2015-10-11 Thread Rikki Cattermole via Digitalmars-d-learn
On 12/10/15 3:14 PM, holo wrote: Hello I'm trying to write my first class. I want to use it as module and build anothers on top of it. I read that default functions attributes are not inherited. Is it that same for constructor? This is how my class (not finished) is looking right now: class

Re: Class, constructor and inherance.

2015-10-11 Thread holo via Digitalmars-d-learn
On Monday, 12 October 2015 at 03:29:12 UTC, Rikki Cattermole wrote: On 12/10/15 4:13 PM, holo wrote: By the looks, I'm guessing you do not have much experience when it comes to OOP. I think you are wanting something a bit closer to: import std.typecons : tuple, TypeTuple; interface