On 2012-46-06 08:11, Don Clugston d...@nospam.com wrote:
It fails because you're asking for the full function name, before its
type has been determined. (There's no real return type 'auto', 'auto'
just means 'work it out for me').
I don't think this is a bug. Although it might be solvable
I don't know how I missed this thread. I was having the same
'forward reference' error and after a brief chat on #D IRC,
thought it might be a compiler bug and reported it as such:
http://d.puremagic.com/issues/show_bug.cgi?id=8963 . Should I
close this issue?
Any thoughts on possible
On Tuesday, 6 November 2012 at 07:46:47 UTC, Don Clugston wrote:
It fails because you're asking for the full function name,
before its type has been determined. (There's no real return
type 'auto', 'auto' just means 'work it out for me').
In our case, the function name that is returned is
On Friday, 2 November 2012 at 22:33:37 UTC, Rob T wrote:
I discovered it fails to compile when inside a function with
auto as the return type.
auto test()
{
throw new Exception( mixin(__FUNCTION) );
return 0;
}
Error: forward reference to test
but this works
int test()
{
throw new
On 06/11/12 07:09, Rob T wrote:
On Friday, 2 November 2012 at 22:33:37 UTC, Rob T wrote:
I discovered it fails to compile when inside a function with auto as
the return type.
auto test()
{
throw new Exception( mixin(__FUNCTION) );
return 0;
}
Error: forward reference to test
but this
On Saturday, 3 November 2012 at 17:04:31 UTC, Rob T wrote:
On Saturday, 3 November 2012 at 11:09:48 UTC, Jacob Carlborg
wrote:
I think it would be worth to but in Phobos anyway.
I suppose it works as a temp solution until a real one is
finally implemented, or maybe the mixin behaviour is
On Sunday, 4 November 2012 at 13:57:07 UTC, Damian wrote:
On Saturday, 3 November 2012 at 17:04:31 UTC, Rob T wrote:
On Saturday, 3 November 2012 at 11:09:48 UTC, Jacob Carlborg
wrote:
I think it would be worth to but in Phobos anyway.
I suppose it works as a temp solution until a real one
On 2012-11-02 23:33, Rob T wrote:
That looks better. Not sure what the down side would be if any.
Unrelated to either form, I discovered it fails to compile when inside a
function with auto as the return type.
auto test()
{
throw new Exception( mixin(__FUNCTION) );
return 0;
}
On Saturday, 3 November 2012 at 11:09:48 UTC, Jacob Carlborg
wrote:
I think it would be worth to but in Phobos anyway.
I suppose it works as a temp solution until a real one is finally
implemented, or maybe the mixin behaviour is considered a bug and
can be fixed?
Thanks to input from the D community, I've managed to implement a
reasonable way to log the name of a calling function. This is
used for basic execution monitoring and for automated logging of
exception errors.
Here's what I did.
template __FUNCTION()
{
const char[] __FUNCTION =
On Friday, 2 November 2012 at 17:31:55 UTC, Rob T wrote:
Thanks to input from the D community, I've managed to implement
a reasonable way to log the name of a calling function.
Huh, that's pretty brilliant!
The ONLY thing left that I would like to have, is ability to
display the function
On 02-11-2012 18:31, Rob T wrote:
Thanks to input from the D community, I've managed to implement a
reasonable way to log the name of a calling function. This is used for
basic execution monitoring and for automated logging of exception errors.
Here's what I did.
template __FUNCTION()
{
On Fri, 02 Nov 2012 18:06:19 -, Alex Rønne Petersen a...@lycus.org
wrote:
On 02-11-2012 18:31, Rob T wrote:
Thanks to input from the D community, I've managed to implement a
reasonable way to log the name of a calling function. This is used for
basic execution monitoring and for
On Fri, Nov 02, 2012 at 07:06:19PM +0100, Alex Rønne Petersen wrote:
On 02-11-2012 18:31, Rob T wrote:
[...]
template __FUNCTION()
{
const char[] __FUNCTION = __traits(identifier, __traits(parent, {}));
}
Example use in code:
throw new Exception( Error: Function ,
Sweet! You may also find my pull request for phobos ( #863,
fullyQualifiedTypename ) useful for adding function signature
once it gets finalised and merged.
On Friday, 2 November 2012 at 17:31:55 UTC, Rob T wrote:
Thanks to input from the D community, I've managed to implement
a reasonable
On 2012-11-02 18:31, Rob T wrote:
Thanks to input from the D community, I've managed to implement a
reasonable way to log the name of a calling function. This is used for
basic execution monitoring and for automated logging of exception errors.
Here's what I did.
template __FUNCTION()
{
On Friday, 2 November 2012 at 17:55:33 UTC, Adam D. Ruppe wrote:
The ONLY thing left that I would like to have, is ability to
display the function signature along with the name.
template __FUNCTION_SIGNATURE() { const char[]
__FUNCTION_SIGNATURE = typeof(__traits(parent, {})).stringof;
}
By changing this to a standard function:
const(char[]) __FUNCTION() @property
{
return __traits(identifier, __traits(parent, {}));
}
... the calling syntax is slightly easier on the eye:
void main()
{
writefln( File: %s, Func: %s, Line: %d, __FILE__,
mixin(__FUNCTION), __LINE__ );
On Friday, November 02, 2012 22:34:15 Philippe Sigaud wrote:
By changing this to a standard function:
const(char[]) __FUNCTION() @property
{
return __traits(identifier, __traits(parent, {}));
}
... the calling syntax is slightly easier on the eye:
void main()
{
writefln( File: %s,
On 11/02/2012 10:34 PM, Philippe Sigaud wrote:
By changing this to a standard function:
const(char[]) __FUNCTION() @property
{
return __traits(identifier, __traits(parent, {}));
}
... the calling syntax is slightly easier on the eye:
void main()
{
writefln( File: %s, Func: %s, Line:
On Fri, Nov 2, 2012 at 10:59 PM, Jonathan M Davis jmdavisp...@gmx.com wrote:
Is there any downside to this?
Identifiers starting with __ are reserved for the compiler/language. It should
be __FUNCTION__ if it's built-in, but if it's in the library, I see no reason
to name it in a way that
On Friday, 2 November 2012 at 21:34:23 UTC, Philippe Sigaud wrote:
By changing this to a standard function:
const(char[]) __FUNCTION() @property
{
return __traits(identifier, __traits(parent, {}));
}
... the calling syntax is slightly easier on the eye:
void main()
{
writefln( File:
On Friday, 2 November 2012 at 22:33:37 UTC, Rob T wrote:
Unrelated to either form, I discovered it fails to compile when
inside a function with auto as the return type.
auto test()
{
throw new Exception( mixin(__FUNCTION) );
return 0;
}
Error: forward reference to test
but this
23 matches
Mail list logo