SciProgCentre / dataforge-core

A clean multi-platform re-implementation of dataforge concepts
Apache License 2.0
25 stars 3 forks source link

Generate read-only variants of Scheme #73

Open altavir opened 2 years ago

altavir commented 2 years ago

The Scheme class allows wrapping mutable and read-only dynamic Meta trees and adding a statically typed layer to them. It is used quite extensively in Plotly.kt to allow observation of properties and dynamic changes.

Currently, Scheme is mutable by default and if used on read-only meta, it creates a mutable layer on top of the read-only base. The idea is to automatically generate a read-only version of mutable Scheme via compiler plugin and use it when SchemeSpec.read operation is used. The same plugin could be used to generate a descriptor from Scheme (#35).

The result could be probably achieved with KSP.

altavir commented 2 years ago

Read-only delegates could allow additional optimizations. Like caching obtained values.