I've had this idea rattling in my head to make a f...
# share-your-work
g
I've had this idea rattling in my head to make a frontend framework that's only signals, and after almost a year of maturation I finally put down some code today. Genuinely surprised this works. I'm curious where it starts to break down. It's not like modern frameworks are unaware of signals, most feature them heavily, so there's probably some reason they haven't gone all-in on them too, right? I'm using tldraw's lovely
signia
for signals implementation, hence the first param of atoms being a 'name' and not meaningful for execution. This also gave me an excuse to read `signia`'s source and discover their clever trick for tracking atom inheritance which is pretty neat.
a
It looks a little like a logic programming approach to web UI. Not sure how much that's coincidental...
l
Awesome! I'll pass this on to David and the rest of the team. It's been really great to hear David's thoughts on signals, and how signia came to be, and the unique approach that it takes! I still think that the signia docs gives one of the best explanations of what signals are. tldraw has to deal with a huge amount of state changes at high speed, which is why we needed signia (alongside React). We tried other libraries, but they all started to break down with tldraw's unusual use-case. (eg: memory leaks, eg: triggering too many recalculations, eg: too slow)
i
Solidjs is fairly popular and is built entirely around signals. https://www.solidjs.com
g
@Lu Wilson yeah David's work is great, I toyed with making my own signals first but couldn't crack the dependency problem. When I read
capture.ts
my jaw hit the floor! Such an elegant way to do it. I was afraid I'd find Proxy usage but not at all! I visited Steve in the office when we were in London last year and he was talking about what I now know is signia, seemed really excited about it, but I couldn't grasp the concept at the time. Glad I got to revisit and appreciate it, it's fun to use. @ibdknox I checked out Solid a while back but bounced off for some reason, I can't remember why. I'll read their docs again. Part of what I'm curious about is why the need for a compile step, why JSX syntax, etc. I'm curious to see if the needs which drove those features emerge in my own little experiment.
From a scan of their tutorials it was probably the magic that bothered me about Solid, like how computed signals are plain functions. Perhaps in practice it feels natural, but I have a strong preference for more native-feeling code.