Re: Ternary if and ~ does not work quite well

2015-10-12 Thread Marc Schütz via Digitalmars-d-learn
On Monday, 12 October 2015 at 05:34:13 UTC, anonymous wrote: It's `assert(("foo "~ true) ? ("bar") : ("baz" == "foo bar"));` though. "foo" ~ true Stupid C implicit conversion rules...

Re: AWS API Dlang, hmac sha256 function.

2015-10-12 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 11 October 2015 at 23:16:51 UTC, holo wrote: auto hmac_sha256(ubyte[] key, ubyte[] msg) { auto hmac = hmac!SHA256(key); hmac.put(msg); auto digest = hmac.finish; return digest; } alias

Re: Ternary if and ~ does not work quite well

2015-10-12 Thread TheFlyingFiddle via Digitalmars-d-learn
On Monday, 12 October 2015 at 05:19:40 UTC, Andre wrote: Hi, writeln("foo "~ true ? "bar" : "baz"); André "foo" ~ true How does this compile? All i can see is a user trying to append a boolean to a string which is obvously a type error. Or are they converted to ints and then ~ would

DMD Compiler 'switches'

2015-10-12 Thread ric maicle via Digitalmars-d-learn
I'm relearning D. I'm using the reference compiler (DMD) and I am a bit confused with how the compiler 'switches' are supposed to be used. I find some 'switches' that require an equal (=) symbol when a value is required to be passed in. -boundscheck=[on|safeonly|off] -color[=on|off]

Re: Tell GC to use shared memory

2015-10-12 Thread thedeemon via Digitalmars-d-learn
On Thursday, 8 October 2015 at 09:25:36 UTC, tcak wrote: On Thursday, 8 October 2015 at 05:46:31 UTC, ketmar wrote: On Thursday, 8 October 2015 at 04:38:43 UTC, tcak wrote: Is it possible to modify GC (without rebuilding the compiler), so it uses a given shared memory area instead of heap for

Re: AWS API Dlang, hmac sha256 function.

2015-10-12 Thread holo via Digitalmars-d-learn
Thank you for info, i changed my code to use that build in template and changed "cast(ubyte[]" to "xxx.representation" and it is still working: #!/usr/bin/rdmd -L-lcurl module sigawsv4; import std.stdio, std.process; import std.digest.sha, std.digest.hmac; import std.string; import

Re: Hash-Table-Based Multiple Arguments Replacement

