Re: Can I get caller name?

2014-09-25 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 26 September 2014 at 05:59:33 UTC, AsmMan wrote: for debugging purposes, I need to get the caller name. Is it possible? if so, how do I do this? void foo() { baa(); } void baa() { wrilten(caller_name()); // foo } I know I could create an extra parameter and pass the current fu

Re: Can I get caller name?

2014-09-25 Thread ketmar via Digitalmars-d-learn
On Fri, 26 Sep 2014 05:59:32 + AsmMan via Digitalmars-d-learn wrote: > for debugging purposes, I need to get the caller name. Is it > possible? if so, how do I do this? use debugger? or parse debugging info and do stackwalk. signature.asc Description: PGP signature

Can I get caller name?

2014-09-25 Thread AsmMan via Digitalmars-d-learn
for debugging purposes, I need to get the caller name. Is it possible? if so, how do I do this? void foo() { baa(); } void baa() { wrilten(caller_name()); // foo } I know I could create an extra parameter and pass the current function name as argument but it isn't a possibility for now.

Re: Remove filename from path

2014-09-25 Thread Jay Norwood via Digitalmars-d-learn
On Friday, 26 September 2014 at 03:32:46 UTC, Jay Norwood wrote: On Wednesday, 24 September 2014 at 10:28:05 UTC, Suliman wrote: string path = thisExePath() Seems like "dirName" in std.path is a good candidate ;) http://dlang.org/phobos/std_path.html#.dirName You'll find many other path manip

Re: Remove filename from path

2014-09-25 Thread Jay Norwood via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 10:28:05 UTC, Suliman wrote: string path = thisExePath() Seems like "dirName" in std.path is a good candidate ;) http://dlang.org/phobos/std_path.html#.dirName You'll find many other path manipulation functions there. Thanks! But if I want to strip it, how

Re: Does D has C#'s string.Empty?

2014-09-25 Thread Chris Cain via Digitalmars-d-learn
On Friday, 26 September 2014 at 01:09:01 UTC, AsmMan wrote: On Friday, 26 September 2014 at 00:53:24 UTC, ketmar via Digitalmars-d-learn wrote: On Fri, 26 Sep 2014 00:24:27 + AsmMan via Digitalmars-d-learn wrote: It made me a bit confusing. How is the implementation of string comparasi

Re: Does D has C#'s string.Empty?

2014-09-25 Thread ketmar via Digitalmars-d-learn
On Fri, 26 Sep 2014 01:08:59 + AsmMan via Digitalmars-d-learn wrote: > > "" has length of 0. null has length of 0. two strings without > > content > > are essentialy the same. > but null has length? what's null in D? i confused you here, sorry. what i mean is 'null string', not 'null' as a t

Re: Does D has C#'s string.Empty?

