1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 03:00:25 +02:00
Commit graph

49 commits

Author SHA1 Message Date
Andy Wingo
7d38f3d819 compile goops
The pending task is to make the accessors compiled too, and also to
compile compile.scm and dispatch.scm, and to integrate dispatch into the
VM.

* oop/Makefile.am (SOURCES): VM-ify the makefile, so we compile goops.scm
  by default.

* oop/goops.scm (load-toplevel): Load goops builtins when compiling too.
  (method): Fix a literal #<unspecified> in the generated procedure (for
  an empty body).
  (internal-add-method!): Cleverness when bootstrapping add-method!.
  Neat!
  (initialize for <generic>): Use the `method' macro so we get
  compilation support.

* oop/goops/dispatch.scm (cache-methods): Don't assume entries are pairs.
2008-10-31 00:07:04 +01:00
Andy Wingo
21497600d2 add formals', body', and `compile-env' slots to <method>
* ice-9/boot-9.scm (compile-time-environment): Return #f instead of
  erroring under the interpreter, a bit more sane.

* libguile/goops.c (create_standard_classes):
* libguile/goops.h (scm_si_formals, scm_si_body, scm_si_compile_env):
* oop/goops.scm (method, initialize): Add `formals', `body', and
  `compile-env' slots to <method>.
2008-10-25 22:58:48 +02:00
Andy Wingo
02e720ff76 method is a defmacro.
* oop/goops.scm (method): Make into a defmacro.
2008-10-23 15:00:19 +02:00
Andy Wingo
56f952c682 define-method is a defmacro
* oop/goops.scm (define-method): Make into a defmacro -- didn't change
  any of the logic, but the logic is a bit dodgy (see the note in the
  source).
2008-10-23 14:56:17 +02:00
Andy Wingo
1d83f47eb0 define-generic, define-accessor are defmacros too
* oop/goops.scm (define-generic, define-accessor): Define as defmacros. I
  find their semantics to be a bit odd, though -- but the test case
  checks for this behavior, so we'll follow the test cases.
2008-10-23 14:24:57 +02:00
Andy Wingo
d31c5d197d make define-class' and class' into defmacros
* oop/goops.scm: Use srfi-1, as util.scm already does.
  (kw-do-map): New helper for processing keyword args.
  (define-class-pre-definition, define-class): Rework so that
  define-class is a defmacro without side effects. There are two
  functional differences: we don't check that define-class is called only
  at the toplevel, because defining a lexical class might makes sense,
  and defmacros don't give us the toplevel check that we would want.
  Second in the redefinition case, we don't do a `define', as we don't
  actually need a new variable.
  (class): Similarly, make `class' a defmacro.
2008-10-23 14:03:51 +02:00
Andy Wingo
ac0e91c42d (oop goops) works again, after (the-environment) removal
* oop/goops.scm: Update so as not to use (the-environment), which no
  longer exists. I think that the speed characteristics are the same,
  broadly speaking.
2008-09-30 20:29:35 +02:00
Kevin Ryde
6e7d5622ee merge from 1.8 branch 2006-04-16 23:37:40 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Neil Jerram
8378b269a6 Fix typo in comment 2005-04-24 12:29:14 +00:00
Mikael Djurfeldt
f12de0a178 * accessors.scm, simple.scm: New files.
* goops.scm (standard-define-class): Removed; Export
define-class as standard-define-class.
2005-03-24 10:23:17 +00:00
Marius Vollmer
f7aaa3b300 (class-of): Changed from being re-exported to just
being exported.
2005-01-18 15:00:44 +00:00
Marius Vollmer
3a43b605b8 (compute-get-n-set): Use '#:' in error message instead of ':'. Thanks
to Richard Todd!
2004-01-12 17:28:30 +00:00
Mikael Djurfeldt
05a6b2d3cc * goops.scm (compute-getters-n-setters): Allow for primitive
procedure thunks.  (Thanks to Neil W. Van Dyke.)
2003-04-20 17:35:41 +00:00
Mikael Djurfeldt
47cd67db2f * tests/goops.test: Added tests for correctness of class
precedence list in all basic classes and tests for eqv? and
equal?.

* goops.scm (compute-getters-n-setters): Check for bad init-thunk.
(eqv?): Added default method.
(equal?): New default method which uses eqv?.

* eq.c (scm_eqv_p): Turned into a primitive generic.
2003-04-17 19:23:52 +00:00
Mikael Djurfeldt
266f3a23d7 * goops.scm (compute-getters-n-setters): Check for bad init-thunk. 2003-04-17 17:37:11 +00:00
Mikael Djurfeldt
466dd85969 Comment 2003-04-17 15:24:53 +00:00
Mikael Djurfeldt
58241edc7d * tests/goops.test: Added tests for class redefinition, object
update and active slots.

* goops.scm (compute-getter-method): For custom getter: Check
boundness even if there is an init-thunk.  (The getter can return
#<unbound> even if the slot has been set before.)
(remove-class-accessors!): Also remove accessor-method from its
accessor.

* goops.c (scm_sys_fast_slot_ref): Use SCM_SLOT instead of
scm_at_assert_bound_ref.  (We don't want the unbound check.  See
oop/goops/active-slot.scm.)
2003-04-15 01:17:36 +00:00
Mikael Djurfeldt
e1ac894c38 Fix 2003-04-14 20:12:40 +00:00
Mikael Djurfeldt
21ab2aeb77 * goops.scm (compute-getters-n-setters/verify-accessors): Better
check of format of value returned by compute-get-n-set.
(compute-getters-n-setters): Extended format of slot
getters-n-setters to indicate position and size of slot memory
allocated in instances.

* goops.c (scm_sys_prep_layout_x): Instance allocation is now
indicated through extra fields in getters-n-setters.
(scm_add_slot): Adapted to new format of getters_n_setters slot.
(Thanks to Andy Wingo.)
2003-04-13 14:48:35 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Mikael Djurfeldt
e6726828ca * goops.scm (process-class-pre-define-accessor): Temporary kludge
to fix a problem introduced by my previous change.
2003-03-19 14:50:20 +00:00
Mikael Djurfeldt
c31142eefd * goops.scm (process-class-pre-define-generic,
process-class-pre-define-accessor, process-define-generic,
process-define-accessor): New functions.
(define-class-pre-definition): Use
process-class-pre-define-generic and
process-class-pre-define-accessor; Make sure not to create a new
local variable if the variable has been imported.
(define-generic): Use process-define-generic.
(define-accessor): Use process-define-accessor.
2003-03-17 13:53:58 +00:00
Mikael Djurfeldt
c9fa174805 * goops.scm (merge-generics): Make sure not to merge a gf with
itself.  That would be the cause of a real binding collision.
2003-03-12 18:41:44 +00:00
Mikael Djurfeldt
b0dff01890 Indentation 2003-03-11 19:55:00 +00:00
Mikael Djurfeldt
f8af5c6d35 * goops.scm (define-extended-generics): New syntax.
(<class> <operator-class> <entity-class> <entity>): Marked as
replacements.
(upgrade-accessor): Renamed from upgrade-generic-with-setter.
(ensure-accessor, upgrade-accessor): Rewritten to accomodate the
new <accessor> class.
(merge-accessors): Provide for merging of accessors imported from
different modules under the same name.

* goops.c, goops.h (scm_class_accessor_method): Renamed from
scm_class_accessor.
(scm_class_accessor): New class.
2003-03-11 14:50:08 +00:00
Mikael Djurfeldt
f595ccfefc * srfi-1.scm (iota map for-each map-in-order list-index member
delete delete! assoc): Marked as replacements.

* goops.scm (define-extended-generics): New syntax.
(<class> <operator-class> <entity-class> <entity>): Marked as
replacements.

* boot-9.scm (module-override!, make-mutable-parameter,
lookup-duplicates-handlers, default-module-duplicates-handler):
New functions.
(process-duplicates): Don't call duplicates handlers for duplicate
bindings of the same variable.
(process-define-module): Process #:replace.
(compile-interface-spec, resolve-interface): Process #:prefix.

* format.scm (format): Marked as replacement.

* threads.scm (future, future-ref): Marked as replacements.
2003-03-10 23:18:05 +00:00
Mikael Djurfeldt
7b07e5efb6 * boot-9.scm (process-define-module): Handle #:duplicates.
(module-use-interfaces! process-duplicates): New functions.
(duplicate-handlers): Dictionary of duplicate handlers.
(module-symbol-local-binding, module-symbol-binding): Bugfix.

* goops.scm (equal?): Define default method.
(merge-generics): Provide for merging of generic functions
imported into a module under the same name.
2003-03-07 13:12:47 +00:00
Mikael Djurfeldt
a48d60b1c0 * srfi-1.c (scm_init_srfi_1): Extend root module map and for-each
with the versions in this module using
scm_c_extend_primitive_generic.

* goops.scm (equal?): Define default method.

* goops.c (scm_primitive_generic_generic): Enable primitive
generic if not enabled.
(scm_sys_goops_loaded): Setup unextended primitive generics.

* goops.c, goops.h (scm_c_extend_primitive_generic): New function.

* snarf.h (SCM_PRIMITIVE_GENERIC, SCM_PRIMITIVE_GENERIC_1): New
snarf macros.

* numbers.c (scm_abs): Use SCM_PRIMITIVE_GENERIC.  (This is only a
testing example.  All uses of SCM_GPROC should be converted.)

* procprop.c (scm_stand_in_scm_proc): Use scm_assq instead of
scm_assoc.

* eq.c (scm_equal_p): Turned into a primitive generic.
2003-03-06 12:51:57 +00:00
Mikael Djurfeldt
27b32aad49 * goops.scm (method): Construct a new copy of the constant '('())
for every macro invocation.
2003-01-18 19:07:38 +00:00
Mikael Djurfeldt
bbf8d52350 * goops.scm (upgrade-generic-with-setter,
compute-new-list-of-methods): Use methods slot directly instead of
generic-function-methods.
(upgrade-generic-with-setter): Handle <extended-generic>:s.
(define-extended-generic): New syntax.
(make-extended-generic): New function.

* goops.c, goops.h (scm_class_extended_generic_with_setter): New
class.
(scm_compute_applicable_methods): Use scm_generic_function_methods.

* goops.c (scm_generic_function_methods): Support extended
generic functions.
2003-01-08 13:24:41 +00:00
Dirk Herrmann
9089f73c52 * goops.scm (standard-define-class): Changed definition to form
a 'real' macro definition.
2002-11-16 16:29:06 +00:00
Dirk Herrmann
33e04d5492 * oop/goops.scm (define-generic, define-accessor): Make sure that
define-generic and define-accessor will continue to work when
mmacros are expanded before execution.

* test-suite/tests/goops.test: Added tests for define-generic and
define-accessor.
2002-07-13 09:44:39 +00:00
Dirk Herrmann
9f04540330 * oop/goops.scm (define-class): Make sure that define-class will
continue to work when mmacros are expanded before execution.

* test-suite/tests/goops.test: Added tests for define-class.
2002-07-13 08:18:35 +00:00
Dirk Herrmann
9ffa41dbae * goops.scm (define-generic, define-accessor): Make sure that
implicit redefines only happen on top level.

* goops.scm (define-class, define-generic, define-accessor),
goops/stklos.scm (define-class):  Use mmacros instead of macros.
2002-07-08 20:40:32 +00:00
Mikael Djurfeldt
1a179b03b0 * lib.scm: Move module the system directives `export',
`export-syntax', `re-export' and `re-export-syntax' into the
  `define-module' form.  This is the recommended way of exporting
  bindings.

* srfi-2.scm, srfi-4.scm, srfi-8.scm, srfi-9.scm, srfi-10.scm,
srfi-11.scm, srfi-14.scm, srfi-16.scm: Move module the system
directives `export', `export-syntax', `re-export' and
`re-export-syntax' into the `define-module' form.  This is the
recommended way of exporting bindings.