2015-10-12 Thread ixid via Digitalmars-d-learn
On Saturday, 10 October 2015 at 16:19:53 UTC, Nordlöw wrote: Is there an algorithm somewhere in Phobos which performs when possible a replacement/substitution based on a variadic definition of replacements using hash-table search similar to string replaceWhole(string a) { switch (x) {

Re: Class, constructor and inherance.

2015-10-12 Thread holo via Digitalmars-d-learn
@Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top of that i could build my app. It need to just periodically check for new instances and if they are started or stopped and count "up and

Re: Ternary if and ~ does not work quite well

2015-10-12 Thread deed via Digitalmars-d-learn
On Monday, 12 October 2015 at 15:39:15 UTC, TheFlyingFiddle wrote: How does this compile? { string str = "hello"; foreach (n; [32, 119, 111, 114, 108, 100, 33]) str ~= n; import std.stdio : writeln; str.writeln;// prints "hello world!" writeln(true == 1);

Re: DMD Compiler 'switches'

2015-10-12 Thread anonymous via Digitalmars-d-learn
On Monday 12 October 2015 17:38, ric maicle wrote: > I'm wondering if this small irregularity should be made consistent or > maybe I misunderstood something. As far as I know, the difference just happened, and there is point to it. The style without "=" is older and wasn't followed when new

Re: Ternary if and ~ does not work quite well

2015-10-12 Thread anonymous via Digitalmars-d-learn
On Monday 12 October 2015 17:39, TheFlyingFiddle wrote: > "foo" ~ true > > How does this compile? All i can see is a user trying to append a > boolean to a string which is obvously a type error. Or are they > converted to ints and then ~ would be a complement operator? In > that case..

Re: DMD Compiler 'switches'

2015-10-12 Thread Ali Çehreli via Digitalmars-d-learn
On 10/12/2015 11:34 AM, Gary Willoughby wrote: On Monday, 12 October 2015 at 15:38:27 UTC, ric maicle wrote: -Dddocdir -Dffilename -odobjdir -offilename I'm wondering if this small irregularity should be made consistent or maybe I misunderstood something. Yeah, it is a bit confusing and

Re: DMD Compiler 'switches'

2015-10-12 Thread anonymous via Digitalmars-d-learn
On Monday 12 October 2015 19:46, anonymous wrote: > and there is point to it Ugh, should have been: and there is *no* point to it.

Re: DMD Compiler 'switches'

2015-10-12 Thread ric maicle via Digitalmars-d-learn
On Tuesday, 13 October, 2015 01:46 AM, anonymous wrote: On Monday 12 October 2015 17:38, ric maicle wrote: I'm wondering if this small irregularity should be made consistent or maybe I misunderstood something. As far as I know, the difference just happened, and there is point to it. The

Re: Ternary if and ~ does not work quite well

2015-10-12 Thread Ali Çehreli via Digitalmars-d-learn
On 10/12/2015 08:39 AM, TheFlyingFiddle wrote: On Monday, 12 October 2015 at 05:19:40 UTC, Andre wrote: Hi, writeln("foo "~ true ? "bar" : "baz"); André "foo" ~ true How does this compile? All i can see is a user trying to append a boolean to a string which is obvously a type error. Or

Writing a screen saver in D what libraries will help?

2015-10-12 Thread Gary Willoughby via Digitalmars-d-learn
If I was writing a screensaver in D what libraries are available for opening a window and drawing sprites, etc on it. GPU accelerated if possible. I'm using Ubuntu 14.04 and latest DMD compiler.

Re: DMD Compiler 'switches'

2015-10-12 Thread ric maicle via Digitalmars-d-learn
On Tuesday, 13 October, 2015 02:39 AM, Ali Çehreli wrote: If we accept that = cannot be a part of a file name then we could support -D=ddocdir as well, but I checked and = can be used as part of a name at least on Linux. Which may explain why those switches are not consistent with the rest and

Re: Writing a screen saver in D what libraries will help?

2015-10-12 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 12 October 2015 at 19:16:10 UTC, Gary Willoughby wrote: If I was writing a screensaver in D what libraries are available for opening a window and drawing sprites, etc on it. GPU accelerated if possible. I'm using Ubuntu 14.04 and latest DMD compiler. I've found Dgame which looks

Re: DMD Compiler 'switches'

2015-10-12 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 12 October 2015 at 15:38:27 UTC, ric maicle wrote: I'm relearning D. I'm using the reference compiler (DMD) and I am a bit confused with how the compiler 'switches' are supposed to be used. I find some 'switches' that require an equal (=) symbol when a value is required to be

Re: DMD Compiler 'switches'

2015-10-12 Thread Timothee Cour via Digitalmars-d-learn
On Mon, Oct 12, 2015 at 11:33 AM, ric maicle via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > On Tuesday, 13 October, 2015 01:46 AM, anonymous wrote: > >> On Monday 12 October 2015 17:38, ric maicle wrote: >> >> I'm wondering if this small irregularity should be made

Re: Writing a screen saver in D what libraries will help?

2015-10-12 Thread welkam via Digitalmars-d-learn
On Monday, 12 October 2015 at 19:16:10 UTC, Gary Willoughby wrote: If I was writing a screensaver in D what libraries are available for opening a window and drawing sprites, etc on it. GPU accelerated if possible. I'm using Ubuntu 14.04 and latest DMD compiler. You will need to interface to

Re: Class, constructor and inherance.

2015-10-12 Thread Rikki Cattermole via Digitalmars-d-learn
On 13/10/15 5:56 AM, holo wrote: @Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top of that i could build my app. It need to just periodically check for new instances and if they are

Re: DMD Compiler 'switches'

2015-10-12 Thread Ali Çehreli via Digitalmars-d-learn
On 10/12/2015 01:03 PM, ric maicle wrote: On Tuesday, 13 October, 2015 02:39 AM, Ali Çehreli wrote: If we accept that = cannot be a part of a file name then we could support -D=ddocdir as well, but I checked and = can be used as part of a name at least on Linux. Which may explain why those

Re: DMD Compiler 'switches'

2015-10-12 Thread ric maicle via Digitalmars-d-learn
On Tuesday, 13 October, 2015 05:43 AM, Ali Çehreli wrote: Perhaps those were introduced after the other ones. I am agreeing with the other posters that we cannot fix the other ones because if anyone used = before, it was the part of the path. (Maybe... Never tried... :) ) So, we cannot change

Re: DMD Compiler 'switches'

2015-10-12 Thread ric maicle via Digitalmars-d-learn
On Tuesday, 13 October, 2015 06:11 AM, ric maicle wrote: Would it be possible to deprecate the old syntax, provide notice to all D users and make it obsolete after a year? Please ignore. There is already a DIP filed regarding this matter. DIP41: dmd/rdmd command line overhaul.

Re: Writing a screen saver in D what libraries will help?

2015-10-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 12 October 2015 at 23:24:56 UTC, welkam wrote: You will need to interface to C libraries like SDL. Not necessarily any beyond the operating system libs. In fact, for a screensaver, you might want to use lower level calls. I don't know how they are made anymore, but in Windows 95

Re: Writing a screen saver in D what libraries will help?

2015-10-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 12 October 2015 at 19:16:10 UTC, Gary Willoughby wrote: If I was writing a screensaver in D what libraries are available for opening a window and drawing sprites, etc on it. GPU accelerated if possible. My simpledisplay.d might be able to do it but it doesn't fully wrap stuff

Re: Class, constructor and inherance.

2015-10-12 Thread holo via Digitalmars-d-learn
On Tuesday, 13 October 2015 at 02:03:46 UTC, Rikki Cattermole wrote: On 13/10/15 5:56 AM, holo wrote: @Rikki: If you didn't need to make it easily changeable I would say not even bother with OOP at all. Basically that what i had was enough for me and on top of that i could build my app.