Intro to WebAssembly

Good article about current state of WebAssembly with examples and links to resources.
I like the idea of common low level language/runtime for web. Even here in my blog I did criticize state of Javascript, fragmentation and sloppy attempt to make native code run along/inside the browser with NaCL.
WebAssembly seemed and still seems to be the right way to go. There are exactly two things that still bother me though:
1. Speed of adoption and standard development, which is probably a false negative, because everything in web standards world is going slow.
2. Syntax… why braces again!? I bet committee was infiltrated by Lisp lovers. 😛

Here’s the article.

github:
https://github.com/WebAssembly/wabt

Go Garbage Collector

Good read on how GC is implemented and optimized in Go run-time. It goes through typical issues with GC at scale and real-time systems.
Sorry for posting another bookmark to the stream. I hope some of these posts are actually useful to others. 😛
https://blog.golang.org/ismmkeynote

History of Computer Languages (funny)

James Iry’s funny view on computer languages history.

https://thequickword.wordpress.com/2014/02/16/james-irys-history-of-programming-languages-illustrated-with-pictures-and-large-fonts/

Original article without illustrations

 

 

 

C++. Concepts

One more reading on what’s going on with the C++ standard. Concepts were proposed before, but now TS (Technical Specification) became concrete and may become a part of next standard. One thing I specifically like about concepts is that you can specify template constraints. Why do you need them? It’s simple. Constraints will help you to get human readable error messages from compiler instead of 100 lines garbage that current STL errors generated by compilers.

Anyway, Andrew Sutton’s article on what’s going on with concepts and why we need them:

http://accu.org/index.php/journals/2157

Writing Good C++

Yes, C++ is evolving. 🙂 C++14 is almost here and C++17 is rising in the horizon. I find it amazing that so far all attempts to make language somewhat more friendly and safer looked like islands of resistance created by small teams all around the world. And they were disconnected. Coding standards, numerous books on good practices, – we saw them all. We have not seen the C++ father Bjarne Stroustrup saying anything on this subject. I obviously ignoring his book “A Tour of C++” and his conference speeches, but those were conceptually still islands in the ocean. C++ is huge, standard is 300+ pages, last Bjarne’s book is more like a monument to the greatness of C++, but can’t be used neither as a manual nor tutorial.

Here we go. New initiative from The Father to define good practices and guidelines for modern C++.

Here’s his deck from keynote:

https://github.com/isocpp/CppCoreGuidelines/blob/master/talks/Stroustrup%20-%20CppCon%202015%20keynote.pdf

Interestingly, right from the beginning they came up with “good library” called GSL. Static syntax validation tools is coming (good!).

Github link to GSL: https://github.com/Microsoft/GSL

His speech on this subject at CppCon 2015. I like Bjarne’s philosophical view on coding standards. Yes, we hate them! 🙂

Swift critique from Rust designer

In nutshell Rust is another evolution of C/C++ by Mozilla Foundation. Another attempt to create a cleaner and safer language with minimal performance overhead (POD and static types, move semantics, well defined object format, small runtime, efficient use of pointers and references etc). Along the line with D, Go, Swift and likes. I’m not at the position of covering all ins and outs of Rust, as I’ve not written a single line of code in it, but since I’ve started gradual migration toward Swift, I had to keep eye on its conceptual competitors (or relatives). While doing that, I found good article from Rust designer Graydon Hoare about where he compared Swift with Rust. Pretty interesting overview. You can find it here.

More on Rust:

https://www.rust-lang.org/

http://rustbyexample.com/

Swift 3.0 changes

Erica Sadun wrote a good article on what’s coming up in Swift 3.0. Funny, how many people noticed that “++” and “–” operators are going to be cut. Honestly, it’s not important thing in the world of iterators and dynamic arrays. However, I don’t like the trend of calling indexes evil. People, do you understand what random access in arrays existed for!? How about matrixes and vector operations? Programming is not just about traversing sets and maps.
Another takeout from the Swift 3.0 is that most of improvements are in the department of code styling, syntax sugaring, interoperability API’s and future versions of Swift, meaning that language finally becomes stable. It’s a good thing, right? 🙂

Anyway, here’s the article.

Javascript’s this is nuts

It’s not going to be a rant as title might suggest you. I’ve been reading a book about Phonegap (now known as Apache Cordova), and came across a cool remark in the text:

Javascript’s this is a bit
nuts, so it’s always better to refer to a variable that we know
will always refer to the object.

I smiled. This remark was referring to a simple code that had this assignment:

self = this

I’ve learned about JS “this” the hard way. Indeed, it’s not intuitive and goes against what developer learned from other languages. Anyway, I thought I know how it works well… until I read this quote. I went back online to refresh my knowledge, just to learn the damn thing again. 🙂 Anyway, in case if you’re in the same boat, old friend MDN (Mozilla Developer Network) is your friend. That’s the best article about “this” scope, strict and non-strict mode (who came up with these names!?), syntax for event handlers etc.

Here’s the link

asm.js

Idea of using Javascript as an intermediate for different programming languages is not new. I can say exact same thing about attempts to make browser runtimes closer to hardware. There was a big push toward JVM and Java in general at one point. Then Google did a splash with NaCl (which stand for Native Client). Developers needed a high performance secure environment to build efficient browser apps and have a path of porting existing apps from C/C++ realm to Javascript. asm.js supposedly is going to solve this issue by introducing a Javascript library and cross-complier from other high level languages into asm.js.
And this attempt is more serious than previous ones. For starters, it’s supported by Javascript godfather Brandon Eich.
Here’s his interview on this matter:
https://medium.com/javascript-scene/why-we-need-webassembly-an-interview-with-brendan-eich-7fb2a60b0723

From one side, this does not sound like a best solution for porting high performance apps like games (more exact, game engines), but since W3C will never come to agreement on lower level solutions, asm.js AKA Web Assembly may be the best compromise of the moment. It’s going to be based on many hacks and quirks. For instance, they virtually are going to disable GC. It did not take 20 years for web developers to understand that GC is a… garbage that they have to deal when it comes to speed optimization. There will be hacks around offline downloadable binaries or something like that. Otherwise, loading big games will be going to be a major pain. Anyway, it looks like major game engine developers are on board. Unity and Unreal already got prototypes and whole thing looks more promising than NaCl initiative.

Here’s another good article about Web Assembly:
http://ejohn.org/blog/asmjs-javascript-compile-target/

Nice SWIFT tutorial from AirPair

In case if you want to get a basic introduction on what SWIFT is all about, look here:

Proudly powered by WordPress
Theme: Esquire by Matthew Buchanan.