Moved PrimitiveMethod protocol to a separate src/mobius/primitive-method.slate since...
authorBrian T. Rice <briantrice@gmail.com>
Mon, 8 Mar 2010 22:44:44 +0000 (14:44 -0800)
committerBrian T. Rice <briantrice@gmail.com>
Mon, 8 Mar 2010 22:44:44 +0000 (14:44 -0800)
src/core/method.slate
src/lib/method.slate
src/mobius/prelude.slate
src/mobius/primitive-method.slate [new file with mode: 0644]

index 0be2499..c471b75 100644 (file)
@@ -24,11 +24,6 @@ s@(Symbol traits) sendWith: x with: y
 s@(Symbol traits) sendWith: x with: y with: z
 [s sendTo: {x. y. z}].
 
-m@(PrimitiveMethod traits) applyTo: args
-[
-  error: 'The Slate VM currently does not support #applyTo: calls on PrimitiveMethods.'
-].
-
 m@(Method traits) replaceWith: newM on: args
 "Uninstall the given method from the arguments, which need to be those holding
 the actual role entries pointing to that method for dispatch, and then define
@@ -469,23 +464,3 @@ TODO: Improve the documentation, and add examples."
       [TODO: 'Implement multi-argument swing.'
        "[| *args | m applyTo: {args last} ; args allButLast reversed]"]
 ].
-
-m@(PrimitiveMethod traits) method
-[
-  m
-].
-
-m@(PrimitiveMethod traits) literals [#()].
-m@(PrimitiveMethod traits) selectors [#()].
-m@(PrimitiveMethod traits) code [Nil].
-m@(PrimitiveMethod traits) sourceTree [Nil].
-m@(PrimitiveMethod traits) registerCount [m arity].
-m@(PrimitiveMethod traits) inputVariables [m arity].
-m@(PrimitiveMethod traits) restVariable [Nil].
-m@(PrimitiveMethod traits) sourceTree [Nil].
-m@(PrimitiveMethod traits) heapAllocate [False].
-
-m@(PrimitiveMethod traits) definitionLocation
-[
-  'primitive:' ; m index printString
-].
index 8922c51..735f88b 100644 (file)
@@ -1,7 +1,5 @@
-
 "Method functions that are not needed in the bootstrap process"
 
 m@(Method traits) applySome: args@(Sequence traits)
 "Apply a block with as many arguments as it expects."
 [ m applyTo: (args first: m arity) ].
-
index 3552485..709d9bd 100644 (file)
@@ -18,6 +18,7 @@ code which is compiled in to the kernel image."
    'src/lib/platform'.
    'src/mobius/memory'.
    'src/mobius/disassemble'.
+   'src/mobius/primitive-method'.
    'src/mobius/types'.
    'src/lib/extlib'.
    'src/lib/repl' }) collect: #; `er <-* '.slate') do: #load: `er <- here.
diff --git a/src/mobius/primitive-method.slate b/src/mobius/primitive-method.slate
new file mode 100644 (file)
index 0000000..d9562b1
--- /dev/null
@@ -0,0 +1,23 @@
+"Protocol for PrimitiveMethod to be usable in the same ways as CompiledMethod."
+
+m@(PrimitiveMethod traits) applyTo: args
+[
+  error: 'The Slate VM currently does not support #applyTo: calls on PrimitiveMethods.'
+].
+
+m@(PrimitiveMethod traits) method [m].
+
+m@(PrimitiveMethod traits) literals [#()].
+m@(PrimitiveMethod traits) selectors [#()].
+m@(PrimitiveMethod traits) code [Nil].
+m@(PrimitiveMethod traits) sourceTree [Nil].
+m@(PrimitiveMethod traits) registerCount [m arity].
+m@(PrimitiveMethod traits) inputVariables [m arity].
+m@(PrimitiveMethod traits) restVariable [Nil].
+m@(PrimitiveMethod traits) sourceTree [Nil].
+m@(PrimitiveMethod traits) heapAllocate [False].
+
+m@(PrimitiveMethod traits) definitionLocation
+[
+  'primitive:' ; m index printString
+].