News for hackers. Stuff that matters.
Re:When an implementation monoculture might be the right thing by camgunz on Thursday May 31, 2018 @08:07PM (#17201413)
I think multiple implementations is more or less a C/C++ thing. If you look at other platforms (Ruby, Python, PHP, Haskell, Java, Go, Rust, Scala, Lua, Perl) there's basically _the_ version and maybe some ancillary implementations.

In fairness, it's hard enough to build a language people use that solves real problems. Asking someone to do it more than once, or to do it once but create specific enough documentation and tests so someone else can also do it -- and then get someone else to do it -- is practically impossible.

Re:When an implementation monoculture might be the right thing by ppseafield on Thursday May 31, 2018 @11:34PM (#17202391)
For Rust and Go, they're very new languages, so multiple implementations are going to be hard to come by. Although there is gccgo. Some of those you listed though have a lot of different implementations.

Ruby has the Ruby MRI, JRuby, among others. [0] Additionally it spawned a lot of Ruby-like languages on different platforms.

Python has the standard Python (Pick 2 or 3), PyPy, MicroPython, unladen_swallow, Stackless Python, IronPython, Jython, among others [1].

PHP has had the reference implementation, Zend Engine, HipHop and HHVM (Both from Facebook), among others [2].

As another comment mentioned, Javascript has V8, SpiderMonkey, Chakra, and JavascriptCore, all with their own quirks. [3]

[0] https://github.com/cogitator/ruby-implementations/wiki/List-... [1] https://wiki.python.org/moin/PythonImplementations [2] https://en.wikipedia.org/wiki/PHP#Implementations [3] https://en.wikipedia.org/wiki/JavaScript_engine#JavaScript_e...

Re:When an implementation monoculture might be the right thing by camgunz on Friday June 01, 2018 @12:45AM (#17202653)
None of these (maaaaaybe with the exception of the JS engines) are the same as clang vs. GCC (vs. MSVC), which are mostly equivalent. There are significant compatibility differences between, for example, JRuby and YARV, or Python and PyPy. You can argue compiler extensions and so on, but I think that's out of scope. As far as spec'd C/C++, it's hard to find significant incompatibilities... actually are there any?
Re:When an implementation monoculture might be the right thing by mort96 on Friday June 01, 2018 @02:58AM (#17203168)
Clang and GCC will generally compile standard C/C++ code just fine, but they add their own extensions to the language. I'd bet a lot of C or C++ projects assume `void` has a size of 1 in pointer arithmetic, for example. Try compiling some projects with -Wpedantic.

Now, Clang tries to implement the various GNU extensions, but there are some relatively significant differences. For example, GCC has no problem with a (conditional) goto to a label pointer even if you never took the address of a label anywhere in that function, while Clang treats that as an error, which can be a problem when using macros. Clang also treats _Pragma in macro arguments as you'd expect, while GCC puts all the pragmas before the rest of the code in the macro argument.

Those are just differences I persinally have struggled with, I'm sure there are more.

Re:When an implementation monoculture might be the right thing by exDM69 on Friday June 01, 2018 @05:12AM (#17203751)
While there are differences between Clang and GCC language extensions, most of them are compatible or at least can be worked around with some relatively trivial hacks.

Compare this with trying to support MSVC, which supports none of the extensions and has a poor track record of getting even the standard stuff straight (especially in the C, not C++, compiler).

By dropping MSVC, you gain a lot of useful language extensions that work with Clang and GCC. For example you get portable SIMD, atomic operations and cache prefetching and a lot of other __builtin features which are unambiguously useful.

The alternative is to support MSVC but then have to maintain some kind of middleware layer to work around compiler incompatibilities. Since the platforms supported by MSVC are already covered by other compilers, you don't gain a lot.

Re:When an implementation monoculture might be the right thing by pietroglyph on Friday June 01, 2018 @01:03AM (#17202734)
This article specifically references not having to deal with cross-compiler differences as a monoculture advantage. So there are _differences_, perhaps not incompatibilities.
Re:When an implementation monoculture might be the right thing by camgunz on Friday June 01, 2018 @01:36AM (#17202839)
OP is pretty light on details, but GCC and clang keep up with standards amazingly well (who knows about MSVC). I'm sure there are bugs, but what even are they? Is there a list? It's definitely not at all like the difference between Python and Jython, or even Python 2 and 3.

Or if you want an even better example, look at JS benchmarks for different kinds of loops. Every engine is different. How completely bananas is that. Differences like these are a whole other universe compared to differences in the major C++ compilers.

Re:When an implementation monoculture might be the right thing by sanxiyn on Friday June 01, 2018 @03:58AM (#17203438)
The post addresses this. To quote:

> A fair amount of work has been done to deal with peculiar bugs in all three compilers: you can go search the source code and/or Bugzilla to find hacks that were needed for one reason or another.

So go search the source code and/or Bugzilla. Treasures await!

Re:When an implementation monoculture might be the right thing by camgunz on Friday June 01, 2018 @05:10PM (#17210347)
So I searched [1] Bugzilla and found 51 issues, none of which are from the last 2 years. There really just isn't an issue with GCC/clang incompatibility with the standard.

The issues that are still open [2] are practically all either a dev didn't test with GCC and got away with things they shouldn't have in clang, or dealing with Apple's ancient version of GCC.

I think this "monoculture" thing is really about MSVC being not that great, which I sympathize with, and which everyone who's ever used MSVC for C or C++ has discovered. But that shouldn't be an excuse to stop using GCC, which is an excellent compiler and has been for generations.

[1] https://bugzilla.mozilla.org/buglist.cgi?short_desc=gcc&reso...

[2] https://bugzilla.mozilla.org/buglist.cgi?quicksearch=gcc

Re:When an implementation monoculture might be the right thing by JdeBP on Friday June 01, 2018 @06:02AM (#17203963)
Bat-Ulzii Luvsanbat claims to know about MSVC.

* https://blogs.msdn.microsoft.com/vcblog/2018/05/07/announcin...

Re:When an implementation monoculture might be the right thing by mepian on Thursday May 31, 2018 @08:43PM (#17201608)
Common Lisp has at least four high-quality implementations (Allegro, Lispworks, SBCL, Clozure), and this is a fairly large language (thousand something pages of the ANSI specification + two chapters of AMOP) that is about as popular as Haskell if not less.
Re:When an implementation monoculture might be the right thing by taeric on Thursday May 31, 2018 @09:24PM (#17201844)
The days of having multiple implementations does seem to have waned heavily. In large, it seems companies taking ownership of languages destroyed this mindset. Though, I confess I have not made an official study of the topic to back that claim up.
Re:When an implementation monoculture might be the right thing by didibus on Thursday May 31, 2018 @10:46PM (#17202212)
Do they all have a differentiator?
Re:When an implementation monoculture might be the right thing by mepian on Friday June 01, 2018 @10:06AM (#17205424)
Allegro and Lispworks are proprietary with product support provided by the vendors, SBCL and Clozure are opensource. Allegro and Lispworks have their own IDEs and some proprietary libraries bundled in (e.g. CAPI which is probably the best option for cross-platform GUI for this language), while SBCL and Clozure both rely on SLIME and Quicklisp. SBCL produces fastest x86-64 machine code, as far as I know. Clozure has superior macOS support, as it used to be owned by Apple before they spun it off and was generally Mac-centric throughout its history.
Re:When an implementation monoculture might be the right thing by kazinator on Friday June 01, 2018 @12:03AM (#17202485)
Pascal thing, Lisp thing, POSIX shell thing, Awk thing, Javascript thing, Vi thing, ...
Re:When an implementation monoculture might be the right thing by consto on Thursday May 31, 2018 @08:27PM (#17201507)
Don't forget that JavaScript also has multiple fairly popular implementations.
Re:When an implementation monoculture might be the right thing by camgunz on Friday June 01, 2018 @12:51AM (#17202686)
Ehhhhhhhh kind of. Wake me up when node (or something like it) runs on SpiderMonkey, or Electron runs on JavaScriptCore, or you can pick Chakra on Lambda. The whole point is "there's a major version most people use, and sometimes there are competing versions that are significantly different that significantly fewer people use". That's definitely the case w/ JavaScript.
Re:When an implementation monoculture might be the right thing by Vinnl on Friday June 01, 2018 @05:49AM (#17203906)
You have been able to run ChakraCore on Node for a bit now, with potentially more engines to follow. That can presumably later also have ramifications later for Electron and Lambda, both of which are built around Node.
Re:When an implementation monoculture might be the right thing by camgunz on Friday June 01, 2018 @05:24PM (#17210497)
Hey I don't disagree that options exist. But I think Chakra on Node is extremely niche and almost no one uses it (despite being possible for over 2 years now). My entire thesis is that multiple equivalent equally (more or less) popular implementations is primarily (maybe only) a C/C++ thing. There are niche languages where this is the case, but they're very niche. There are also very niche implementations of popular languages or platforms, but no one uses them.

We extol the virtues of multiple implementations because it makes the ecosystem healthier, but is that even really true? Is Python's ecosystem unhealthy because theres no full alternative to CPython? Is Java's? Is serverside JS?

I generally think we haven't thought through the implications of the virtues of multiple implementations -- mostly I think the opportunity costs are bananas. Platforms that at all approach C/C++'s progress on this issue have longstanding standards committees and corporate-backed engineering teams. It's simply infeasible and a hugely bad decision to build multiple implementations if you don't have that, which, it turns out, almost no language devs do.

Re:When an implementation monoculture might be the right thing by Vinnl on Friday June 01, 2018 @07:25PM (#17211410)
Hmm, I guess you have a point there. That said, as a primarily-frontend-web-developer, multiple implementations of Javascript definitely is a thing, and I would never optimise solely for V8. (Although unfortunately (but it is unfortunate!), I see that as a trend that is starting to appear more and more. But I guess that's the point of the post as well.)
Re:When an implementation monoculture might be the right thing by nicoburns on Friday June 01, 2018 @05:55AM (#17203930)
It is on the Server. But V8, SpiderMonkey, JavaScriptCore, and Chakra are all running the same code on the web, and most people target all four.
Re:When an implementation monoculture might be the right thing by camgunz on Friday June 01, 2018 @05:29PM (#17210549)
OP spends a whole paragraph describing the effort Mozilla expends to ensure devs are able to target at least Firefox in addition to Chrome:

> We have a Tech Evangelism bugzilla component for outreach to sites who use techniques that don’t translate across browsers. When new sites appear that deliberately block Firefox (whether because the launch team took the time to test with Firefox and determine the user experience wouldn’t be acceptable, or because cross-browser compatibility was an explicit non-goal), Firefox engineers go find the performance cliffs and fix them. Mozilla has a long-history of promoting the benefits of multiple implementations of the web platform; some of the old guard might remember “Works best in all browsers” campaigns and the like. If you squint properly, you can even see this promotion in the manifesto (principles 2, 5, 6, 7, and 9, by my reckoning).

I think it ends up that sites happen to mostly work in most JS engines because most sites don't do a lot of difficult stuff, and if they do they're using libraries that work pretty hard on cross-browser compatibility. I definitely don't think significant effort is spent targeting Chakra, for example. I think most FEs would laugh at the mere mention. Most I know push back against even considering Firefox compatibility.

Re:When an implementation monoculture might be the right thing by malkia on Thursday May 31, 2018 @09:24PM (#17201848)
for lua, there is reference lua, luajit, https://www.havok.com/wp-content/uploads/Havok_Brochures/Hav... and possibly some other.
Re:When an implementation monoculture might be the right thing by camgunz on Friday June 01, 2018 @01:48AM (#17202882)
Lua has a special place in my heart for several reasons, but their suggested usage is to just include the source code in your application because they don't guarantee compatibility at all between minor versions. As far as they're concerned, Lua 5.0 is completely different from Lua 5.1. It has a certain charm and I personally think it's pretty cool, but each different Lua release is like the perfect case of, "there's really only the one implementation of this, use others completely at your own risk, p.s. they almost certainly aren't fully compatible". Hell LuaJIT might be more popular than Lua 5.3, and it _definitely_ isn't compatible with it.
Re:When an implementation monoculture might be the right thing by asfasgasg on Thursday May 31, 2018 @08:12PM (#17201433)
The difficulty, huge though it is, is secondary to the lack of utility. Even with C, for a long time there was only a single viable, mainstream compiler on any given platform. Clang being the main exception today.
Re:When an implementation monoculture might be the right thing by RossBencina on Thursday May 31, 2018 @09:35PM (#17201922)
> Even with C, for a long time there was only a single viable, mainstream compiler on any given platform.

I don't think this is even remotely true.

On Windows in the 90's we had Borland, Watcom, Microsoft compilers. Today there is at least MSVC and icc.

On Mac there was Think C, Metrowerks Code Warrior, and others.

For embedded systems there are multiple commercial compiler vendors, as well as the open source tools.

Re:When an implementation monoculture might be the right thing by asfasgasg on Thursday May 31, 2018 @10:49PM (#17202222)
It's been a minute since Borland or Watcom were mainstream C compilers on Windows. Consider the year between ~2000-2015. Based on my recollection, it seems like MSVC was used at least 75% of the time, with the other compilers each having a small slice of the remaining quarter. Today, very seldom do you encounter a program that was compiled with anything other than MSVC, although with Clang that's starting to change.

I don't know too much about the history of Mac compilers. You may be right.

Back in the days, it was easier to make a competitive C compiler, because the accretion of advantages to the dominant compilers was not so large. Today, the moat is too wide and too deep. There's also no reason to build a new compiler, because nobody is going to pay you for it unless it's substantially better than the free ones, which by this point are pretty damn good.

Re:When an implementation monoculture might be the right thing by JdeBP on Friday June 01, 2018 @06:06AM (#17203978)
The existence of Clang (ironically the very compiler discussed in the headlined article) undermines your argument, based as it is upon there being "no reason to build a new compiler".
Re:When an implementation monoculture might be the right thing by sanxiyn on Friday June 01, 2018 @12:01AM (#17202475)
I use many programs compiled with GCC on Windows. MinGW works.
Re:When an implementation monoculture might be the right thing by asfasgasg on Friday June 01, 2018 @12:08AM (#17202500)
I'm sure you can find someone who uses many programs compiled with TCC. That tells me little about the actual prevalence of programs compiled using various compilers.
Re:When an implementation monoculture might be the right thing by sanxiyn on Friday June 01, 2018 @12:24AM (#17202542)
I believe NumPy Windows binary is built with MinGW. NumPy is used enough that it is more than "very seldom".
Re:When an implementation monoculture might be the right thing by filmor on Friday June 01, 2018 @01:34AM (#17202830)
Python C extensions are (supposed to be) compiled with the same compiler as the Python interpreter you are building against was, which in case of the official python.org release is MSVC, see https://wiki.python.org/moin/WindowsCompilers.
Re:When an implementation monoculture might be the right thing by tavert on Monday June 04, 2018 @08:01PM (#17233804)
And that choice of compiler has caused endless headaches for the NumPy and SciPy communities, see e.g. https://github.com/numpy/numpy/wiki/Numerical-software-on-Wi... and https://mingwpy.github.io/motivation.html

VLC's windows binaries are also built with mingw-w64 gcc last I checked, that is likely used even more widely than numpy.

Re:When an implementation monoculture might be the right thing by justincormack on Friday June 01, 2018 @03:45AM (#17203379)
Go and CGo both require gcc on Windows.
Re:When an implementation monoculture might be the right thing by kazinator on Friday June 01, 2018 @12:12AM (#17202510)
It may not have been true on Wintel PC's, but on embedded platforms, it's very common to there be only one C compiler.
Re:When an implementation monoculture might be the right thing by lispm on Friday June 01, 2018 @03:17AM (#17203261)
> On Mac there was

Wasn't Apple using their own MPW C compiler?

Re:When an implementation monoculture might be the right thing by stcredzero on Thursday May 31, 2018 @11:29PM (#17202380)
Smalltalk had multiple competing implementations.