In most implementations of C++ (or, at least VC5+), there are the
__LINE__ and __FILENAME__ macros. So you could do things like
(WARNING: ugly C code coming up):
printf( "%s %d\n", __FILENAME__, __LINE__ );
printf( "%s %d\n", __FILENAME__, __LINE__ );
which would result in:
foo.cpp 123
foo.cpp 124
Is there something like those macros in any LISP implementations? I
find em quite useful for quick debugging/tracing. Or..should I adopt a
better way of debugging my code? :P
Thanks
········@gmail.com writes:
> In most implementations of C++ (or, at least VC5+), there are the
> __LINE__ and __FILENAME__ macros. So you could do things like
> (WARNING: ugly C code coming up):
>
> printf( "%s %d\n", __FILENAME__, __LINE__ );
> printf( "%s %d\n", __FILENAME__, __LINE__ );
>
> which would result in:
>
> foo.cpp 123
> foo.cpp 124
>
> Is there something like those macros in any LISP implementations? I
> find em quite useful for quick debugging/tracing. Or..should I adopt a
> better way of debugging my code? :P
Have a look at:
*load-pathname*
*load-truename*
*load-verbose*
*load-print*
The notions of "source file name" or "source line number" don't mean
much in such a dynamic and retrospective language. Most of the code
in real applications doesn't come source files anyways but is
generated or compiled from higer level domain specific languages,
either at compilation time or at run time...
--
__Pascal Bourguignon__ http://www.informatimago.com/
Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.
From: Marcin 'Qrczak' Kowalczyk
Subject: Re: current line-number macro in LISP?
Date:
Message-ID: <87zmrukh3i.fsf@qrnik.zagroda>
Pascal Bourguignon <···@informatimago.com> writes:
> The notions of "source file name" or "source line number" don't mean
> much in such a dynamic and retrospective language. Most of the code
> in real applications doesn't come source files anyways but is
> generated or compiled from higer level domain specific languages,
> either at compilation time or at run time...
Source locations should refer to those higer level DSLs. I bet in most
cases there is a primary source written by a human, no matter in what
language, and error messages (both compile time and runtime) should
refer to that.
I don't know how to implement it when the transformation is done by
Lisp macros.
--
__("< Marcin Kowalczyk
\__/ ······@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/