diff --git a/lib/parfait.rb b/lib/parfait.rb index 879db8bf..e28d467c 100644 --- a/lib/parfait.rb +++ b/lib/parfait.rb @@ -2,8 +2,8 @@ require "parfait/value" require "parfait/object" require "parfait/module" require "parfait/class" -require "parfait/hash" -require "parfait/array" +require "parfait/dictionary" +require "parfait/list" require "parfait/string" require "parfait/message" require "parfait/frame" @@ -43,7 +43,7 @@ class Parfait::Object end class Parfait::Class end -class Parfait::Array +class Parfait::List def length internal_object_length end diff --git a/lib/parfait/README.md b/lib/parfait/README.md index 2da34cca..d3106536 100644 --- a/lib/parfait/README.md +++ b/lib/parfait/README.md @@ -19,7 +19,7 @@ And thus parfait can be used at run-time. It's too simple: just slips off the mind like a fish into water. Parfait has a brother, the Builtin module. Builtin contains everything that can not be coded in ruby, -but we still need (things like array access). +but we still need (things like List access). #### Example: Message send diff --git a/lib/parfait/hash.rb b/lib/parfait/dictionary.rb similarity index 92% rename from lib/parfait/hash.rb rename to lib/parfait/dictionary.rb index da012110..5d569a85 100644 --- a/lib/parfait/hash.rb +++ b/lib/parfait/dictionary.rb @@ -1,10 +1,10 @@ -# almost simplest hash imaginable. make good use of arrays +# almost simplest hash imaginable. make good use of Lists module Parfait - class Hash < Object + class Dictionary < Object def initialize - @keys = Array.new_object() - @values = Array.new_object() + @keys = List.new_object() + @values = List.new_object() end def values() @values diff --git a/lib/parfait/layout.rb b/lib/parfait/layout.rb index 12a2a7b8..748a8624 100644 --- a/lib/parfait/layout.rb +++ b/lib/parfait/layout.rb @@ -14,8 +14,8 @@ # In other words, the Layout is a list of names that describe # the values stored in an actual object. -# The object is an array of values of length n and -# the Layout is an array of names of length n +# The object is an List of values of length n and +# the Layout is an List of names of length n # Together they turn the object into a hash like structure module Parfait diff --git a/lib/parfait/array.rb b/lib/parfait/list.rb similarity index 94% rename from lib/parfait/array.rb rename to lib/parfait/list.rb index 058679f6..4f81082c 100644 --- a/lib/parfait/array.rb +++ b/lib/parfait/list.rb @@ -1,10 +1,10 @@ module Parfait - class Array < Object + class List < Object # push means add to the end - # this automatically grows the array + # this automatically grows the List def push value self.set( length , value) end @@ -40,7 +40,7 @@ module Parfait index += 1 end end - #many basic array functions can not be defined in ruby, such as + #many basic List functions can not be defined in ruby, such as # get/set/length/add/delete # so they must be defined as CompiledMethods in Builtin::Kernel diff --git a/lib/parfait/space.rb b/lib/parfait/space.rb index e2db7ff5..5f143bd3 100644 --- a/lib/parfait/space.rb +++ b/lib/parfait/space.rb @@ -15,7 +15,7 @@ module Parfait # it is a collection of objects, some of which are data, some classes, some functions # The main entry is a function called (of all things) "main", This _must be supplied by the compling - # There is a start and exit block that call main, which receives an array of strings + # There is a start and exit block that call main, which receives an List of strings # While data ususally would live in a .data section, we may also "inline" it into the code # in an oo system all data is represented as objects @@ -24,7 +24,7 @@ module Parfait def initialize super() - @classes = Parfait::Hash.new_object + @classes = Parfait::Dictionary.new_object #global objects (data) @objects = [] @symbols = [] diff --git a/lib/virtual/object.rb b/lib/virtual/object.rb index c7c41b93..8cf50989 100644 --- a/lib/virtual/object.rb +++ b/lib/virtual/object.rb @@ -106,7 +106,7 @@ end Virtual::Object.new.padded_words(2) end end -Parfait::Hash.class_eval do +Parfait::Dictionary.class_eval do include Positioned HASH = { :names => [:keys,:values] , :types => [Virtual::Reference,Virtual::Reference]} def layout @@ -116,7 +116,7 @@ Parfait::Hash.class_eval do Virtual::Object.new.padded_words(2) end end -::Parfait::Array.class_eval do +::Parfait::List.class_eval do include Positioned def layout Virtual::Object.layout diff --git a/test/parfait/test_all.rb b/test/parfait/test_all.rb index bd0451aa..3ff168af 100644 --- a/test/parfait/test_all.rb +++ b/test/parfait/test_all.rb @@ -1,2 +1,2 @@ -require_relative "test_array" -require_relative "test_hash" +require_relative "test_list" +require_relative "test_dictionary" diff --git a/test/parfait/test_hash.rb b/test/parfait/test_dictionary.rb similarity index 95% rename from test/parfait/test_hash.rb rename to test/parfait/test_dictionary.rb index 495cee3f..5da9aa69 100644 --- a/test/parfait/test_hash.rb +++ b/test/parfait/test_dictionary.rb @@ -3,7 +3,7 @@ require_relative "../helper" class TestDictionary < MiniTest::Test def setup - @lookup = ::Parfait::Hash.new + @lookup = ::Parfait::Dictionary.new end def test_list_create assert @lookup.empty? diff --git a/test/parfait/test_array.rb b/test/parfait/test_list.rb similarity index 95% rename from test/parfait/test_array.rb rename to test/parfait/test_list.rb index 675ec45b..93db6b6a 100644 --- a/test/parfait/test_array.rb +++ b/test/parfait/test_list.rb @@ -3,7 +3,7 @@ require_relative "../helper" class TestList < MiniTest::Test def setup - @list = ::Parfait::Array.new_object + @list = ::Parfait::List.new_object end def test_list_create assert @list.empty?