guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-10-6-gb39


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-10-6-gb390b00
Date: Fri, 16 Apr 2010 08:37:54 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=b390b00834814f563a5dc13e2d629120f91990f6

The branch, master has been updated
       via  b390b00834814f563a5dc13e2d629120f91990f6 (commit)
       via  bcbfc9400d660b0bf05104b399c1ad177669b456 (commit)
       via  3279b6b1f5a31883c94f1ca0adcdd4cb216269c0 (commit)
       via  698307a08ab2cb81d2318fe50af2372ecaa03adc (commit)
       via  4d0fd3467c600447dd78a993c5be0fe89880b01c (commit)
       via  e6709db63f854dbcf36a6536dcbb57c6c97571a6 (commit)
      from  2d1ff3ba52dfc8ad9ab2a30a76b877024c9fc57a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b390b00834814f563a5dc13e2d629120f91990f6
Author: Andy Wingo <address@hidden>
Date:   Fri Apr 16 10:35:51 2010 +0200

    NEWS tweaks for nil
    
    * NEWS: Some nil-related news fixes; after 1.9.10, I know, but hey ;-)

commit bcbfc9400d660b0bf05104b399c1ad177669b456
Author: Andy Wingo <address@hidden>
Date:   Fri Apr 16 09:38:29 2010 +0200

    more nil docs
    
    * doc/ref/api-languages.texi (Nil): Be a bit more thorough, and
      positive.

commit 3279b6b1f5a31883c94f1ca0adcdd4cb216269c0
Author: Andy Wingo <address@hidden>
Date:   Fri Apr 16 00:00:39 2010 +0200

    add docs on `nil'
    
    * doc/ref/api-languages.texi (Nil): Write about `nil'.

commit 698307a08ab2cb81d2318fe50af2372ecaa03adc
Author: Andy Wingo <address@hidden>
Date:   Thu Apr 15 23:24:26 2010 +0200

    fix bugs in ice-9 i18n demo (invalid input)
    
    * doc/ref/api-i18n.texi (Accessing Locale Information): Crucial
      bugfixes.

commit 4d0fd3467c600447dd78a993c5be0fe89880b01c
Author: Andy Wingo <address@hidden>
Date:   Thu Apr 15 23:10:25 2010 +0200

    fixes to api-i18n.texi
    
    * doc/ref/api-i18n.texi (Character Case Mapping): Remove note about lack
      of support for multibute characters.

commit e6709db63f854dbcf36a6536dcbb57c6c97571a6
Author: Andy Wingo <address@hidden>
Date:   Thu Apr 15 23:09:29 2010 +0200

    flesh out docs on multiple languages a bit more
    
    * doc/ref/api-languages.texi: Move here from api-translation. Still
      stubbed in parts, but it's getting better.
    * doc/ref/Makefile.am: Adapt to api-languages.texi name change.
    * doc/ref/guile.texi: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 NEWS                         |    7 +-
 doc/ref/Makefile.am          |    2 +-
 doc/ref/api-i18n.texi        |   17 ++--
 doc/ref/api-languages.texi   |  265 ++++++++++++++++++++++++++++++++++++++++++
 doc/ref/api-translation.texi |   54 ---------
 doc/ref/guile.texi           |    4 +-
 6 files changed, 278 insertions(+), 71 deletions(-)
 create mode 100644 doc/ref/api-languages.texi
 delete mode 100644 doc/ref/api-translation.texi

diff --git a/NEWS b/NEWS
index efa8e1a..d610d83 100644
--- a/NEWS
+++ b/NEWS
@@ -71,9 +71,7 @@ but when we start to integrate more with Emacs, it is 
possible that we
 break code that assumes that, for example, `(not x)' implies that `x' is
 `eq?' to `#f'. This is not a common assumption. Refactoring affected
 code to rely on properties instead of identities will improve code
-correctness.
-
-That is to say, user code should test falsity with `if', not with `eq?'.
+correctness. See "Nil" in the manual, for more details.
 
 ** Integration of lalr-scm, a parser generator
 
@@ -1195,8 +1193,7 @@ Just use `scm_call_0', etc instead.
 The bit representation of `nil' has been tweaked so that it is now very
 efficient to check e.g. if a value is equal to Scheme's end-of-list or
 Lisp's nil. Additionally there are a heap of new, specific predicates
-like scm_is_null_or_nil. Probably in the future we will #define
-scm_is_null to scm_is_null_or_nil.
+like scm_is_null_or_nil.
 
 ** Support for static allocation of strings, symbols, and subrs.
 
diff --git a/doc/ref/Makefile.am b/doc/ref/Makefile.am
index 1277216..df1b4e1 100644
--- a/doc/ref/Makefile.am
+++ b/doc/ref/Makefile.am
@@ -42,12 +42,12 @@ guile_TEXINFOS = preface.texi                       \
                 api-io.texi                    \
                 api-foreign.texi               \
                 api-lalr.texi                  \
