remove the value class
more of an idea, had no impact on implementation
This commit is contained in:
parent
fd519314cb
commit
f7e01ff05e
@ -2,7 +2,6 @@
|
||||
module Parfait
|
||||
end
|
||||
|
||||
require_relative "parfait/value"
|
||||
require_relative "parfait/integer"
|
||||
require_relative "parfait/object"
|
||||
require_relative "parfait/behaviour"
|
||||
|
@ -8,7 +8,7 @@
|
||||
# TODO how this idea works with Numeric ?
|
||||
|
||||
module Parfait
|
||||
class Integer < Value
|
||||
class Integer
|
||||
|
||||
# :integer?, :odd?, :even?, :upto, :downto, :times, :succ, :next, :pred, :chr, :ord, :to_i, :to_int, :floor,
|
||||
# :ceil, :truncate, :round, :gcd, :lcm, :gcdlcm, :numerator, :denominator, :to_r, :rationalize,
|
||||
|
@ -15,7 +15,7 @@
|
||||
module Parfait
|
||||
TYPE_INDEX = 1
|
||||
|
||||
class Object < Value
|
||||
class Object
|
||||
|
||||
# we define new, so we can do memory layout also at compile time.
|
||||
# At compile time we fake memory by using a global array for pages
|
||||
@ -46,7 +46,7 @@ module Parfait
|
||||
def get_internal_word(index)
|
||||
@memory[index]
|
||||
end
|
||||
|
||||
|
||||
# 1 -based index
|
||||
def set_internal_word(index , value)
|
||||
raise "failed init for #{self.class}" unless @memory
|
||||
|
@ -1,15 +0,0 @@
|
||||
# Values are _not_ objects. Specifically they have the following properties not found in objects:
|
||||
# - they are immutable
|
||||
# - equality implies identity == is ===
|
||||
# - they have type, not class
|
||||
|
||||
# To make them useful in an oo system, we assign a class to each value type
|
||||
# This makes them look more like objects, but they are not.
|
||||
|
||||
# Value is an abstract class that unifies the "has a type" concept
|
||||
# Types are not "objectified", but are represented as symbol constants
|
||||
|
||||
module Parfait
|
||||
class Value
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user