2014-09-25 Thread ketmar via Digitalmars-d-learn
On Fri, 26 Sep 2014 01:08:59 + AsmMan via Digitalmars-d-learn wrote: > but null has length? what's null in D? no, it's dynamic array that have `.length`. compiler magic. assigning `null` to dynamic array variable does some magic under the hood. dynamic array is actually this: `struct { size_

Re: Does D has C#'s string.Empty?

2014-09-25 Thread AsmMan via Digitalmars-d-learn
On Friday, 26 September 2014 at 00:53:24 UTC, ketmar via Digitalmars-d-learn wrote: On Fri, 26 Sep 2014 00:24:27 + AsmMan via Digitalmars-d-learn wrote: It made me a bit confusing. How is the implementation of string comparasion in D? "" has length of 0. null has length of 0. two strings

Re: "Undefined identifier FILE" when building Druntime

2014-09-25 Thread ketmar via Digitalmars-d-learn
On Thu, 25 Sep 2014 19:13:58 + Meta via Digitalmars-d-learn wrote: > This happens with a freshly checked out master. I first build > DMD, which completes successfully. However, when I then try to > build Druntime, I got the following error messages: can't confirm. just updated everything an

Re: Does D has C#'s string.Empty?

2014-09-25 Thread ketmar via Digitalmars-d-learn
On Fri, 26 Sep 2014 00:24:27 + AsmMan via Digitalmars-d-learn wrote: > It made me a bit confusing. How is the implementation of string > comparasion in D? "" has length of 0. null has length of 0. two strings without content are essentialy the same. signature.asc Description: PGP signature

Re: Does D has C#'s string.Empty?

2014-09-25 Thread AsmMan via Digitalmars-d-learn
On Thursday, 25 September 2014 at 12:43:57 UTC, Steven Schveighoffer wrote: On 9/25/14 2:41 AM, SlomoTheBrave wrote: On Thursday, 25 September 2014 at 05:29:37 UTC, AsmMan wrote: Does D has C#'s string.Empty? string.init ? string a; a = string.init; assert( a == ""); d

Re: Does D has C#'s string.Empty?

2014-09-25 Thread AsmMan via Digitalmars-d-learn
On Thursday, 25 September 2014 at 06:41:03 UTC, SlomoTheBrave wrote: On Thursday, 25 September 2014 at 05:29:37 UTC, AsmMan wrote: Does D has C#'s string.Empty? string.init ? string a; a = string.init; assert( a == ""); does the job for the type string at least. Thank

Re: [static] foreach scope, template declaration ?

2014-09-25 Thread Ali Çehreli via Digitalmars-d-learn
On 09/25/2014 04:08 PM, SlomoTheBrave wrote: > On Thursday, 25 September 2014 at 22:11:20 UTC, Mathias LANG wrote: >> I'm a bit puzzled with the following behavior: >> >> >> import std.typetuple, std.traits; >> >> struct UDAStruct { >> string identifier; >> } >> >> class MyClass { >>

Re: [static] foreach scope, template declaration ?

2014-09-25 Thread SlomoTheBrave via Digitalmars-d-learn
On Thursday, 25 September 2014 at 22:11:20 UTC, Mathias LANG wrote: I'm a bit puzzled with the following behavior: import std.typetuple, std.traits; struct UDAStruct { string identifier; } class MyClass { @(UDAStruct("p1"), UDAStruct("p2"), UDAStruct("P3")) // P3 is a typo

[static] foreach scope, template declaration ?

2014-09-25 Thread Mathias LANG via Digitalmars-d-learn
I'm a bit puzzled with the following behavior: import std.typetuple, std.traits; struct UDAStruct { string identifier; } class MyClass { @(UDAStruct("p1"), UDAStruct("p2"), UDAStruct("P3")) // P3 is a typo void func(int p1, string p2, float p3) {} } unittest { alias Fu

Re: A few questions regarding GC.malloc

2014-09-25 Thread Sean Kelly via Digitalmars-d-learn
On Thursday, 25 September 2014 at 21:43:53 UTC, monarch_dodra wrote: On Thursday, 25 September 2014 at 20:58:29 UTC, Gary Willoughby wrote: A few questions regarding GC.malloc. When requesting a chunk of memory from GC.malloc am i right in assuming that this chunk is scanned for pointers to ot

Re: A few questions regarding GC.malloc

2014-09-25 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 25 September 2014 at 20:58:29 UTC, Gary Willoughby wrote: A few questions regarding GC.malloc. When requesting a chunk of memory from GC.malloc am i right in assuming that this chunk is scanned for pointers to other GC resources in order to make decisions whether to collect them o

A few questions regarding GC.malloc

2014-09-25 Thread Gary Willoughby via Digitalmars-d-learn
A few questions regarding GC.malloc. When requesting a chunk of memory from GC.malloc am i right in assuming that this chunk is scanned for pointers to other GC resources in order to make decisions whether to collect them or not? What does BlkAttr.FINALIZE do when used in the GC.malloc call?

"Undefined identifier FILE" when building Druntime

2014-09-25 Thread Meta via Digitalmars-d-learn
This happens with a freshly checked out master. I first build DMD, which completes successfully. However, when I then try to build Druntime, I got the following error messages: src\core\stdc\wchar_.d(32): Error: undefined identifier FILE src\core\stdc\wchar_.d(33): Error: undefined identifier F

Re: Fail to compile phobos

2014-09-25 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 25, 2014 at 06:43:14PM +, monarch_dodra via Digitalmars-d-learn wrote: > On Thursday, 25 September 2014 at 17:20:42 UTC, JJDuck wrote: > >I tried to compile phobos according to the last paragraph in this page: > >http://dlang.org/dmd-linux.html > > > >but this is the error I have >

Re: Fail to compile phobos

2014-09-25 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 25 September 2014 at 17:20:42 UTC, JJDuck wrote: I tried to compile phobos according to the last paragraph in this page: http://dlang.org/dmd-linux.html but this is the error I have fatal: Not a git repository (or any of the parent directories): .git I dont know what happened,

Re: Fail to compile phobos

2014-09-25 Thread John Colvin via Digitalmars-d-learn
On Thursday, 25 September 2014 at 17:20:42 UTC, JJDuck wrote: I tried to compile phobos according to the last paragraph in this page: http://dlang.org/dmd-linux.html but this is the error I have fatal: Not a git repository (or any of the parent directories): .git I dont know what happened,

Re: immutable T.init, and pointers to mutable data

2014-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/14 10:56 AM, monarch_dodra wrote: On Thursday, 25 September 2014 at 13:37:52 UTC, Steven Schveighoffer wrote: But clearly, any code that results in an immutable pointer to mutable data without casts is incorrect. We should start by outlawing such code, and if there are ways we can carv

Re: sign oauth request

2014-09-25 Thread szabo bogdan via Digitalmars-d-learn
On Thursday, 25 September 2014 at 17:09:40 UTC, Adam D. Ruppe wrote: On Thursday, 25 September 2014 at 17:03:43 UTC, John Chapman wrote: http://dlang.org/phobos/std_digest_sha.html#SHA1 Not quite the same, the oauth requires hmac. When I did this in my oauth.d for twitter and stuff, I used th

Re: How to export a deduced template type to the enclosing scope?

2014-09-25 Thread Ali Çehreli via Digitalmars-d-learn
On 09/25/2014 05:40 AM, Steven Schveighoffer wrote: > On 9/23/14 7:12 PM, Ali Çehreli wrote: > >> Can we get rid of the ResultT template parameter? Tricks with variadic >> templates, the with statement, etc. come to mind but I could not >> manage it. > > I don't think so. Me neither. :) This que

Fail to compile phobos

2014-09-25 Thread JJDuck via Digitalmars-d-learn
I tried to compile phobos according to the last paragraph in this page: http://dlang.org/dmd-linux.html but this is the error I have fatal: Not a git repository (or any of the parent directories): .git I dont know what happened, i have tried for a few days. BTW, should I place my dmd2 folde

Re: sign oauth request

2014-09-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 25 September 2014 at 17:03:43 UTC, John Chapman wrote: http://dlang.org/phobos/std_digest_sha.html#SHA1 Not quite the same, the oauth requires hmac. When I did this in my oauth.d for twitter and stuff, I used the C library "mhash" check out my code: https://github.com/adamdrup

Re: sign oauth request

2014-09-25 Thread John Chapman via Digitalmars-d-learn
there is no HMAC-SHA1 algorithm in phobos library... should I implement it from scratch? http://dlang.org/phobos/std_digest_sha.html#SHA1

Re: sign oauth request

2014-09-25 Thread szabo bogdan via Digitalmars-d-learn
which lib do you recommand? On Thursday, 25 September 2014 at 16:19:41 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Thu, Sep 25, 2014 at 03:57:36PM +, szabo bogdan via Digitalmars-d-learn wrote: Hi, How I can sign a request for flickrl oauth api? https://www.flickr.com/services/api/

Re: sign oauth request

2014-09-25 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 25, 2014 at 03:57:36PM +, szabo bogdan via Digitalmars-d-learn wrote: > Hi, > > How I can sign a request for flickrl oauth api? > https://www.flickr.com/services/api/auth.oauth.html#request_token > > there is no HMAC-SHA1 algorithm in phobos library... should I implement it > fro

Re: isCallable is not an expression

2014-09-25 Thread andre via Digitalmars-d-learn
Thanks a lot. Kind regards André

Re: Trying to get Derelict.opengl3.gl3 and derelict.glfw3.glfw3 to work together

2014-09-25 Thread MrSmith via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 13:59:41 UTC, csmith wrote: On Wednesday, 24 September 2014 at 11:07:56 UTC, Mike Parker wrote: You're using deprecated OpenGL calls. The gl3 module only declares and loads modern OpenGL. If you really want to use the deprecated stuff, change the gl3 import to

sign oauth request

2014-09-25 Thread szabo bogdan via Digitalmars-d-learn
Hi, How I can sign a request for flickrl oauth api? https://www.flickr.com/services/api/auth.oauth.html#request_token there is no HMAC-SHA1 algorithm in phobos library... should I implement it from scratch? Thanks, Bogdan

Re: immutable T.init, and pointers to mutable data

2014-09-25 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 25 September 2014 at 13:37:52 UTC, Steven Schveighoffer wrote: On 9/25/14 9:00 AM, monarch_dodra wrote: On Thursday, 25 September 2014 at 12:46:01 UTC, Steven Schveighoffer wrote: On 9/25/14 5:47 AM, monarch_dodra wrote: I was playing around with how T.init works. And I think I ma

Re: immutable T.init, and pointers to mutable data

2014-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/14 9:00 AM, monarch_dodra wrote: On Thursday, 25 September 2014 at 12:46:01 UTC, Steven Schveighoffer wrote: On 9/25/14 5:47 AM, monarch_dodra wrote: I was playing around with how T.init works. And I think I may have found a type loophole. Given that you may initialize a pointer member

Re: immutable T.init, and pointers to mutable data

2014-09-25 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 25 September 2014 at 12:46:01 UTC, Steven Schveighoffer wrote: On 9/25/14 5:47 AM, monarch_dodra wrote: I was playing around with how T.init works. And I think I may have found a type loophole. Given that you may initialize a pointer member to the address to a static global: //

Re: immutable T.init, and pointers to mutable data

2014-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/14 5:47 AM, monarch_dodra wrote: I was playing around with how T.init works. And I think I may have found a type loophole. Given that you may initialize a pointer member to the address to a static global: // __gshared int a = 0; struct S { int* p = &a; } // Then, in theory

Re: How to export a deduced template type to the enclosing scope?

2014-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/23/14 7:12 PM, Ali Çehreli wrote: Can we get rid of the ResultT template parameter? Tricks with variadic templates, the with statement, etc. come to mind but I could not manage it. I don't think so. yield just returns control back to another fiber. It's not an entry point. What you *cou

Re: Does D has C#'s string.Empty?

2014-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/14 2:41 AM, SlomoTheBrave wrote: On Thursday, 25 September 2014 at 05:29:37 UTC, AsmMan wrote: Does D has C#'s string.Empty? string.init ? string a; a = string.init; assert( a == ""); does the job for the type string at least. null also works. In fact, in th

immutable T.init, and pointers to mutable data

2014-09-25 Thread monarch_dodra via Digitalmars-d-learn
I was playing around with how T.init works. And I think I may have found a type loophole. Given that you may initialize a pointer member to the address to a static global: // __gshared int a = 0; struct S { int* p = &a; } // Then, in theory, any variable, be they mutable or const

Re: Remove filename from path

2014-09-25 Thread monarch_dodra via Digitalmars-d-learn
On Wednesday, 24 September 2014 at 17:15:39 UTC, Ali Çehreli wrote: find() and friends can be used: import std.algorithm; void main() { string path = "myFile.doc"; string extension = ".doc"; path = findSplitBefore(path, extension)[0]; assert(path == "myFile"); } I had thought