On 06/24/2016 10:19 AM, Smoke Adams wrote:
> We have __FUNCTION__ so, __THIS__ seems somewhat natural. Null for
> outside of objects is fine.
Would the following work, where you check the first argument?
import std.stdio;
void Log(string filename = __FILE__, T...)(T args)
{
static if (is
On 6/24/16 1:19 PM, Smoke Adams wrote:
The problem with UFCS is that I am using variadic parameters. The
logging function isn't designed to accept the first parameter as this.
Then you would need to change it?
It would be much easier to simply have the compiler "insert" it using
__THIS__.
On Friday, 24 June 2016 at 15:35:57 UTC, Steven Schveighoffer
wrote:
On 6/24/16 11:15 AM, Smoke Adams wrote:
On Friday, 24 June 2016 at 03:16:58 UTC, Meta wrote:
On Friday, 24 June 2016 at 03:10:51 UTC, Mike Parker wrote:
Oh, perhaps I misunderstood your question. Do you meant this:
class
On 6/24/16 11:15 AM, Smoke Adams wrote:
On Friday, 24 June 2016 at 03:16:58 UTC, Meta wrote:
On Friday, 24 June 2016 at 03:10:51 UTC, Mike Parker wrote:
Oh, perhaps I misunderstood your question. Do you meant this:
class Foo() {
void bar() { Log(); } // Pass reference to Foo instance
}
On Friday, 24 June 2016 at 03:16:58 UTC, Meta wrote:
On Friday, 24 June 2016 at 03:10:51 UTC, Mike Parker wrote:
Oh, perhaps I misunderstood your question. Do you meant this:
class Foo() {
void bar() { Log(); } // Pass reference to Foo instance
}
void doSomething() { Log(); } // Null
On Friday, 24 June 2016 at 03:10:51 UTC, Mike Parker wrote:
Oh, perhaps I misunderstood your question. Do you meant this:
class Foo() {
void bar() { Log(); } // Pass reference to Foo instance
}
void doSomething() { Log(); } // Null reference
If so, the answer is no. And I don't see how
On Friday, 24 June 2016 at 03:04:25 UTC, Mike Parker wrote:
On Friday, 24 June 2016 at 02:57:28 UTC, "Smoke" Adams wrote:
Is there a type of __THIS__ construct similar to __FILE__ and
__LINE__?
Something that returns the current this ptr if it exists, null
otherwise.
Log(string filename =
On Friday, 24 June 2016 at 02:57:28 UTC, "Smoke" Adams wrote:
Is there a type of __THIS__ construct similar to __FILE__ and
__LINE__?
Something that returns the current this ptr if it exists, null
otherwise.
Log(string filename = __FILE__, Object obj = __THIS__)()
{
// inspect obj and do
Is there a type of __THIS__ construct similar to __FILE__ and
__LINE__?
Something that returns the current this ptr if it exists, null
otherwise.
Log(string filename = __FILE__, Object obj = __THIS__)()
{
// inspect obj and do stuff
}