2015-04-06 10:38:11 +02:00
|
|
|
|
2016-12-28 17:08:07 +01:00
|
|
|
# A NamedList is used to store local variables and arguments when calling methods.
|
2016-12-21 17:45:18 +01:00
|
|
|
# Also temporary variables, which are local variables named by the system
|
2015-04-08 19:24:50 +02:00
|
|
|
|
2016-12-21 17:45:18 +01:00
|
|
|
# The items are named (and typed) by the objects type instance. In effect the
|
|
|
|
# variables are like instance variables
|
2015-05-10 16:12:43 +02:00
|
|
|
|
2016-12-21 17:45:18 +01:00
|
|
|
# A Message with is arguments, and a NamedList make up the two sides of message passing:
|
2015-10-23 13:22:55 +02:00
|
|
|
# A Message (see details there) is created by the caller and control is transferred
|
2016-12-21 17:45:18 +01:00
|
|
|
# A NamedList is created by the receiver
|
2016-12-21 17:51:22 +01:00
|
|
|
# PS: it turns out that both messages and named_lists are created at compile, not run-time, and
|
2016-12-28 17:08:07 +01:00
|
|
|
# just constantly reused. Each message has two named_list object ready and is also linked
|
2015-07-01 18:27:18 +02:00
|
|
|
# to the next message.
|
2016-12-30 18:17:59 +01:00
|
|
|
# The better way to say above is that a message is *used* by the caller, and a named_list
|
2016-12-28 17:08:07 +01:00
|
|
|
# by the callee.
|
2015-05-10 16:12:43 +02:00
|
|
|
|
2016-12-21 17:45:18 +01:00
|
|
|
# Also at runtime Messages and NamedLists remain completely "normal" objects.
|
2016-02-25 21:03:11 +01:00
|
|
|
# Ie they have have type and instances and so on.*
|
2015-05-10 16:12:43 +02:00
|
|
|
# Which resolves the dichotomy of objects on the stack or heap. Sama sama.
|
2016-02-25 21:03:11 +01:00
|
|
|
#
|
|
|
|
# *Alas the type for each call instance is unique.
|
|
|
|
#
|
2015-05-11 17:55:49 +02:00
|
|
|
module Parfait
|
2016-12-21 17:45:18 +01:00
|
|
|
class NamedList < Object
|
2015-07-30 18:18:41 +02:00
|
|
|
|
2016-12-30 18:17:59 +01:00
|
|
|
def self.type_for( arguments )
|
|
|
|
my_class = Parfait.object_space.classes[:NamedList]
|
2016-12-31 13:51:06 +01:00
|
|
|
Type.for_hash( my_class , {type: my_class.instance_type}.merge(arguments))
|
2016-12-30 18:17:59 +01:00
|
|
|
end
|
2015-05-10 16:12:43 +02:00
|
|
|
end
|
2015-04-06 10:38:11 +02:00
|
|
|
end
|