Fake properties?

In seeing lots of nonPB code that I’d like to adapt, the number one “missing piece” is properties.

So given an object exampleObject, the ability to say

exampleObject.speed = 100
exampleObject.hue = .67

etc

Using arrays, I can fake this.

var exampleObject = array(5) // we can have 5 properties
propSpeed = 0
propHue = 1

Then

 exampleObject[propSpeed] = 100
exampleObject[propHue] = .67

I know @wizard just added array shortcuts
For example

arrayLength(a) ↔️ a.length

So I’m wondering if adding a dot mechanic for fake properties is doable

Ala
exampleObject.propSpeed
IF the engine can see .prop shortcut as the equivalent

Or even
exampleObject.Speed

Either of which become equiv to:

exampleObject[propSpeed]

I’m ok with having to fake it but it would be awesome to reduce the shim to a minimal
Setup.

Make sense?

And since an array can contain a function, we can fake classes the exact same way, so this would be a twofer.

exampleObject.Display(x)

which could be

exampleObject[propDisplay] = function myFunction(arg1) {return arg1 * 2}

(I think that’s the right format … I didn’t review the lamba version to refresh my mind)

1 Like

Ooh or just extend the arrayWhatever behavior?

Cause if I could do:

function arraySpeed(x) {
// My code here
}

And then exampleObject.Speed would call

arraySpeed(exampleObject)

Maybe that could be enough? Dunno. Still pondering.