+                api-languages.texi             \
                 api-evaluation.texi            \
                 api-memory.texi                \
                 api-modules.texi               \
                 api-scheduling.texi            \
                 api-options.texi               \
-                api-translation.texi           \
                 api-i18n.texi                  \
                 api-debug.texi                 \
                 scheme-reading.texi            \
diff --git a/doc/ref/api-i18n.texi b/doc/ref/api-i18n.texi
index b82a3a2..ad1c2dc 100644
--- a/doc/ref/api-i18n.texi
+++ b/doc/ref/api-i18n.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -221,10 +221,6 @@ Return a new string that is the titlecase version of 
@var{str}
 according to either @var{locale} or the current locale.
 @end deffn
 
-Note that in the current implementation Guile has no notion of
-multibyte characters and in a multibyte locale characters may not be
-converted correctly.
-
 @node Number Input and Output, Accessing Locale Information, Character Case 
Mapping, Internationalization
 @subsection Number Input and Output
 
@@ -454,14 +450,17 @@ For the C locale, the default values are typically 
@code{"^[yY]"} and
 Here is an example:
 
 @example
+(use-modules (ice-9 rdelim))
 (format #t "Does Guile rock?~%")
-(let ((answer (read-line)))
+(let lp ((answer (read-line)))
   (cond ((string-match (locale-yes-regexp) answer)
-         "Yes it does.")
+         (format #t "High fives!~%"))
         ((string-match (locale-no-regexp) answer)
-         "No it doesn't.")
+         (format #t "How about now? Does it rock yet?~%")
+         (lp (read-line)))
         (else
-         "What do you mean?")))
+         (format #t "What do you mean?~%")
+         (lp (read-line)))))
 @end example
 
 For an internationalized yes/no string output, @code{gettext} should
diff --git a/doc/ref/api-languages.texi b/doc/ref/api-languages.texi
new file mode 100644
index 0000000..a9531a2
--- /dev/null
+++ b/doc/ref/api-languages.texi
@@ -0,0 +1,265 @@
address@hidden -*-texinfo-*-
address@hidden This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2010
address@hidden   Free Software Foundation, Inc.
address@hidden See the file guile.texi for copying conditions.
+
address@hidden
address@hidden Other Languages
address@hidden Support for Other Languages
+
+In addition to Scheme, a user may write a Guile program in an increasing
+number of other languages. Currently supported languages include Emacs
+Lisp and ECMAScript.
+
+Guile is still fundamentally a Scheme, but it tries to support a wide
+variety of language building-blocks, so that a user can implement other
+languages on top of Guile. This section describes the languages that
+have been implemented.
+
+(For details on how to implement a language, @xref{Compiling to the
+Virtual Machine}.)
+
address@hidden
+* Using Other Languages::       How to use other languages.
+* Emacs Lisp::                  The dialect of Lisp used in Emacs.
+* ECMAScript::                  As seen on television.
address@hidden menu
+
+
address@hidden Using Other Languages
address@hidden Using Other Languages
+
+There are currently only two ways to access other languages from within
+Guile: at the REPL, and via @code{compile} or @code{compile-file}.
+
+The REPL is Guile's command prompt (@pxref{Using Guile Interactively}).
+The REPL has a concept of the ``current language'', which defaults to
+Scheme. The user may change that language, via the meta-command
address@hidden,language}.
+
+For example, the following meta-command enables Emacs Lisp input:
+
address@hidden
+scheme@@(guile-user)> ,language elisp
+Happy hacking with Emacs Lisp!  To switch back, type `,L scheme'.
+elisp@@(guile-user)> (eq 1 2)
+$1 = #nil
address@hidden example
+
+Each language has its short name: for example, @code{elisp}, for Elisp.
+The same short name may be used to compile source code programmatically,
+via @code{compile}:
+
address@hidden
+elisp@@(guile-user)> ,L scheme
+Happy hacking with Guile Scheme!  To switch back, type `,L elisp'.
+scheme@@(guile-user)> (compile '(eq 1 2) #:from 'elisp)
+$2 = #nil
address@hidden example
+
+Granted, as the input to @code{compile} is a datum, this works best for
+Lispy languages, which have a straightforward datum representation.
+Other languages that need more parsing are better dealt with as strings.
+
+The easiest way to deal with syntax-heavy language is with files, via
address@hidden and friends. However it is possible to invoke a
+language's reader on a port, and then compile the resulting expression
+(which is a datum at that point). For more information,
address@hidden
+
+For more details on introspecting aspects of different languages,
address@hidden Tower}.
+
address@hidden Emacs Lisp
address@hidden Emacs Lisp
+
+Emacs Lisp (Elisp) is a dynamically-scoped Lisp dialect used in the
+Emacs editor. @xref{top,,Overview,elisp,Emacs Lisp}, for more
+information on Emacs Lisp.
+
+We hope that eventually Guile's implementation of Elisp will be good
+enough to replace Emacs' own implementation of Elisp. For that reason,
+we have thought long and hard about how to support the various features
+of Elisp in a performant and compatible manner.
+
+Readers familiar with Emacs Lisp might be curious about how exactly
+these various Elisp features are supported in Guile. The rest of this
+section focuses on addressing these concerns of the Elisp elect.
+
address@hidden
+* Nil::                         A third boolean.
+* Dynamic Binding::             Threadsafe bindings with fluids.
+* Other Elisp Features::        Miscellany.
address@hidden menu
+
+
address@hidden Nil
address@hidden Nil
+
address@hidden in ELisp is an amalgam of Scheme's @code{#f} and @code{'()}.
+It is false, and it is the end-of-list; thus it is a boolean, and a list
+as well.
+
+Guile has chosen to support @code{nil} as a separate value, distinct
+from @code{#f} and @code{'()}. This allows existing Scheme and Elisp
+code to maintain their current semantics. @code{nil}, which in Elisp
+would just be written and read as @code{nil}, in Scheme has the external
+representation @code{#nil}.
+
+This decision to have @code{nil} as a low-level distinct value
+facilitates interoperability between the two languages. Guile has chosen
+to have Scheme deal with @code{nil} as follows:
+
address@hidden
+(boolean? #nil) @result{} #t
+(not #nil) @result{} #t
+(null? #nil) @result{} #t
address@hidden example
+
+And in C, one has:
+
address@hidden
+scm_is_bool (SCM_ELISP_NIL) @result{} 1
+scm_is_false (SCM_ELISP_NIL) @result{} 1
+scm_is_null (SCM_ELISP_NIL) @result{} 1
address@hidden example
+
+In this way, a version of @code{fold} written in Scheme can correctly
+fold a function written in Elisp (or in fact any other language) over a
+nil-terminated list, as Elisp makes. The converse holds as well; a
+version of @code{fold} written in Elisp can fold over a
address@hidden'()}-terminated list, as made by Scheme.
+
+On a low level, the bit representations for @code{#f}, @code{#t},
address@hidden, and @code{'()} are made in such a way that the differ by
+only one bit, and so a test for, for example, @address@hidden
+may be made very efficiently. See @code{libguile/boolean.h}, for more
+information.
+
address@hidden Equality
+
+Since Scheme's @code{equal?} must be transitive, and @code{'()}
+is not @code{equal?} to @code{#f}, to Scheme @code{nil} is not
address@hidden to @code{#f} or @code{'()}.
+
address@hidden
+(eq? #f '()) @result{} #f
+(eq? #nil '()) @result{} #f
+(eq? #nil #f) @result{} #f
+(eqv? #f '()) @result{} #f
+(eqv? #nil '()) @result{} #f
+(eqv? #nil #f) @result{} #f
+(equal? #f '()) @result{} #f
+(equal? #nil '()) @result{} #f
+(equal? #nil #f) @result{} #f
address@hidden example
+
+However, in Elisp, @code{'()}, @code{#f}, and @code{nil} are all
address@hidden (though not @code{eq}).
+
address@hidden
+(defvar f (make-scheme-false))
+(defvar eol (make-scheme-null))
+(eq f eol) @result{} nil
+(eq nil eol) @result{} nil
+(eq nil f) @result{} nil
+(equal f eol) @result{} t
+(equal nil eol) @result{} t
+(equal nil f) @result{} t
address@hidden example
+
+These choices facilitate interoperability between Elisp and Scheme code,
+but they are not perfect. Some code that is correct standard Scheme is
+not correct in the presence of a second false and null value. For
+example:
+
address@hidden
+(define (truthiness x)
+  (if (eq? x #f)
+      #f
+      #t))
address@hidden example
+
+This code seems to be meant to test a value for truth, but now that
+there are two false values, @code{#f} and @code{nil}, it is no longer
+correct.
+
+Similarly, there is the loop:
+
address@hidden
+(define (my-length l)
+  (let lp ((l l) (len 0))
+    (if (eq? l '())
+        len
+        (lp (cdr l) (1+ len)))))
address@hidden example
+
+Here, @code{my-length} will raise an error if @var{l} is a
address@hidden list.
+
+Both of these examples are correct standard Scheme, but, depending on
+what they really want to do, they are not correct Guile Scheme.
+Correctly written, they would test the @emph{properties} of falsehood or
+nullity, not the individual members of that set. That is to say, they
+should use @code{not} or @code{null?} to test for falsehood or nullity,
+not @code{eq?} or @code{memv} or the like.
+
+Fortunately, using @code{not} and @code{null?} is in good style, so all
+well-written standard Scheme programs are correct, in Guile Scheme.
+
+Here are correct versions of the above examples:
+
address@hidden
+(define (truthiness* x)
+  (if (not x)
+      #f
+      #t))
+;; or: (define (t* x) (not (not x)))
+;; or: (define (t** x) x)
+
+(define (my-length* l)
+  (let lp ((l l) (len 0))
+    (if (null? l)
+        len
+        (lp (cdr l) (1+ len)))))
address@hidden example
+
+This problem has a mirror-image case in Elisp:
+
address@hidden
+(deffn my-falsep (x)
+  (if (eq x nil)
+      t
+      nil))
address@hidden example
+
+Guile can warn when compiling code that has equality comparisons with
address@hidden, @code{'()}, or @code{nil}. @xref{Compilation}, for details.
+
address@hidden Dynamic Binding
address@hidden Dynamic Binding
+
address@hidden Other Elisp Features
address@hidden Other Elisp Features
+
+
address@hidden ECMAScript
address@hidden ECMAScript
+
+ECMAScript was not the first non-Schemey language implemented by Guile,
+but it was the first implemented for Guile's bytecode compiler. The goal
+was to support ECMAScript version 3.1, a relatively small language, but
+the implementor was completely irresponsible and got distracted by other
+things before finishing the standard library, and even some bits of the
+syntax. So, ECMAScript does deserve a mention in the manual, but it
+doesn't deserve an endorsement until its implementation is completed,
+perhaps by some more responsible hacker.
+
+In the meantime, the charitable user might investigate such invocations
+as @code{,L ecmascript} and @code{cat test-suite/tests/ecmascript.test}.
+
+
address@hidden Local Variables:
address@hidden TeX-master: "guile.texi"
address@hidden End:
diff --git a/doc/ref/api-translation.texi b/doc/ref/api-translation.texi
deleted file mode 100644
index 8782a6f..0000000
--- a/doc/ref/api-translation.texi
+++ /dev/null
@@ -1,54 +0,0 @@
address@hidden -*-texinfo-*-
address@hidden This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004
address@hidden   Free Software Foundation, Inc.
address@hidden See the file guile.texi for copying conditions.
-
address@hidden
address@hidden Translation
address@hidden Support for Translating Other Languages
-
-[Describe translation framework.]
-
address@hidden
-* Emacs Lisp Support::          Helper primitives for Emacs Lisp.
address@hidden menu
-
-
address@hidden Emacs Lisp Support
address@hidden Emacs Lisp Support
-
address@hidden {Scheme Procedure} nil-car x
address@hidden {C Function} scm_nil_car (x)
-Return the car of @var{x}, but convert it to LISP nil if it
-is Scheme's end-of-list.
address@hidden deffn
-
address@hidden {Scheme Procedure} nil-cdr x
address@hidden {C Function} scm_nil_cdr (x)
-Return the cdr of @var{x}, but convert it to LISP nil if it
-is Scheme's end-of-list.
address@hidden deffn
-
address@hidden {Scheme Procedure} nil-cons x y
address@hidden {C Function} scm_nil_cons (x, y)
-Create a new cons cell with @var{x} as the car and @var{y} as
-the cdr, but convert @var{y} to Scheme's end-of-list if it is
-a Lisp nil.
address@hidden deffn
-
address@hidden {Scheme Procedure} nil-eq x y
-Compare @var{x} and @var{y} and return Lisp's t if they are
address@hidden, return Lisp's nil otherwise.
address@hidden deffn
-
address@hidden {Scheme Procedure} null x
address@hidden {C Function} scm_null (x)
-Return Lisp's @code{t} if @var{x} is nil in the LISP sense,
-return Lisp's nil otherwise.
address@hidden deffn
-
-
address@hidden Local Variables:
address@hidden TeX-master: "guile.texi"
address@hidden End:
diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index 91d391e..66584fc 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -309,7 +309,7 @@ available through both Scheme and C interfaces.
 * Foreign Function Interface::  Interacting with C procedures and data.
 * Scheduling::                  Threads, mutexes, asyncs and dynamic roots.
 * Options and Config::          Configuration, features and runtime options.
-* Translation::                 Support for translating other languages.
+* Other Languages::             Emacs Lisp, ECMAScript, and more.
 * Internationalization::        Support for gettext, etc.
 * Debugging::                   Debugging infrastructure and Scheme interface.
 @end menu
@@ -335,7 +335,7 @@ available through both Scheme and C interfaces.
 @include api-scheduling.texi
 @c object orientation support here
 @include api-options.texi
address@hidden api-translation.texi
address@hidden api-languages.texi
 @include api-i18n.texi
 @include api-debug.texi
 


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]