~ chicken-core (chicken-5) 5d102c31cef490e6e3d3bd8f0044801ed4e50d0e
commit 5d102c31cef490e6e3d3bd8f0044801ed4e50d0e Author: Evan Hanson <evhan@foldling.org> AuthorDate: Thu Jan 29 19:02:09 2015 +1300 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Thu Jan 29 19:06:19 2015 +1300 Clarify define-inline documentation Reshuffles define-inline's documentation so that it's a bit easier to understand, and adds a sentence pointing out that the `inline-limit` option doesn't affect inline procedure expansion. diff --git a/manual/Non-standard macros and special forms b/manual/Non-standard macros and special forms index b63db491..91c223a5 100644 --- a/manual/Non-standard macros and special forms +++ b/manual/Non-standard macros and special forms @@ -310,21 +310,29 @@ evaluate the expression at compile-time. ==== define-inline <macro>(define-inline (NAME VAR ...) BODY ...)</macro><br> -<macro>(define-inline (NAME VAR1 ... VARn . VARn+1) BODY ...)</macro><br> +<macro>(define-inline (NAME VAR ... . VAR) BODY ...)</macro><br> <macro>(define-inline NAME EXP)</macro> -Defines an inline procedure. Any occurrence of {{NAME}} will be -replaced by {{EXP}} or {{(lambda (VAR ... [. VAR]) BODY ...)}}. -This is similar to a macro, but variable-names and -scope will -be correctly handled. Inline substitutions take place '''after''' -macro-expansion. {{EXP}} should be a lambda-expression. Any -reference to {{NAME}} should appear textually '''after''' -its definition. Note that inline procedures are local to the current -compilation unit and are not available outside of the source file in -which they are defined. Names of inline procedures still exist in the -Scheme namespace and can be lexically shadowed. This construct is -equivalent to {{define}} when evaluated or interpreted. Inline -definitions should only appear at toplevel. +Defines an inline procedure. Any occurrence of {{NAME}} will be replaced +by {{EXP}} or {{(lambda (VAR ... [. VAR]) BODY ...)}}. This is similar +to a macro, but variable names and scope are handled correctly. + +Inline substitutions take place '''after''' macro-expansion, and any +reference to {{NAME}} should appear textually '''after''' its +definition. Inline procedures are local to the current compilation unit +and are not available outside of the source file in which they are +defined. Names of inline procedures still exist in the Scheme namespace +and can be lexically shadowed. Inline definitions should only appear at +the toplevel. + +Note that the {{inline-limit}} compiler option does not affect inline +procedure expansion, and self-referential inline procedures may cause +the compiler to enter an infinite loop. + +In the third form, {{EXP}} must be a lambda expression. + +This construct is equivalent to {{define}} when evaluated or +interpreted. ==== define-for-syntaxTrap