* goops.scm, goops/active-slot.scm, goops/compile.scm,
goops/composite-slot.scm, goops/describe.scm, goops/dispatch.scm,
goops/old-define-method.scm, goops/save.scm, goops/util.scm: Move
module the system directives `export', `export-syntax',
`re-export' and `re-export-syntax' into the `define-module' form.
This is the recommended way of exporting bindings.

* slib.scm (array-indexes): New procedure.
(*features*): Extend.  (Probably some of these options should be
set elsewhere.)  (Thanks to Aubrey Jaffer.)

* and-let-star-compat.scm, and-let-star.scm, calling.scm,
  channel.scm, common-list.scm, debug.scm, debugger.scm,
  expect.scm, hcons.scm, lineio.scm, ls.scm, mapping.scm,
  null.scm, optargs.scm, poe.scm, popen.scm, pretty-print.scm,
  q.scm, r5rs.scm, rdelim.scm, regex.scm, runq.scm, safe-r5rs.scm,
  safe.scm, session.scm, slib.scm, streams.scm, string-fun.scm,
  syncase.scm, threads.scm: Move module the system directives
  `export', `export-syntax', `re-export' and `re-export-syntax'
  into the `define-module' form.  This is the recommended way of
  exporting bindings.
2001-10-21 09:49:19 +00:00
Marius Vollmer
5a3ea50184 Use re-export' instead of export' when re-exporting
`class-of'.
2001-06-04 22:18:12 +00:00
Marius Vollmer
c22adbeb3b Added exception notice to all files. 2001-06-03 23:32:27 +00:00
Marius Vollmer
51f7ef47f9 Fix missing paren. 2001-05-19 22:58:29 +00:00
Marius Vollmer
78ec533c40 Call `%init-goops-builtins' instead of using the
`(oop goops goopscore)' module.
2001-05-19 00:19:25 +00:00
Marius Vollmer
a524a03f87 (initialize-object-procedure): Use
`valid-object-procedure?' instead of explicit tag magic.
(object-procedure-tags): Removed.
2001-05-05 19:08:32 +00:00
Rob Browning
d3299bc330 * goops.scm (method): rename list* to cons*. 2001-04-28 17:18:06 +00:00
Mikael Djurfeldt
71d540f734 * goops.scm (define-method): Only accept new syntax.
* goops/old-define-method.scm: New file.

