4,542 karma · joined Jul 18, 2019 (7y ago) · 1,228 submissions
comment 5y ago · link · parent
A zero-overhead foreach loop is great compared to JavaScript and C#: https://tour.dlang.org/tour/en/basics/loops
Uniform function call syntax: https://tour.dlang.org/tour/en/gems/uniform-function-call-sy...
Sophisticated reflection, without any of the runtime overhead, since it occurs at compile-time: https://tour.dlang.org/tour/en/gems/traits
662.
Interactive tour of the D Programming Language(tour.dlang.org ↗)
6 points · by crazypython · 5y ago · 1 comment
comment 5y ago · link · parent
In HTTP/2, which our site will switch to soon, the concurrent limit is 100. The world's changed, change with it, and throw away those bundlers.
Either way, you can compare to our direct competitors: https://diep.io https://arras.io
> Finally, why on earth are you redirecting to HTTP after serving an HTTPS response?
This isn't really related to the argument at hand. My app is currently on HTTP for reasons downstream.
670.
Organizations Using the D Language(dlang.org ↗)
144 points · by crazypython · 5y ago · 127 comments
671.
With the D Programming Language, write fast, read fast, and run fast(dlang.org ↗)
1 points · by crazypython · 5y ago · discuss
comment 5y ago · link · parent
Add a <script src=> tag.
Access it by object destructuring a global variable. You can access ES5 stuff from ES6, just let ES5 run first.
674.
I use the D programming language for scripting(opensource.com ↗)
1 points · by crazypython · 5y ago · 1 comment
comment 5y ago · link · parent
I suggest using a single-pass transpiler like Surcase[0] that doesn't translate to IE11-compatible syntax, and just loops through the string once, avoiding generating an AST– making it much faster– removing TypeScript annotations and desugaring JSX.
If you additionally need to support IE11, you can use a development build with Surcase and a production build with a bundler like Snowpack. C/C++ developers have been doing things like this for ages: compiling files as objects during development, and compiling them into one big binary for production.
comment 5y ago · link · parent
When I do, I use a script tag, and put it before my ESM modules:
<script src="/scripts/data/contractor.js"></script>
Use them via global variables.I generally avoid third-party JavaScript modules for performance and maintainability reasons. When I do use them, I'll frequently vendorize them (put them in my source tree) and make ESM modules for them.
comment 5y ago · link · parent
See my comment above.
> 2. How do you handle the performance impact of your browser doing multiple sequantial requests because it doesn't know your whole dependecy tree?
Put all your dependencies in the HTML file, so it fetches them all in parallel. So instead of just loading the root application file and forcing the browser to resolve dependencies:
<script type="module" src="/scripts/app.js" defer></script>
Load the dependencies like this: <script type="module" src="/scripts/lib/gui.js" defer></script>
<script type="module" src="/scripts/lib/guielements.js" defer></script>
<script type="module" src="/scripts/lib/network.js" defer></script>
<script type="module" src="/scripts/lib/input.js" defer></script>
<script type="module" src="/scripts/lib/rendering.js" defer></script>
<script type="module" src="/scripts/lib/sockets.js" defer></script>
<script type="module" src="/scripts/lib/world.js" defer></script>
<script type="module" src="/scripts/lib/ui/classupgrades.js" defer></script>
<script type="module" src="/scripts/lib/ui/toasts.js" defer></script>
<script type="module" src="/scripts/lib/netstore/minimap.js" defer></script>
<script type="module" src="/scripts/data/configuration.js" defer></script>
<script type="module" src="/scripts/app.js" defer></script>
You can see a demonstration of this technique on my production site, a complex JavaScript SPA that loads everything (including dynamic content) in less than one second: http://vnav.ioFor a small performance boost, you can load smaller files first via <link rel=preload>.
678.
Hegel: A static type-checker for JavaScript(hegel.js.org ↗)
2 points · by crazypython · 5y ago · discuss
comment 5y ago · link · parent
In development, use an index.html that loads it directly from the filesystem, using a single-pass annotation remover such as https://github.com/alangpierce/sucrase A single-pass transpiler doesn't build an AST, instead just looping over everything once, which will surely make it faster than esbuild.
In production, use a bundler like snowpack.
comment 5y ago · link · parent
This is why Python has deliberately chosen to not add Ruby's blocks. To make any code readable by everyone. (And to prevent bad coding patterns that blocks promote, but that's besides the point.)
comment 5y ago · link · parent
You also don't need a transpiler like Babel if you drop support for IE11. Almost all ES6 features– such as classes, proxies, arrow functions, and async are supported by modern browsers and their older versions. As long as you avoid features like static, private, and ??=, you get instant compile times.
It's not 2015. You don't need a transpiler to write modern JavaScript. As of writing, the latest version of Safari is 14 and the latest version of Chrome is 88. These features fully work in Safari 13 and Chrome 70, which have less than 1% of marketshare.
comment 5y ago · link · parent
Just serve your ESM modules directly from the filesystem. You don't need webpack or snowpack. Build in 0 seconds.
You also don't need a transpiler like Babel if you drop support for IE11. Almost all ES6 features– such as classes, proxies, arrow functions, and async are supported by modern browsers and their older versions. As long as you avoid features like static, private, and ??=, you get instant compile times.
It's not 2015. You don't need a transpiler to write modern JavaScript. As of writing, the latest version of Safari is 14 and the latest version of Chrome is 88. These features fully work in Safari 13 and Chrome 70, which have less than 1% of marketshare.
> The JS ecosystem is so complicated nowadays. It just seems we’re patching shit on top of each other without reasoning from first principles.
I agree. I don't use any third-party JavaScript dependencies, except for the occasional framework. You can rewrite many third-party libraries yourself and more specialized to your usecase quickly. Third-party JS libraries tend to have poor performance.
comment 5y ago · link · parent
Open a typical modern website– you'll see a horrible mess of divs. People using very large amounts of HTML to do what should be very simple tasks. People writing complex JavaScript and React and SPAs instead of simply writing HTML. This is a case of people doing what should be done in HTML, in JavaScript.
> That said, I'm interesting in that DSL, care to link it/talk more about it?
view-source:https://wwwperiodictable.surge.sh/
comment 5y ago · link · parent
HTML is a document format. It defines the CONTENT of a webpage. That it has an API or is usually styled is secondary. The semantic tags– as used here, as used to STORE DATA here– are what make it possible to build a kanban solution so easily.
HTML is also a data format. It can be styled through the use of CSS.
comment 5y ago · link · parent
> If a seller wanted to keep farming reviews, they would now have to buy up the vast majority of their own inventory in the hopes of being selected.
They already have 100 people buy their product and fully pay for it for a review.
688.
The third result for “AI” on Google is Google AI(google.com ↗)
1 points · by crazypython · 5y ago · 1 comment