AAVSO / VStar

VStar is a visualisation and analysis tool for variable star data brought to you by AAVSO
https://www.aavso.org/vstar
GNU Affero General Public License v3.0
9 stars 3 forks source link

Add maps/objects to VeLa #363

Open dbenn opened 1 year ago

dbenn commented 1 year ago

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.

dbenn commented 11 months ago

See also #201