by etatoby · 9y ago · 0 comments
Because webmasters will keep loading ready-made plugins from CDNs, exactly like they are doing now, except that the new generation of web software will carry their own interpreter or runtime with them, because the developer wanted to use Python or whatever.
The web is getting better by the day.
Web 4.0 pages are obfuscated WebAssembly payloads, that draw their contents via WebGL. This way, adblocking becomes impossible, as the actual content and ads are within the same opaque WebGL framebuffer. Stealing copyrighted text is also made significantly harder, beause the Web 4.0 platform leaves it up to the publisher to enable glyph selection and copying. You have concerns about accessibility? Web 4.0 is 100% accessible thanks WebAudio based realtime speech synthesis!
No, it'd just take a sufficiently smart AI.
I do agree that runtime-less languages have an advantage here though.
That said, it's not the technology's fault that people abuse or otherwise make poor use of it. I see no point in limiting it on that basis.
I felt like I should respond to this, too.
It's not, but it is not unreasonable to object to implementing new ways for browsers to hog resources pretty much at the hosts' discretion. In this case it can be argued that it's poor use of technology to implement it in the browser.
On a similar basis, one might argue that it's poor use of technology to kill people with dynamite, but it is also reasonable to take a step back and argue that it is poor use of technology already at the point at which you gave a toddler the detonator. Regardless, dynamite is an excellent and useful technology.
That said, some of us have legitimate uses for said dynamite, pyromaniac infants be damned.
I'm not sure what you mean by that. Is there some limitation inherent to WebAssembly that makes implementing garbage collection particularly difficult?
For what it's worth, here's Lua (which implements a garbage collector in its runtime) in WebAssembly: https://github.com/vvanders/wasm_lua
Code:
print(_VERSION)
local a = setmetatable({}, {__mode = 'v'})
local b = setmetatable({}, {__gc = function(x) print("Deleting: " .. tostring(x)) end})
a[1] = b
a[2] = 2
print(table.unpack(a))
print(collectgarbage'count')
b = nil
collectgarbage()
print(table.unpack(a))
Result: Lua 5.3
table: 0x50a748 2
21.4033203125
Deleting: table: 0x50a748
nil 2
[0] - 3 features tied to the Lua GC, to simplify, they basically are (respectively): forcefully running the GC, finalizers that run when object is collected and weak refs that don't hold the object alive on their own.Perhaps http://www.lua.org/demo.html could be replaced with that for users who have JS enabled.
Again - just wow, that's really nice, Lua in a browser.
Yes, in that you'd have to implement the GC inside the wasm module itself (as in your example). In contrast to other languages, Lua is very lightweight. Many GCs are non-trivial.
Moreover, proper GC support is a piece of the puzzle for the wasm/JS/DOM interop story to get better.
That is essentially the same problem people implementing garbage collectors on real machines are facing. You have some memory and you have to implement the algorithms and data structures necessary to allocate and free it as necessary.
> Lua is very lightweight. Many GCs are non-trivial.
Yes, but don't confuse the problem of implementing a garbage collector with the problem of implementing a system that can support a garbage collector. The former may be non-trivial, while the latter only supposes an architecture where you can arbitrarily manage memory "manually". From what I understand, you just hand WASM an array of memory and it can do whatever it wants with it, since it's a linear bounded automaton.
> Moreover, proper GC support is a piece of the puzzle for the wasm/JS/DOM interop story to get better.
The link seems to be addressing the use of VM-managed GC objects within WASM programs. That would certainly a nice feature, especially when it comes to interoperability with JS, but the lack of it is not a showstopper for implementing your own garbage collector as it has always been done.
I commented with a link elsewhere, but it seems that people have found a way around that!