https://futureofcoding.org/ logo
#share-your-work
Title
# share-your-work
g

Grant Forrest

07/10/2023, 1:17 AM
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

Andrew F

07/10/2023, 3:40 AM
It looks a little like a logic programming approach to web UI. Not sure how much that's coincidental...
l

Lu Wilson

07/10/2023, 6:18 AM
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

ibdknox

07/10/2023, 12:29 PM
Solidjs is fairly popular and is built entirely around signals. https://www.solidjs.com
g

Grant Forrest

07/10/2023, 12:35 PM
@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.
2 Views