190 karma · joined February 18, 2018
It scales pretty well from that, allowing you to build logic trees in a scratch like environment or go full code with JS.
Trial version is free, and browser based so no install. Loads of examples and demos in the editor to try as well.
There are books like the dragon book which cover PL design in a more reference book style. But I don’t recommend them.
If you’re looking for a lighter alternative then “writing an Interpreter in Go” is worth a look.
Also Bob Nystrum has some other good material on his blog, and a chapter in game programming patterns about PL stuff.
Quite a lot of the existing content is outdated or unclear. Also good luck writing a question that is both acceptable and there’s someone who knows an answer…
It unlocks a number of nice to haves over WebGL 1 which improve usability, quality and performance. As Safari was the last stand out developers can now rely on these things being there.
It's here now. WebGPU has been on the horizon for many years, and probably will be for several more before you can actually expect it to work on users browsers. Presuming we don't end up with a repeat of WebGL 2 on Safari.
It's simpler. Much like DX12, WebGPU is intended to be lower level and have better control over hardware. Which makes it more complex and harder to use Vs WebGL.
It has plenty of community knowledge from OpenGL ES peeps, which makes it quite easy to find examples that can be used.
For anyone actually building this style of content today, this is huge news.
I would heartily support the refractors given in the examples if they reached me in an MR. But chances are that a type key is introduced in 1 location, and then acted on in 6 different locations with a large temporal distance. Without the type key you are likely to need some way to infer the type, which may be error prone and hard to maintain.
On a micro scale a common example is where you have to pass over a list of statements to declare the functions, and a second time to define them. So that they can be self referential. Preferably without N scale memory allocations caused by things such as filtering the list.
They all feature per lane adjustable speed limits, as well as linked speed cameras at frequent intervals. This is supposed to help ease congestion by adjusting flow in certain areas.
In practice random signs are often left on the wrong setting, so you get a speed reduction to 40mph for 250m. Or a lane is closed for 6 miles with no reason.
I've no doubt that in the scenario where there is congestion that it greatly aids safety, as approaching traffic can be slowed before they reach the affected area
WebAssembly only provides very minimal capabilities, anything more complicated than basic arithmetic and linear memory access require the features to be built. malloc, closures, arrays, error throwing, GC etc. all must be implemented. Some language features like console logs and visual output physically aren't possible, and must call out to the host ( normally JS ). Requiring the compiler to emit 2 languages.
In comparison JS has analogues to many common language features, making it easy to transpile to. There are other advantages to JS as well, but probably not worth listing.
It's complicated, and emitting JS is easier.
2 theoretical solutions ( with significant overhead ) are:
Run the code in a VM ( maybe quick.js compiled to WASM would work ) that suspends code execution periodically if it exceeds a certain duration. This has the advantage that long running code in general won't block rendering, not just loops.
Transform the AST to use async generator that yields once per loop. This would allow the loop to be suspended and resumed. But it would require a lot of modification to the AST, making effectively the entire call tree async.
In the last year I've transitioned from full time JS development to full time TS development and have been pleasantly surprised how easy the transition was for my personal projects. Previously I had been quite adamantly against TypeScript; seeing the type system as an unnecessary level of complexity given I already structured my code in quite strict ways. In most it helped me find 1 or 2 small errors, but it certainly helps reduce the amount of time I spend verifying the behaviour of code. It definitely has its flaws, but most of them are linked to its compatibility with JS and I don't think they can be resolved unfortunately.
For those who didn't read the article: the chemistry of Portland cement works against it. Production requires heating the calcium carbonate to a high temperature to extract carbon dioxide from it. Which obviously produces large amounts of CO2 proportional to concrete production. However, concrete also absorbs carbon dioxide from the air over its lifetime. So the measured emissions aren't the entire story.
Perhaps in future we will consider this an excellent source of carbon dioxide for the production of various hydrocarbons. I've heard of several efforts to create octane using carbon dioxide from the air, but you need a large amount of energy to extract a useful amount of CO2. Well this would be a good source of high concentration CO2. Perhaps not for octane ( we should really be moving away from combustion engines ) but perhaps plastics and other products that are currently derived from crude oil.
It's a fairly fascinating window into the inner workings, and quite detailed.
The only issues I had with it are the lack of documentation and the fact IE, Edge and Firefox didn't support it. Perhaps it's not surprising that the MDN documentation was lacking, but I made do. Browser support on mobile was actually really good, so that didn't cause any issues.
Nowadays I'm relatively familiar with indexeddb, but I'm convinced the same project would be harder to implement with it.
https://developers.google.com/web/updates/2019/03/kv-storage
I'm not totally agreed with the idea of inbuilt modules, but the API is very pleasant.
I work on a fairly large project that relied on localforage for a long time. However, we have since moved to our own library to resolve a number of small issues we had with localforage.
Also enjoyed Game programming patterns by Bob again, but that has already been mentioned.
JS object literals allow such fun things as:
{
"foo": "bar",
foo1: function () { return "bar" },
foo2: () => "bar",
foo3 () { return "bar" },
get foo4 () { return "bar" },
["foo5"]: () => "bar"
}All in all it was quite profitable; several of those things have come in useful for my day job since then. Of course it didn't much improve your game design skills, as I was just copying another game.
I never finished it, and looking around most of these copies are in a similar state. I'm proud of what I achieved and each problem I overcame but I can't even claim mine competes with the original or even the best clones out there. It's fairly easy to reason why most of these clones were never finished. It's a huge amount of work and the goal has already been reached by someone else. So motivation after the initial "oh hey I built something a little like Minecraft" is hard to find.
These sorts of project serve 3 purposes: - inspire others to try something similar ( hopefully for the same reasons ) - improve your own abilities - show appreciation to the developers of Minecraft
As for why this project is "hacker news worthy" I expect it's just because it looks more polished than most. But as I said above, most of the value of the project is to the developer, not anyone else.
{
let row;
if (row = await db.findOne()) {
//
}
else {
//
}
}Given that JS doesn't restrict the type of a declaration you can just assign a new value to it, place it in a small scope or use a chain.
I started the second half in Rust about a week ago, I don't have enough vacation days to work through it at the pace I did the first half. Finding it a bit harder so far, but I think that's just because I'm still new at Rust.
You may have already mentioned this but will you be publishing a physical copy when your done? I'd love to get one for the shelf.
It's a clever mechanism but malicious sites tend to just attach a click listener to the page and trigger everything when the user clicks for the first time.
On the other hand it can also be a pain to program around this if you need it. Say you have a webapp that allowed you render an image then display it in a popup. But the rendering is time consuming, so you do asynchronously in the background. The user clicks the button and you start the render. When the render is complete you try and open the popup, but your now in a different task where the popup is blocked. The best way to work around this is to display a modal dialog, saying that the render is complete. Then when the user hits "ok" you can use the task that the event created to display the popup. But it might confuse the user why they need to confirm the render is complete.
I would recommend starting with a premade mod pack and a YouTube series that's currently using it. Direwolf20 authors his own packs and creates videos using those packs. The twitch client allows you to install various modpacks for Minecraft, including Direwolf20's
If your looking to make your lexer as simple as possible I would recommend looking at (http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-e...). It's written by the same guy, and gives a short look on pratt parsers, which is one of the simplest ways to write a parser. There's also a simple language he wrote that uses the method as an example available on GitHub. At a top level you end up with declarations like:
infix(token: "plus", parselet: BinaryOperator, precedence: 13);
Having done a fair bit of prototyping parsers and reading about it the hardest parts of parsing JS are regex literals and automatic semi-colon insertion.