From baca6eb4c6202df4d365d002c848c24f7df7aa62 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 13 May 2015 16:06:38 +0300 Subject: [PATCH] rename string to word --- lib/parfait.rb | 2 +- lib/parfait/string.rb | 6 ------ lib/parfait/word.rb | 12 ++++++++++++ lib/virtual/object.rb | 5 +++-- 4 files changed, 16 insertions(+), 9 deletions(-) delete mode 100644 lib/parfait/string.rb create mode 100644 lib/parfait/word.rb diff --git a/lib/parfait.rb b/lib/parfait.rb index e28d467c..72eb645d 100644 --- a/lib/parfait.rb +++ b/lib/parfait.rb @@ -4,7 +4,7 @@ require "parfait/module" require "parfait/class" require "parfait/dictionary" require "parfait/list" -require "parfait/string" +require "parfait/word" require "parfait/message" require "parfait/frame" require "parfait/space" diff --git a/lib/parfait/string.rb b/lib/parfait/string.rb deleted file mode 100644 index 05d1d7f9..00000000 --- a/lib/parfait/string.rb +++ /dev/null @@ -1,6 +0,0 @@ - - -module Parfait - class String < Object - end -end diff --git a/lib/parfait/word.rb b/lib/parfait/word.rb new file mode 100644 index 00000000..f0ec1c06 --- /dev/null +++ b/lib/parfait/word.rb @@ -0,0 +1,12 @@ + + +module Parfait + # A word is a a short sequence of characters + # Characters are not modeled as objects but as (small) integers + # The small means two of them have to fit into a machine word, iw utf16 or similar + # + # Words are constant, maybe like js strings, ruby symbols + # Words are short, but may have spaces + class Word < Object + end +end diff --git a/lib/virtual/object.rb b/lib/virtual/object.rb index 8cf50989..5218cb4d 100644 --- a/lib/virtual/object.rb +++ b/lib/virtual/object.rb @@ -7,7 +7,8 @@ module Positioned @position end def set_position pos - # resetting of position used to be error, but since relink and dynamic instruction size it is ok. in measures + # resetting of position used to be error, but since relink and dynamic instruction size it is ok. + # in measures (of 32) if @position != nil and ((@position - pos).abs > 32) raise "position set again #{pos}!=#{@position} for #{self}" end @@ -125,7 +126,7 @@ end Virtual::Object.new.padded_words(length()) end end -::Parfait::String.class_eval do +::Parfait::Word.class_eval do include Positioned def layout Virtual::Object.layout