Permalink
Browse files

Start moving stuff to kernel/

  • Loading branch information...
1 parent 46702c6 commit 0e91312f3883034f5010e34a2fb557ffc46f2429 @txus committed Jan 25, 2012
Showing with 305 additions and 8 deletions.
  1. +22 −0 kernel/object.ns
  2. +281 −0 kernel/object.nsc
  3. +1 −0 lib/noscript.rb
  4. +1 −8 lib/noscript/runtime.rb
View
22 kernel/object.ns
@@ -0,0 +1,22 @@
+# Object#put puts a value into a slot.
+Object.put = -> slot, value
+ ruby('__noscript_put__', slot, value)
+end
+
+Object.get = -> slot
+ ruby('__noscript_get__', slot)
+end
+
+# Object.clone = -> properties
+# obj = Object.ruby('class').ruby('new')
+# obj.ruby('__noscript_prototype__=', self)
+#
+# if properties
+# properties.inspect().puts()
+# properties.keys().each(-> k
+# properties.inspect().puts()
+# obj.put(k.ruby('to_sym'), properties.ruby('fetch', k))
+# end)
+# end
+# obj
+# end
View
281 kernel/object.nsc
@@ -0,0 +1,281 @@
+!RBIX
+962095474583808978
+0
+M
+1
+n
+n
+n
+i
+38
+45
+0
+1
+43
+2
+7
+3
+45
+4
+5
+56
+6
+49
+7
+1
+49
+8
+2
+15
+45
+0
+9
+43
+2
+7
+10
+45
+4
+11
+56
+12
+49
+7
+1
+49
+8
+2
+11
+I
+4
+I
+0
+I
+0
+I
+0
+I
+0
+n
+p
+13
+x
+7
+Runtime
+n
+x
+6
+Object
+x
+3
+put
+x
+8
+Function
+n
+M
+1
+p
+2
+x
+9
+for_block
+t
+n
+n
+i
+24
+58
+37
+19
+0
+15
+37
+19
+1
+15
+15
+20
+2
+5
+7
+0
+64
+20
+0
+20
+1
+49
+1
+4
+11
+I
+9
+I
+3
+I
+2
+I
+2
+I
+2
+n
+p
+2
+s
+E
+8
+US-ASCII
+16
+__noscript_put__
+x
+13
+noscript:call
+p
+5
+I
+1
+I
+4
+I
+a
+I
+3
+I
+18
+n
+p
+3
+s
+E
+8
+US-ASCII
+4
+slot
+s
+E
+8
+US-ASCII
+5
+value
+s
+E
+8
+US-ASCII
+4
+ruby
+x
+3
+new
+x
+16
+__noscript_put__
+n
+x
+3
+get
+n
+M
+1
+p
+2
+x
+9
+for_block
+t
+n
+n
+i
+18
+58
+37
+19
+0
+15
+15
+20
+1
+5
+7
+0
+64
+20
+0
+49
+1
+3
+11
+I
+7
+I
+2
+I
+1
+I
+1
+I
+1
+n
+p
+2
+s
+E
+8
+US-ASCII
+16
+__noscript_get__
+x
+13
+noscript:call
+p
+5
+I
+1
+I
+8
+I
+6
+I
+7
+I
+12
+n
+p
+2
+s
+E
+8
+US-ASCII
+4
+slot
+s
+E
+8
+US-ASCII
+4
+ruby
+p
+9
+I
+0
+I
+2
+I
+7
+I
+4
+I
+13
+I
+6
+I
+1a
+I
+8
+I
+26
+x
+16
+kernel/object.ns
+p
+0
View
1 lib/noscript.rb
@@ -12,6 +12,7 @@ module Noscript
require_relative 'noscript/code_loader'
CodeLoader.load_paths << File.expand_path('../noscript', __FILE__)
+ CodeLoader.run('kernel/object')
CodeLoader.run('kernel/traits')
CodeLoader.run('kernel/test_case')
View
9 lib/noscript/runtime.rb
@@ -100,6 +100,7 @@ def noscript_def(name, &block)
end
end
+# TODO: Move all noscript_defs to Noscript.
class Object
include Noscriptable
def noscript_send(name, *args)
@@ -128,14 +129,6 @@ def noscript_send(name, *args)
puts(*args)
end
- noscript_def("put") do |k, v|
- __noscript_put__(k, v)
- end
-
- noscript_def("get") do |slot|
- __noscript_get__(slot)
- end
-
noscript_def("ruby") do |*args|
send *args
end

0 comments on commit 0e91312

Please sign in to comment.