mozilla :: #jsapi

28 Apr 2017
00:17mrgigglesthe mozilla-inbound tree is now open
02:10* Waldo sighs
02:10WaldoI'm not sure if all this template nonsense would be easier or not if I actually learned everything there is to know about C++ templates
02:10Waldokeep running into quirks of specialization rules and junk
02:12BoneyIsn't "C++ - The Good Parts" just ANSI C?
02:12Waldowatch yourself, I'm an op here :-P
02:12Waldoalso there is no way at all we would have anywhere near as good an engine as we have now if we couldn't use C++ and templates
02:14Waldo(for the record, "watch yourself" was a joke, if the :-P didn't make it clear)
02:20BoneyYeah, I got that it was a joke.
02:20BoneyNow I've met a few Mozilla people and feel comfortable making this type of joke.
02:20BoneyMaybe I should have put a :P too.
02:20Waldonah, yours was clear
02:21BoneyComming from a functional programming background, where generics don't add specalised code (usually) but add extra runtime parameters (like virtual method tables) I always thought it was a bit dumb how C++ did this statically.
02:22BoneyBut after reading some of the SpiderMonkey JS code I could see how it was useful that it did it statically for many things.
02:22BoneyThings that also allow the compiler to do further optimisations.
02:22Waldodefinitely dynamic costs hit things that need speed, like real-world language environments
02:22BoneyBTW, in a functional language sometimes this is done statically when the compiler things it's an optimisation or a common pattern, so it does happen there, just not as often.
02:23Boneyso for example map(K, V) will also often be specialised to map(int, V)
02:24Waldosure; it's the uncertainty, and lack of control over it, that are the harder sells for the C++-loving crowd
02:25Waldoespecially if you think back twenty years when C++ compilers were far less capable
02:25Waldothe number of oddities in Mozilla's style guide to deal with weird compilers on obscure architectures was pretty big
02:25BoneyI've been considerint writing an article about why some langauges are faster than others.
02:25Boneyand say that it's not really the langauges that are faster, and sometimes it's not the implementations.
02:26Boneybut it's the degree of control you get to make your code fast in a specific language.
02:27Waldoseems fair
02:28BoneyThis is also often the complaint that people have about GC, giving them a little more control might aleiviate about 90% of people's reservations about GC.
02:29BoneyMy persional oppinion is that Rust gives too much, and ends up burdoning the programmer. But I still want to learn Rust.
02:36Waldogiving control over GC is a tantalizing idea, but giving people the level of control over it they really want seems practically impossible
02:38Waldoso the vast majority of Parser.cpp is enclosed in |namespace js { namespace frontend { } }|
02:39Waldoand that lets you specialize templates and stuff quite trivially
02:39Waldobut in TokenStream.cpp, there's no such similar thing
02:39Waldoso if you wanted to specialize a template in js::frontend, you'd have to add namespace blocks yourself to make it happen
02:40WaldoI guess maybe this is because TokenStream.cpp historically hasn't had widescale uses of templates in it
28 Apr 2017
Last message: 3 hours and 44 minutes ago