From: Ken Raeburn <raeburn@raeburn.org>
To: guile-devel <guile-devel@gnu.org>
Subject: patch: remove unused futures code
Date: Thu, 29 Oct 2009 17:54:57 -0400 [thread overview]
Message-ID: <10513C5E-6EA5-434D-8525-C999B20F96DA@raeburn.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
Since support for "futures" in C has been completely disabled for
some
time, and should be easily implementable in Scheme with the current
thread support, delete the C code.
* libguile/futures.c, libguile/futures.h: Delete.
* libguile/Makefile.am (libguile_la_SOURCES, DOT_X_FILES,
DOT_DOC_FILES, modinclude_HEADERS): Delete references to
futures.*
files.
* libguile.h: Don't include futures.h.
* libguile/eval.c: Don't include futures.h.
(isymnames): Delete "#@future" entry.
(scm_m_future, s_future, scm_sym_future, unmemoize_future,
unmemoize_builtin_macro): Delete disabled futures code.
* libguile/eval.i.c (CEVAL): Delete disabled futures code.
* libguile/init.c: Don't include futures.h.
(scm_i_init_guile): Delete disabled futures initialization call.
* libguile/tags.h (SCM_IM_FUTURE): Delete.
(SCM_IM_CALL_WITH_VALUES, SCM_IM_ELSE, SCM_IM_ARROW,
SCM_IM_NIL_COND, SCM_IM_BIND): Renumber.
* doc/ref/api-scheduling.texi: Delete commented-out node on
Futures.
* doc/maint/guile.texi: Delete make-future and future-ref mentions.
The attached patch doesn't include the diffs for the files going away.
[-- Attachment #2: no-future.diff --]
[-- Type: application/octet-stream, Size: 9114 bytes --]
diff --git a/doc/maint/guile.texi b/doc/maint/guile.texi
index 3b5305e..127f0bb 100644
--- a/doc/maint/guile.texi
+++ b/doc/maint/guile.texi
@@ -1750,22 +1750,6 @@ current interfaces. If a file cannot be opened with the access
requested, @code{open-file} throws an exception.
@end deffn
-\fmake-future
-@c snarfed from futures.c:89
-@deffn {Scheme Procedure} make-future thunk
-@deffnx {C Function} scm_make_future (thunk)
-Make a future evaluating THUNK.
-@end deffn
-
-\ffuture-ref
-@c snarfed from futures.c:221
-@deffn {Scheme Procedure} future-ref future
-@deffnx {C Function} scm_future_ref (future)
-If the future @var{x} has not been computed yet, compute and
-return @var{x}, otherwise just return the previously computed
-value.
-@end deffn
-
\fgc-live-object-stats
@c snarfed from gc.c:276
@deffn {Scheme Procedure} gc-live-object-stats
diff --git a/doc/ref/api-scheduling.texi b/doc/ref/api-scheduling.texi
index 34697d3..8382ba3 100644
--- a/doc/ref/api-scheduling.texi
+++ b/doc/ref/api-scheduling.texi
@@ -792,39 +792,6 @@ Like @code{scm_with_dynamic_state}, but call @var{func} with
@var{data}.
@end deftypefn
-@c @node Futures
-@c @subsection Futures
-@c @cindex futures
-
-@c -- Futures are disabled for the time being, see futures.h for an
-@c -- explanation.
-
-@c Futures are a convenient way to run a calculation in a new thread, and
-@c only wait for the result when it's actually needed.
-
-@c Futures are similar to promises (@pxref{Delayed Evaluation}), in that
-@c they allow mainline code to continue immediately. But @code{delay}
-@c doesn't evaluate at all until forced, whereas @code{future} starts
-@c immediately in a new thread.
-
-@c @deffn {syntax} future expr
-@c Begin evaluating @var{expr} in a new thread, and return a ``future''
-@c object representing the calculation.
-@c @end deffn
-
-@c @deffn {Scheme Procedure} make-future thunk
-@c @deffnx {C Function} scm_make_future (thunk)
-@c Begin evaluating the call @code{(@var{thunk})} in a new thread, and
-@c return a ``future'' object representing the calculation.
-@c @end deffn
-
-@c @deffn {Scheme Procedure} future-ref f
-@c @deffnx {C Function} scm_future_ref (f)
-@c Return the value computed by the future @var{f}. If @var{f} has not
-@c yet finished executing then wait for it to do so.
-@c @end deffn
-
-
@node Parallel Forms
@subsection Parallel forms
@cindex parallel forms
diff --git a/libguile.h b/libguile.h
index 7967c2b..73b3de7 100644
--- a/libguile.h
+++ b/libguile.h
@@ -51,7 +51,6 @@ extern "C" {
#include "libguile/filesys.h"
#include "libguile/fluids.h"
#include "libguile/fports.h"
-#include "libguile/futures.h"
#include "libguile/gc.h"
#include "libguile/gdbint.h"
#include "libguile/generalized-arrays.h"
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 2e8457b..96c66a7 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -131,7 +131,6 @@ libguile_la_SOURCES = \
fluids.c \
fports.c \
frames.c \
- futures.c \
gc-malloc.c \
gc.c \
gdbint.c \
@@ -230,7 +229,6 @@ DOT_X_FILES = \
feature.x \
fluids.x \
fports.x \
- futures.x \
gc-malloc.x \
gc.x \
gettext.x \
@@ -327,7 +325,6 @@ DOT_DOC_FILES = \
feature.doc \
fluids.doc \
fports.doc \
- futures.doc \
gc-malloc.doc \
gc.doc \
gettext.doc \
@@ -483,7 +480,6 @@ modinclude_HEADERS = \
fluids.h \
fports.h \
frames.h \
- futures.h \
gc.h \
gdb_interface.h \
gdbint.h \
diff --git a/libguile/eval.c b/libguile/eval.c
index 59db429..3c96251 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -41,7 +41,6 @@
#include "libguile/eq.h"
#include "libguile/feature.h"
#include "libguile/fluids.h"
-#include "libguile/futures.h"
#include "libguile/goops.h"
#include "libguile/hash.h"
#include "libguile/hashtab.h"
@@ -409,7 +408,6 @@ static const char *const isymnames[] =
"#@slot-ref",
"#@slot-set!",
"#@delay",
- "#@future",
"#@call-with-values",
"#@else",
"#@arrow",
@@ -784,9 +782,6 @@ static SCM scm_m_do (SCM xorig, SCM env);
static SCM scm_m_quasiquote (SCM xorig, SCM env);
static SCM scm_m_delay (SCM xorig, SCM env);
static SCM scm_m_generalized_set_x (SCM xorig, SCM env);
-#if 0 /* Futures are disabled, see "futures.h". */
-static SCM scm_m_future (SCM xorig, SCM env);
-#endif
static SCM scm_m_define (SCM x, SCM env);
static SCM scm_m_letrec (SCM xorig, SCM env);
static SCM scm_m_let (SCM xorig, SCM env);
@@ -2196,36 +2191,6 @@ scm_m_eval_when (SCM expr, SCM env SCM_UNUSED)
return scm_list_1 (SCM_IM_BEGIN);
}
-#if 0
-
-/* See futures.h for a comment why futures are not enabled.
- */
-
-SCM_SYNTAX (s_future, "future", scm_i_makbimacro, scm_m_future);
-SCM_GLOBAL_SYMBOL (scm_sym_future, s_future);
-
-/* Like promises, futures are implemented as closures with an empty
- * parameter list. Thus, (future <expression>) is transformed into
- * (#@future '() <expression>), where the empty list represents the
- * empty parameter list. This representation allows for easy creation
- * of the closure during evaluation. */
-static SCM
-scm_m_future (SCM expr, SCM env)
-{
- const SCM new_expr = memoize_as_thunk_prototype (expr, env);
- SCM_SETCAR (new_expr, SCM_IM_FUTURE);
- return new_expr;
-}
-
-static SCM
-unmemoize_future (const SCM expr, const SCM env)
-{
- const SCM thunk_expr = SCM_CADDR (expr);
- return scm_list_2 (scm_sym_future, unmemoize_expression (thunk_expr, env));
-}
-
-#endif /* futures disabled. */
-
SCM_SYNTAX (s_gset_x, "set!", scm_i_makbimacro, scm_m_generalized_set_x);
SCM_SYMBOL (scm_sym_setter, "setter");
@@ -2494,13 +2459,6 @@ unmemoize_builtin_macro (const SCM expr, const SCM env)
case (ISYMNUM (SCM_IM_CALL_WITH_VALUES)):
return unmemoize_at_call_with_values (expr, env);
-#if 0
- /* See futures.h for a comment why futures are not enabled.
- */
- case (ISYMNUM (SCM_IM_FUTURE)):
- return unmemoize_future (expr, env);
-#endif
-
case (ISYMNUM (SCM_IM_SLOT_REF)):
return unmemoize_atslot_ref (expr, env);
diff --git a/libguile/eval.i.c b/libguile/eval.i.c
index e2e79c2..5e78f6d 100644
--- a/libguile/eval.i.c
+++ b/libguile/eval.i.c
@@ -734,13 +734,6 @@ dispatch:
case (ISYMNUM (SCM_IM_DELAY)):
RETURN (scm_make_promise (scm_closure (SCM_CDR (x), env)));
-#if 0
- /* See futures.h for a comment why futures are not enabled.
- */
- case (ISYMNUM (SCM_IM_FUTURE)):
- RETURN (scm_i_make_future (scm_closure (SCM_CDR (x), env)));
-#endif
-
/* PLACEHOLDER for case (ISYMNUM (SCM_IM_DISPATCH)): The following
code (type_dispatch) is intended to be the tail of the case
clause for the internal macro SCM_IM_DISPATCH. Please don't
diff --git a/libguile/init.c b/libguile/init.c
index 3fbe368..68156ef 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -60,7 +60,6 @@
#include "libguile/filesys.h"
#include "libguile/fluids.h"
#include "libguile/fports.h"
-#include "libguile/futures.h"
#include "libguile/gc.h"
#include "libguile/gdbint.h"
#include "libguile/generalized-arrays.h"
@@ -479,11 +478,6 @@ scm_i_init_guile (SCM_STACKITEM *base)
scm_init_dynwind ();
scm_init_eq ();
scm_init_error ();
-#if 0
- /* See futures.h for a comment why futures are not enabled.
- */
- scm_init_futures ();
-#endif
scm_init_fluids ();
scm_init_feature (); /* Requires fluids */
scm_init_backtrace (); /* Requires fluids */
diff --git a/libguile/tags.h b/libguile/tags.h
index 2d14ed2..f745732 100644
--- a/libguile/tags.h
+++ b/libguile/tags.h
@@ -613,7 +613,7 @@ enum scm_tc8_tags
/* Evaluator byte codes ('immediate symbols'). These constants are used only
* in eval but their values have to be allocated here. The indices of the
- * SCM_IM_ symbols must agree with the declarations in print.c:
+ * SCM_IM_ symbols must agree with the declarations in eval.c:
* scm_isymnames. */
#define SCM_ISYMP(n) (SCM_ITAG8 (n) == scm_tc8_isym)
@@ -639,12 +639,11 @@ enum scm_tc8_tags
#define SCM_IM_SLOT_REF SCM_MAKISYM (17)
#define SCM_IM_SLOT_SET_X SCM_MAKISYM (18)
#define SCM_IM_DELAY SCM_MAKISYM (19)
-#define SCM_IM_FUTURE SCM_MAKISYM (20)
-#define SCM_IM_CALL_WITH_VALUES SCM_MAKISYM (21)
-#define SCM_IM_ELSE SCM_MAKISYM (22)
-#define SCM_IM_ARROW SCM_MAKISYM (23)
-#define SCM_IM_NIL_COND SCM_MAKISYM (24) /* Multi-language support */
-#define SCM_IM_BIND SCM_MAKISYM (25) /* Multi-language support */
+#define SCM_IM_CALL_WITH_VALUES SCM_MAKISYM (20)
+#define SCM_IM_ELSE SCM_MAKISYM (21)
+#define SCM_IM_ARROW SCM_MAKISYM (22)
+#define SCM_IM_NIL_COND SCM_MAKISYM (23) /* Multi-language support */
+#define SCM_IM_BIND SCM_MAKISYM (24) /* Multi-language support */
\f
next reply other threads:[~2009-10-29 21:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-29 21:54 Ken Raeburn [this message]
2009-10-30 21:01 ` patch: remove unused futures code Neil Jerram
2009-10-31 14:36 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10513C5E-6EA5-434D-8525-C999B20F96DA@raeburn.org \
--to=raeburn@raeburn.org \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).