Maps (dictionaries) are useful for all kinds of reasons.
Objects would be useful for encapsulating all the features of a ValidObservation, e.g. when used in a filter as well as in general coding. Nothing fancy. Just objects, potentially aggregating other objects vs inheritance or interfaces, although I wouldn't rule out interfaces, i.e. ADTs. So, more object-based than OO.
Add an object construct, starting with maps. Keys in maps can have any value at all, including functions. Some syntactic sugar may help to objectify, e.g.
m <- map { x: 2 f: function(n:int):int ... }
a <- m["x"]
a <- m.x -- same as above
b <- m.f(42)
Implicit or explicit reference to map/object available to map/object function calls (this, self, me, my)?
m <- map { x: 2 f: function(n:int):int { this.x*n } ) -- implicit
b <- m.f(42) -- 84
To achieve this, a function in an object could have a this variable -- m in this case -- added to the current scope.
Maps (dictionaries) are useful for all kinds of reasons.
Objects would be useful for encapsulating all the features of a
ValidObservation
, e.g. when used in a filter as well as in general coding. Nothing fancy. Just objects, potentially aggregating other objects vs inheritance or interfaces, although I wouldn't rule out interfaces, i.e. ADTs. So, more object-based than OO.Add an object construct, starting with maps. Keys in maps can have any value at all, including functions. Some syntactic sugar may help to
object
ify, e.g.Implicit or explicit reference to map/object available to map/object function calls (
this
,self
,me
,my
)?To achieve this, a function in an object could have a
this
variable --m
in this case -- added to the current scope.