fixed, nay, hacked list problem
lists were in object space but not liked due to equality returning true
This commit is contained in:
parent
5b3045e42a
commit
0122585b3b
@ -140,6 +140,14 @@ module Parfait
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
# above, correct, implementation causes problems in the machine object space
|
||||
# because when a second empty (newly created) list is added, it is not actually
|
||||
# added as it exists already. TODO, but hack with below identity function
|
||||
def == other
|
||||
self.object_id == other.object_id
|
||||
end
|
||||
|
||||
#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
|
||||
|
@ -54,6 +54,7 @@ module Register
|
||||
begin
|
||||
link
|
||||
all= @machine.objects.sort{|a,b| a.position <=> b.position}
|
||||
# debugging loop accesses all positions to force an error if it's not set
|
||||
all.each do |objekt|
|
||||
puts "Linked #{objekt.class}(#{objekt.object_id.to_s(16)}) at #{objekt.position.to_s(16)} / #{objekt.word_length.to_s(16)}"
|
||||
objekt.position
|
||||
|
@ -3,8 +3,8 @@ require_relative "type"
|
||||
module Positioned
|
||||
def position
|
||||
if @position.nil?
|
||||
str = "IN machine #{Virtual.machine.objects.include?(self)}\n"
|
||||
raise str + "position not set for #{self.class} at #{word_length} for #{self.inspect[0...100]}"
|
||||
str = "IN machine #{Virtual.machine.objects.include?(self)}, at #{self.object_id.to_s(16)}\n"
|
||||
raise str + "position not set for #{self.class} len #{word_length} for #{self.inspect[0...100]}"
|
||||
end
|
||||
@position
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user