Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

current line-number macro in LISP?

8 views
Skip to first unread message

stev...@gmail.com

unread,
Jul 19, 2005, 8:02:39 PM7/19/05
to
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

Pascal Bourguignon

unread,
Jul 19, 2005, 10:20:39 PM7/19/05
to
stev...@gmail.com writes:

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.

Marcin 'Qrczak' Kowalczyk

unread,
Aug 6, 2005, 3:20:17 PM8/6/05
to
Pascal Bourguignon <p...@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
\__/ qrc...@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/

0 new messages