* goops.scm, goops/save.scm, goops/composite-slot.scm,
goops/active-slot.scm: Use new method syntax.
2001-03-10 03:09:50 +00:00
Mikael Djurfeldt
b432fb4b99 * goops/compile.scm (compile-method): Tag method closure for body
expansion.

* goops.scm (change-object-class): Quote empty list constants.
(method): Reverted previous change (enclosing body);
Quote empty list.
(initialize <method>): Supply `dummy-procedure' as default instead
of creating a new closure.

* goops/internal.scm: Re-export (oop goops) without copying
bindings.
2001-03-04 20:46:34 +00:00
Mikael Djurfeldt
cc6c7feea4 * goops.scm (change-object-class): Quote empty list constants.
(method): Reverted previous change (enclosing body);
Quote empty list.
(initialize <method>): Pre-expand the method closure.
2001-03-04 05:28:21 +00:00
Keisuke Nishida
19b6a58d52 * goops.scm (method): Enclosed BODY by `(let () ...)'.
This allows local defines at the beginning of methods.
2001-02-23 13:07:09 +00:00
Dirk Herrmann
ca83b028dc * Goops does not provide its own version of logand any more.
* Removed use of deprecated stuff from goops.
2000-11-24 10:55:23 +00:00
Mikael Djurfeldt
81211c73cc * goops.scm (internal-add-method!): Set n-specialized of a generic
function to the number of specializers regardless if it has rest
args or not.
2000-11-07 02:18:52 +00:00
Mikael Djurfeldt
14f1d9fec8 *** empty log message *** 2000-10-25 14:51:33 +00:00