[librep] When you evaluate a closure, the module to which it belongs is printed, too.



commit f02169f9f2cd1e6dd5f540e535e38dc1c24568e0
Author: Teika kazura <teika lavabit com>
Date:   Sat Jun 26 14:31:23 2010 +0900

    When you evaluate a closure, the module to which it belongs is printed, too.

 man/news.texi |    5 ++---
 src/lisp.c    |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/man/news.texi b/man/news.texi
index 72d7578..86f9e64 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -5,10 +5,9 @@
 
 @heading 0.90.7
 @itemize @bullet
- item Some documentation improvements [Teika kazura]
-
-Better explanation on @code{fluid} and @code{let}.
+ item When you evaluate a closure, the module to which it belongs is printed, too. [Teika kazura]
 
+ item Better documentation on ``fluid'' and @code{let}. [Teika kazura]
 @end itemize
 
 @heading 0.90.6
diff --git a/src/lisp.c b/src/lisp.c
index a6ca120..3c0281b 100644
--- a/src/lisp.c
+++ b/src/lisp.c
@@ -2245,12 +2245,29 @@ rep_lisp_prin(repv strm, repv obj)
 	}
 	else
 	{
+	  /* Anonimous function */
 #ifdef HAVE_SNPRINTF
 	    snprintf (tbuf, sizeof(tbuf), "%" rep_PTR_SIZED_INT_CONV "x", obj);
 #else
 	    sprintf (tbuf, "%" rep_PTR_SIZED_INT_CONV "x", obj);
 #endif
 	    rep_stream_puts (strm, tbuf, -1, rep_FALSE);
+
+	}
+
+	/* print structure name, too */
+	tem = rep_FUNARG(obj)->structure;
+	if (rep_STRUCTUREP(tem)){
+	  /*
+	   * I know spaces around "@" look untidy. But I hope this
+	   * prevents newbies from misunderstanding closure some module
+	   * is a valid read syntax.
+	   */
+	  rep_stream_puts (strm, " @ ", -1, rep_FALSE);
+
+	  rep_stream_puts (strm,
+			   rep_STR(Fsymbol_name(rep_STRUCTURE(tem)->name)),
+			   -1, rep_FALSE);
 	}
 	rep_stream_putc (strm, '>');
 	break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]