|
This looks really cool. I need to dig through some more examples before I'd take anything I say without a massive grain of salt. :) Maybe I've been writing too much React and Android Compose UI lately, but instead of a declarative structure, have you considered a functional structure? That seems to be a create way to build composable components and add enough programmability (e.g. loops, conditionals) and keep a nice one-way flow down the line. Something like ```
import {Resistor, Signal, Ohms, Float} ... def VoltageDivider(totalR: Ohms, ratio: Float, signal1: Signal, signal2: Signal, signalOut: Signal) {
r1 = Resistor(totalR/ratio, signal1, signalOut)
r2 = Resistor(totalR(1-ratio),signal2,signalOut)
} def MyBoard() {
s1 = Signal()
s2 = Signal()
s3 = Signal()
div1 = VoltageDivider(totalR: 100_000, ratio:.33, signal1: s1, signal2: s2, signalOut: s3) } It's similar to what you have but maybe a bit more of a programming language than a declarative format. The trade-off is that tooling support gets harder as you add some basic language features, but the upside is a more powerful language. |