[HN Gopher] Lunatic is an Erlang-inspired runtime for WebAssembly
___________________________________________________________________
Lunatic is an Erlang-inspired runtime for WebAssembly
Author : sts153
Score : 194 points
Date : 2022-11-30 12:33 UTC (10 hours ago)
(HTM) web link (lunatic.solutions)
(TXT) w3m dump (lunatic.solutions)
| syrusakbary wrote:
| Damn, it Wasm runtimes week! haha (Wasmer first, then WasmEdge
| and now Lunatic!)
|
| Good to see Lunatic here, they have been doing great work on
| their runtime. Props to Bernard and team :)
| ConanRus wrote:
| canadianfella wrote:
| toastal wrote:
| Was interested, especially aiming to by language agnostic, then
| immediately not when I see all communications are exclusively via
| proprietary platforms.
|
| > Choosing proprietary tools and services for your free software
| project ultimately sends a message to downstream developers and
| users of your project that freedom of all users--developers
| included--is not a priority.
|
| -- Matt Lee
|
| This means if Discord or Microsoft (parent of GitHub) or Twitter
| (I guess) decide to delete or ban your account, you are by proxy
| banned from the project, Lunatic; this means Lunatic is not in
| control of the moderation of its community. This also requires
| all users must give up personal data to the corporations in order
| to participate. This also further drives a wedge between those
| that prefer the spirit of open source not just in the style of
| communication, but those that want it in the tools used to create
| it as well.
|
| This project isn't the only or first offender, but it's
| frustrating seeing this pattern pop up over and over and it needs
| to be called out every time. People care about their privacy more
| than ever. Interest in OSS has never been higher.
|
| We just witnessed yet another exodus off Twitter for federated
| plaforms like Mastodon and other platforms because folks don't
| want to deal with the whims of megacorporations. Everytime
| Microsoft or Microsoft GitHub make another questionable move,
| projects seek refuge on Codeberg/SourceHut/GitLab, or self-
| hosting. There are a non-negligible amount of folks that don't
| want this.
| cestith wrote:
| It is MIT licensed so one could host their copy or fork
| entirely elsewhere. It's available as a Rust crate, which
| doesn't seem to have the issues that concern you. The Discord
| part is a little harder to address. Contributing back to the
| code upstream could be difficult. Projects have moved before
| when corporate hosts proved problematic for either the
| maintainers or enough users, such as the exodus from
| Sourceforge. I have no doubt if Discord, Github, or Twitter
| become issues the project could move elsewhere, possibly to a
| private Gitea and to Mastodon. Right now, though, the
| maintainers are probably happy to use these services and not
| worry about maintaining production servers for it.
| toastal wrote:
| Use them, sure. Suppport them, sure. But require them, nah.
| Vendor lock on them, nah too.
| lolinder wrote:
| So you're suggesting that the maintainers should fragment
| their community by officially supporting Mastodon _and_
| Discord _and_ GitHub _and_ GitLab?
| cestith wrote:
| The community and their own time dealing with said
| community would both be fragmented. I have a feeling what
| they most want to do in maintaining the project is to
| spend time maintaining the project, not the
| infrastructure for distributing and supporting it.
| ghqst wrote:
| How often do people get banned from GitHub for reasons anyone
| would disagree with? (besides projects that are targeted for
| DMCA, but you seen to be talking about personal accounts being
| unable to participate in the community of an open source
| project)
| kotxig wrote:
| I wish they had called it something else. I hate to be that guy
| but you know, it's not that hard to be maybe just a little bit
| more thoughtful.
|
| https://www.bbc.com/news/magazine-17997413
| elteto wrote:
| It is not used in a context in which it is offensive. It's just
| a name. Maybe they just like looking at the moon a lot.
| sli wrote:
| This logic implies that one could name a project after an
| explicit slur and it being a project instead of a directed
| insult makes it no longer a slur. That doesn't track at all.
| dmitriid wrote:
| It does.
|
| A few years back a non-native English speaker presented an
| Erlang library called `coon` because he like this
| abbreviation of the word `raccoon`. [1]
|
| The shitstorm from Americans (US and Canada) was
| unbelievable. Even though:
|
| - most people on the mailing list where this was discussed
| never heard it used as a slur
|
| - people in the states where this word was purportedly
| still used as a slur never heard it used
|
| - several black people (both African Americans IIRC and a
| guy from South Africa) said they had no problems with the
| name (and promptly ignored)
|
| The name of the library was changed.
|
| Now. The question is: who decides it is a slur especially
| in our global world? Somehow, increasingly, it's the white
| Americans who end up being offended on everyone's behalf.
|
| See also: the performative activism around master/main
| branches in git.
|
| [1] Actual reasons: the name was available: https://github.
| com/comtihon/enot/issues/59#issuecomment-3651...
| felixgallo wrote:
| man, don't be ridiculous. 'coon' is objectively a long
| standing racist slur. That some people ("a guy from South
| Africa", ffs) claimed not to know this or notto have
| heard it personally doesn't make that untrue. I invite
| you to go to any black neighborhood in the US and chant
| 'coon' for as long as you can to determine just how
| performative the white americans are being. I'll take the
| short side of 30 seconds.
| dmitriid wrote:
| > coon' is objectively a long standing racist slur.
|
| In the US. Not even the whole of the US, but in some
| parts of the US.
|
| > That some people ("a guy from South Africa", ffs)
| claimed not to know this
|
| I wonder who is being a racist now. "South Africa ffs"
| and "claim not to know".
|
| The world is _much larger than the US_ and is not
| required to view everything through US issues.
|
| > I invite you to go to any black neighborhood in the US
|
| So, to quote myself: "The question is: who decides it is
| a slur especially in our global world? Somehow,
| increasingly, it's the white Americans who end up being
| offended on everyone's behalf."
| yamtaddle wrote:
| It also, "objectively", as you put it, just means
| "raccoon" more often than not.
| eigenrick wrote:
| The origin of the name comes from the fact that it started as a
| Lua project. In Lua (Portuguese for moon), everyone loves any
| "moon" related names or puns for their project. As such,
| "Lunatic" fits right in.
|
| As someone who has family members with mental health issues, I
| don't find the term offensive at all.
|
| I, for one, by default think more of someone who's obsessed
| with the moon, I guess it's because I never read that article,
| so I've never been told to be offended by it.
|
| All that said, I do hope that the authors understand that they
| might be fighting an uphill battle with regards to adoption.
| danpalmer wrote:
| Agreed. While it might be debatable whether it's explicitly
| offensive, it's at least a bit of a grey area and it
| immediately stood out to me as a poor choice of name.
|
| Whether you agree or not with the use of the term, names are
| part of communication, and communication that people are going
| to take issue with (rightly or wrongly) is going to have an
| impact on a product/project/business, and should probably be
| reconsidered, unless the point is to cause controversy or
| dogwhistle certain values.
|
| This name for example would probably rule out use at many
| companies, and I suspect many would choose not to publicise it
| with things like conference talks.
| lolinder wrote:
| The problem is that in the age of the internet, it's very
| difficult to find _anything_ that _someone_ , _somewhere_ won
| 't be offended by. Every time an organization or project
| gives in and alters its innocently-chosen name because a tiny
| minority takes offense, they further normalize outrageous
| outrage.
|
| It's definitely a fine line to walk. There are names that
| _originated_ in an offensive context, and it 's easier for me
| to see the objection to those. But "lunatic" hasn't been
| commonly used in its offensive sense in nearly a century, so
| I don't think it's fair to stoke outrage towards a project
| that _started_ in the 2020s and chose it for _extremely_
| innocent reasons.
| kotxig wrote:
| "should probably be reconsidered" isn't exactly outrage is
| it? We can have sensible discussions about appropriate
| naming without being extreme one way or the other, as much
| as the internet seems to hate moderate discussion.
| Quarrelsome wrote:
| Is it still that offensive? The linked article discusses a peak
| of the term around reform of 19th century "lunatic asylums"
| where the phrase was in common use and had dark connotations
| but aren't all those people dead now? Is the term still somehow
| problematic and if it is, doesn't that imply that words like
| "insane" have the same problem?
| pessimizer wrote:
| As far as I can tell, it's not offensive, and was never
| offensive. What can be offensive is using it as a term to
| refer to the mentally ill, especially in law - and it's
| really more antiquated than offensive even there. We have
| more specific and thoughtful terminology for varieties of
| mental illnesses now, that have nothing to do with the moon.
|
| So if you have a law on the books governing how to treat
| lunatics, or how lunatics should be treated, it's a dumb old
| law because there's no official test for lunatic. It would be
| just as stupid if you had laws about the "wacky" or the
| "nuts."
|
| The overwrought nature of the concern about seeing the word
| as the name of a piece of software is just a symptom of the
| current zeitgeist.
| jamil7 wrote:
| It's not offensive as much as it's kind of odd sounding, and
| would feel awkward pitching to someone else.
| kotxig wrote:
| I mean, I had to think about it. Whether it's hugely
| offensive or not isn't necessarily the right question here.
| With the whole English language to pick from there are
| probably better choices that are less ambiguous.
| Quarrelsome wrote:
| I personally worry somewhat about social-censure. Here's
| [1] a talk that asks (among other things) if Salman
| Rushdie's Satanic Verses would be published or even written
| today and I think that concern relates a little to our
| conversation. While its quite easy to see the argument for
| self/social censure (as usually someone is personally
| motivated to make it), I worry that the argument against it
| is much harder to see and has less organic advocates.
|
| [1] https://www.bbc.co.uk/iplayer/episode/p0dhrlhm/the-
| reith-lec...
| dmitriid wrote:
| > Whether it's hugely offensive or not isn't necessarily
| the right question here.
|
| It is the right question. If a term once considered
| offensive no longer is one, and there's no one who gets
| offended by it, is it still offensive?
|
| > With the whole English language to pick from there are
| probably better choices that are less ambiguous.
|
| Given infinite time and finite language, every term will
| become offensive. What then? Especially considering the
| euphemism treadmill
| https://en.wikipedia.org/wiki/Euphemism#Lifespan
| toqy wrote:
| Luckily most projects won't be around for infinite time
| bheadmaster wrote:
| Everything is "offensive" these days - anyone can claim
| anything is "offensive", and because it's subjective, it's
| impossible to even be proven wrong.
|
| The very word has lost all real meaning.
| yamtaddle wrote:
| Someone on here recently asserted that ditching the
| colloquial use of "crazy" had significant mainstream support.
| I pushed back on people even _noticing_ that it might be a
| problem, let alone actively choosing not to use it, being
| anything like a norm outside tiny niches of terminally-online
| Web users.
|
| Sure enough, sensitized to it, I heard an NPR host and a
| Chipotle ad use it in the colloquial sense within the next
| week. And those are just the ones I noticed, and that were
| very-public rather than in private conversations.
|
| This stuff's not mainstream and normal people don't care a
| bit. It's not even caught on in groups worried about
| impressing the word-police crowd (major advertisers and NPR
| both qualifying, I should think).
| kotxig wrote:
| definition of "lunatic" - "a person who is mentally ill (not
| in technical use)."
|
| I didn't say it was offensive. If it was called "autistic",
| the word is not offensive but... why? It's just a really
| strange choice.
| bheadmaster wrote:
| > why? It's just a really strange choice.
|
| I personally thought it was a witty name. Had a tiny mental
| chuckle when I read it.
|
| Better question is, why not? If it's not offensive, then
| what is the reason you "wish they had called it something
| else"?
|
| > It's just a really strange choice
|
| Doesn't sound like a real criticism to me...
| kotxig wrote:
| Let's just put it this way, I'm not advertising in
| anything associated with my professional credibility that
| I use "lunatic", for the very obvious reason that it's
| possibly offensive to some people and that the word
| offers nothing to convey meaning. I don't have to find it
| personally offensive to not want to associate with it.
| thingification wrote:
| I can understand that as a heuristic.
|
| On the other hand, there are other people who might apply
| a different heuristic and guess that a project named
| 'lunatic' is less likely to attract the sort of people
| who might take, for example, a code of conduct as a tool
| to beat other contributors about the head. (I'm not
| saying that's you!)
|
| I guess there are "swings and roundabouts" and peoples'
| rules of thumb differ, which is perhaps diversity that's
| all to the good.
| kotxig wrote:
| I think brainf*k is a great example of a potentially
| offensive name that actually conveys meaning and doesn't
| harm adoption by its intended audience.
| thingification wrote:
| To me (without reading any of their stuff, I don't know
| if this is what they were shooting at), "lunatic" makes
| me think "high performance" and "this is a very difficult
| project with high payoff if we succeed, we're a little
| bit crazy (in a good way) to try, eh?".
| dmitriid wrote:
| > definition of "lunatic" - "a person who is mentally ill
| (not in technical use)."
|
| Have you, your relatives or your friends ever used the
| phrases "are you insane?" and "are you out of your mind"?
| Were they being insesitive. Should you/they be more
| thoughtful how it would be perceived by other people, that
| you/they so casually use a very modern (and not 19th
| century) refernces to mental illness?
|
| What about, I don't know, Insane Clown Posse who formed in
| 1989 and won Outstanding Hip-Hop Artist/Group at Detroit
| Music Awards? They probably need to re-think their name,
| too?
|
| Looney Tunes? (Looney is the same as Lunatic) Or looking at
| some of the adjacent terms, perhaps Animaniacs?
|
| The list just goes on. And on. And on. AND ON.
| goodpoint wrote:
| > Everything is "offensive" these days
|
| Spare us the BS. Society is very much able to form opinions
| on what is widely considered offensive and what is not.
|
| Case in point: legal proceedings for libel, threats and so
| on. Turns out society still gives meaning to words.
|
| > it's impossible to even be proven wrong
|
| You've been proven wrong right now.
| bheadmaster wrote:
| > Society is very much able to form opinions on what is
| widely considered offensive and what is not.
|
| Except there isn't an agreed upon opinion, just a certain
| number of loud individuals trying to silence others, and
| everyone else who just quietly don't care.
|
| > You've been proven wrong right now.
|
| I was saying that it's impossible to prove that something
| _isn 't_ offensive. Please take your time to actually
| understand posts you read before posting angry comments.
| goodpoint wrote:
| > Except there isn't an agreed upon opinion, just a
| certain number of loud individuals trying to silence
| others
|
| Again you are trying to make a strawman, claiming that
| it's just some minority and you are so brave for standing
| up to them.
|
| It isn't. Open a dictionary and you'll find a number of
| words clearly defined as offensive.
|
| Language isn't just an opinion of few people.
|
| > I was saying that it's impossible to prove that
| something isn't offensive. Please take your time to
| actually understand posts you read before posting angry
| comments.
|
| Spare us the BS.
| lolinder wrote:
| The article you link to discusses "lunatic" being offensive
| when used in law in its original sense to refer to real people
| with real mental health problems. Whether _that_ is offensive
| (and I think it probably is) is a completely different question
| from whether its modern, colloquial use is offensive.
|
| The word dramatically declined in popularity through the 19th
| century but started climbing again after ~1995[0]. The recent
| increase in usage is driven entirely by a much milder,
| colloquial meaning of "wildly foolish"[1].
|
| I think being offended because our great-grandparents used the
| word literally is a bit silly.
|
| [0]
| https://books.google.com/ngrams/graph?content=lunatic&year_s...
|
| [1] Meriam Webster identifies the older meaning as "dated":
| https://www.merriam-webster.com/dictionary/lunatic
| macintux wrote:
| Interesting. A huge part of the Erlang value proposition is that
| the language and runtime are designed to complement each other,
| and both have significant constraints imposed by the language
| design.
|
| Taking half of that equation, and supporting any language, feels
| like you're missing a big part of the benefit.
| klohto wrote:
| How exactly is Erlang complimenting BEAM in a way that Elixir,
| for example, doesn't?
| macintux wrote:
| The other languages that work with the BEAM are all roughly
| equivalent. I failed to be explicit, but as weatherlight
| indicated, languages like Ruby will never work on it.
| klohto wrote:
| But your argument is "supporting any language". Lunatic
| isn't supporting any language, the language has to be
| compatible with WebAssembly for all the reasons you and
| weatherlight stated.
| lolinder wrote:
| Erlang/Elixir+BEAM is a tightly integrated ecosystem
| where the sensibilities of the language(s) and the
| sensibilities of the runtime mesh perfectly. Both
| language and runtime are highly opinionated, and their
| opinions are identical.
|
| WASM is the opposite of opinionated. It was designed to
| be a compilation target for _everything_. Almost every
| language is working on supporting WASM, and that 's
| exactly what WASM was intended for. Because Lunatic is
| built around WASM, it _does_ support any language,
| because that 's what WASM set out to do.
| weatherlight wrote:
| Not to be pedantic but Ruby has webassembly support,
| still won't work on the BEAM.
|
| https://github.com/artichoke/artichoke
| macintux wrote:
| You're correct, and it's entirely possible that a
| language that targets WebAssembly must be designed in a
| way that makes this a useful addition to the ecosystem.
|
| I just get skeptical when people try to retrofit an
| existing language/platform to act like FP in general, or
| Erlang in particular.
| spinningslate wrote:
| I read the "Erlang inspired" more narrowly. Specifically, it's
| about supporting large numbers of efficient, isolated
| processes. So there's a single, well-understood concurrency
| primitive: the (lunatic) process.
|
| Having written concurrent code in Erlang, C# and Python, I'd
| view above as a win. A big win. Concurrency decisions in Erlang
| are simple: if things need to run concurrently, spawn them in
| different processes. If they're sequential, put them in a
| function. That's it.
|
| In C# and Python it's nowhere near as straightforward. Do you
| use OS processes? Threads? Async/Await? Each has different
| strengths; each also has significant weaknesses.
|
| So: a new runtime that aims to bring Erlang's simple, powerful
| and scalable concurrency model to any language that targets
| WebAssembly is, at the very least, interesting. It doesn't need
| to have all the wider benefits of OTP, or the symbiosis of
| Erlang and the BEAM. (Though that's great too obviously).
| pessimizer wrote:
| Elixir, LFE, etc. seem to work fine for the people who enjoy
| them.
|
| https://github.com/llaisdy/beam_languages
|
| LFE is Virding's himself, and has been around for longer than
| Erlang has been popular: _Robert Virding - LFE - a lisp flavour
| on the Erlang VM (Lambda Days 2016)_
|
| https://www.youtube.com/watch?v=Br2KY12LB2w
|
| Edit: _Implementing Languages on the BEAM - Robert Virding -
| London Erlang User Group_
|
| https://www.youtube.com/watch?v=qm0mbQbc9Kc
| weatherlight wrote:
| I think you're missing the point. All these languages are
| functional programming languages, have structural pattern
| matching and share the same types. The types of languages you
| can develop on the beam are very restrictive. For example,
| you'll never get Ruby or Java to work on the BEAM VM.
|
| let's look at garbage collection.
|
| How does tradition stop the world, Mark-and-sweep garbage
| collection work on the BEAM? it doesn't really.
|
| Each process on the beam has its own garbage collection algo,
| because processes can't share memory, garbage collection on
| one process can happen without disrupting any other process.
|
| https://www.erlang.org/doc/apps/erts/garbagecollection
| throwawaymaths wrote:
| > For example, you'll never get Ruby or Java to work on the
| BEAM VM
|
| Uhm, several ways:
|
| 1. Bind the VM in as a C FFI artefact
|
| 2. Write your ruby or Java bytecode emulator to run on one
| Erlang process only. Since Java supports threads, each
| thread could live on a different process, any shared memory
| would live on an Ets table.
|
| "never" is a strong word. The reason why people don't do it
| is that it's _not worth it_.
|
| I believe riak embeds javascript in the erlang VM. You can
| imagine why that might be worth it.
| weatherlight wrote:
| and then you have a a kernel panic and bring down the
| entire VM. That doesn't work and totally defeats the
| whole point of having a VM, 9 9s or reliability, etc.
| Having a bunch of FF/NIFs in C to get around the VM is
| really missing the point.
| throwawaymaths wrote:
| Yeah nice job eluding point #2
| weatherlight wrote:
| Then what's the point of the beam then? you can have the
| beam, but you can't have concurrency?
|
| I *could* eat soup with a paper airplane, I'm really not
| understanding how any of this is viable solution to
| implementing something like ruby on the BEAM VM. What
| would the performance hit be for using ETS for all your
| state? You'd just be better off using MRI for Ruby.
| throwawaymaths wrote:
| You're the one that suggested it, but I'll bite: you
| might want to embed say ruby in BEAM if you wanted to
| take advantage of hashicorp terraform. Perhaps you want
| to support middleware or a query system in another
| language but have the bulk of your architecture be BEAM.
| You might want to deduplicate internal libraries shared
| between teams. You might want to use a 3rd party library
| written in one of these langs. You might want to
| transition between lang X and a beam lang and what you
| need is to leakily expose BEAM modules using shim code as
| an intermediate. You might just be crazy and want to do
| weird shit for fun.
| quechimba wrote:
| Why can't you have concurrency?
| dathinab wrote:
| also given that it's Wasm GC performance/characteristics
| aren't grate so it's best suited for non GC language (for
| now, it's changing, also JIT doesn't work grate either as
| it's designed for AOT, through interpreted languages can
| work just fine and for such limitations wrt. how you can
| write GCs might be less of an problem).
| jeremyjh wrote:
| Those languages have the same semantics as Erlang in many
| important respects. For example, there are no mutable
| variables in any of those languages. They all have the same
| concurrency model, the same memory management etc.
| throwawaymaths wrote:
| Nothing stopping anyone from building mutability into an
| Erlang based language:
|
| https://youtu.be/5EtV2JUU0Z4
| Defletter wrote:
| Does Lunatic have a starter / example project?
| taldridge wrote:
| There's some things: - https://github.com/lunatic-
| solutions/chat - https://github.com/lunatic-
| solutions/submillisecond/tree/mai...
| Quarrelsome wrote:
| hang on, what part of the web assembly stack is this competing
| with exactly? I'm likely just very ignorant on how Web Assembly
| works but I don't understand exactly how it fits. Do browsers
| have pluggable hooks for interpreting web assembly that you can
| swap out for this or smth? Or are we talking about running
| WebAssembly on the server here?
| chairmanwow1 wrote:
| My understanding is using web assembly isolation to execute
| arbitrary untrusted code in a different (non-browser) env
| Quarrelsome wrote:
| So like what node.js is to javascript in the browser? For
| whatever reason I had mistakenly thought that web-assembly
| was purely a front-end browser thing.
| dathinab wrote:
| > mistakenly thought that web-assembly was purely a front-
| end browser thing
|
| WASM has well defined boundaries and with WASI it adds some
| none browser APIs (but still sandboxed).
|
| It's used a lot for:
|
| - edge computing
|
| - plugin systems (or sandboxing)
|
| - easier cross platform code by targeting wasm (for code
| which is logically well-enough isolated you can compile it
| to wasm once end then just use it pretty much anywhere
| (web, app, desktop, server, edge, smarttv) reliable without
| having to worry about security or cross platform
| constraints.
|
| - easier auto updating/ever green apps (e.g. I remember
| vaguely to have heard Disney+ does put all their core
| business logic into a wasm blob to for both easy cross
| platform and auto updating of some parts)
|
| Lunatic doubles down one the server focused easy cross
| paltform + sandboxed aspects potentially deployed at the
| edge. But I also have seen people use a library wasm-
| runtime to embed a program written as
| stdin->dostuff->stdout CLI app into a go program without
| having to bother with cgo or cross platform support of the
| CLI app.
| letmeinhere wrote:
| Yeah, this is one of many non-browser runtimes, e.g. see
| https://github.com/appcypher/awesome-wasm-runtimes
|
| Lunatic is more opinionated than most of these or node,
| though, in that it's trying to emulate a particular
| concurrent system design pattern borrowed from Erlang/BEAM.
| thingification wrote:
| Idly dreaming here, without enough understanding to even know how
| much this makes sense in this context, of:
|
| - Erlang-style concurrency (which I haven't tried so don't
| understand but hear good things about always)
|
| - With "platform" level capability security...
|
| - ... and language-level capability security
|
| - But with a sound and expressive type system like F# or similar
|
| - Oh, and garbage collection
| LAC-Tech wrote:
| From the FAQ:
|
| _Each process has its own stack, heap, and even syscalls. If one
| process fails, it will not affect the rest of the system. This
| allows you to create very powerful and fault-tolerant
| abstraction._
|
| _This is also true for some other runtimes, but Lunatic goes one
| step further and makes it possible to use C bindings directly in
| your app without any fear. If the C code contains any security
| vulnerabilities or crashes, those issues will only affect the
| process currently executing the code. The only requirement is
| that the C code can be compiled to WebAssembly._
|
| So as I understand it, an Erlang process can "crash" from an
| Erlang perspective and it's fine (and even encouraged!), but if
| it crashes from a system perspective (segfault or some such), it
| takes down all neighbouring processes as well - usually an issue
| when using foreign libraries.
|
| With this set up, one of your erlang processes can segfault and
| it's fine?
|
| I have to admit I'm not across using WASM as a general purpose
| backend.
| 83457 wrote:
| If they need a theme song.
|
| https://youtu.be/uqUa_G1h3pw
| bkolobara wrote:
| I'm Bernard, the creator of lunatic. Great to see us back on HN
| and happy to answer any questions!
|
| We have been busy pushing out a lot of new stuff. Recently we
| released a web framework [0] for Rust building on top of lunatic,
| and a live-view library [1] for crating full stack apps in Rust
| without JS. For now we are staying close to the Phoenix LiveView
| implementation, where everything is rendered on the backend and
| just a diff is sent over websockets to the frontend. But a big
| advantage of Wasm is that it runs in the browser too, so we hope
| to leverage this part to move some of the logic directly into the
| browser, like form checking, or offer a way to create offline-
| first experiences with the backend running as PWA in a service
| worker.
|
| [0]: https://github.com/lunatic-solutions/submillisecond
|
| [1]: https://github.com/lunatic-solutions/submillisecond-live-
| vie...
| mr_luc wrote:
| Ooh, LiveView pattern implementors! I have a question -- I've
| been tinkering with a custom Phoenix LV client in my 'shop
| time', so I wanted to ask: are you doing your diffs on a
| string-based representation, like they do in the internal
| Phoenix LV protocol? Or are you sending the DOM patches?
|
| In the phx protocol, their diffs depend on having split the
| render into a tree of 'statics', 'dynamics', 'components', and
| on each change, that structure is patched, and needs to be
| recursively zipped to a string, parsed into a DOM, and patches
| computed against the previous DOM.
|
| I've been playing with a new client as a way of understanding
| it, and it's definitely a certain amount of work! Fortunately
| computing 'what needs to change to reconcile 2 html-like DOMs'
| is a project that's been wrapped into libraries a few times in
| a few languages (phoenix relies on other people having done
| that too, via the 'morphdom' library in JS, and Dockyard
| recently open-sourced an ergonomic Rust library I'm using in my
| client).
|
| So -- it's a lot of client work, but it optimizes for
| bandwidth. Cool.
|
| But I've wondered if there could be any benefit to optimizing
| for granularity of patches, and simpler clients -- by sending
| 'just the patches', ie the list of DOM operations that cause
| the desired end state. My intuition is that the bandwidth
| 'cost' would be prohibitive, because the list of patches
| required to perform the morph could be quite large for a change
| that appears small in 'what string has changed' terms. (maybe
| harder to debug, too? lots of trade-offs)
|
| I just don't have the energy to try it that way too, hehe, on
| the off chance that my intuition is off base and it'd actually
| help improve things (simpler clients, and maybe the bandwidth
| hit wouldn't be too bad?); it'd require deep server changes as
| well, when up until now I've only been writing a client. So I
| was curious what approach y'all are taking.
|
| Prior/related art in the Rust space: I know there's a non-
| Phoenix liveview project, 'dioxus', with a generic DOM liveview
| implementation that several clients have been created for, by
| making a state machine that operates on that list of generated
| Patches; however I don't know what that one sends, whether DOM
| patches directly, or Phx-style diffs that need to go phxDiff ->
| zippedUpString -> dom -> morphPatches -> applyToDom.
| bkolobara wrote:
| We take the Phoenix approach of splitting the DOM into static
| and dynamic parts. In fact, we even re-use the pheonix.js
| library on the frontend, so we just implement the backend
| part that speaks the same protocol as Phoenix.
|
| I don't think that sending DOM patches directly would have a
| significant higher bandwidth cost, but it would have higher
| "implementation" cost for us. That's why we choose to just
| use an existing "battle tested" library.
| quechimba wrote:
| I have implemented a VDOM in Ruby which I use to send patches
| to the browser. It works really well.
|
| I'm currently playing around with signals as in SolidJS. That
| would result in more granular updates, but it's not as easy
| to implement.
| johnisgood wrote:
| How are you going to implement hot reloading, or when can we
| expect it to be ready?
| titzer wrote:
| I'm curious about this part:
|
| > This allows it to decide on a per process basis what syscalls
| are going to be forwarded to the operating systems.
|
| 1. Which system calls are being referred to here?
|
| 2. Does Lunatic follow WASI's capability-based filesystem
| access?
| bkolobara wrote:
| 1. You can limit almost anything, file system usage (fopen,
| write, ...), networking i/o, how much memory can be used,
| message sending, the capability of spawning child processes,
| etc.
|
| 2. Yes
| VikingCoder wrote:
| Neat. Good luck. I'll paste here the request I keep making
| again and again:
|
| I want to teach something like Tailscale about my contacts, so
| they are allowed to communicate with my services (through their
| services).
|
| Then I want to run an app inside a strong sanbox (maybe
| Lunatic?) that has capability-based APIs to do things kind of
| like ZeroMQ for sending messages TO THE CONTACTS. I don't want
| the API to look like a tcp/ip or udp connection. I want the app
| to think it's sending a message to a contact I've given it
| permission to talk to, via some interface that Lunatic itself
| provides.
|
| If this was running in a strong sandbox, I think this would be
| an awesome way to develop and use simple federated apps. If
| something like Mastodon existed on top of this, I'd think it
| would be really secure and much easier to tell people to stand
| up their own node...
|
| And I want the whole thing to feel like Sandstorm.io, in that
| self-updating way, with an app store... But Sandstorm.io is
| like an Oasis... I want a Federation. And I feel like a Rust-
| language-implemented WebAssembly sandbox that uses CONTACTS
| (not TCP) and Messaging, over something like Tailscale for
| connectivity and encryption, and then a Capability model for
| storing locally, or talking to a DB, or making external HTTP
| requests depending on the service, etc...
|
| I want a WebAssembly thin client running on my phone... And a
| WebAssembly server running on my PC at home. And the server at
| home runs applets that THINK they're running on my phone (like
| XWindows, basically). Talking to other applets on my server,
| which talk to other applets on YOUR server, which talk to
| applets on your phone. I type a message on my phone, lots of
| Tailscale happens, and you see the message on your phone. And
| in my head, there's basically no boilerplate in the code I
| write. It just looks like Contacts and strongly-typed Messages.
|
| That's the thing I keep wanting.
| Kinrany wrote:
| This is a very cool vision but it sounds like a lot of
| research, and they probably have many lower-hanging fruit to
| pick before that!
| jtwebman wrote:
| Has anyone written an OTP library on top of it?
| bkolobara wrote:
| We expose some OTP constructs in the lunatic Rust library
| directly, like supervisors (https://docs.rs/lunatic/0.12.1/lu
| natic/supervisor/trait.Supe...), gen_server (https://docs.rs/
| lunatic/0.12.1/lunatic/process/trait.Abstrac...) and others.
___________________________________________________________________
(page generated 2022-11-30 23:01 UTC)