12,707 reputation
13155
bio website
location
age
visits member for 4 years, 2 months
seen 8 hours ago

Nov
22
comment OSS Non-Commericial License
A license that prohibits commercial use is not an open source license.
Nov
22
comment Why does Facebook convert PHP code to C++?
@Alice Also, many JIT compilers do use SSA and perform the optimizations that become trivial in SSA. The optimizations they lack are the ones that are primarily those that are relatively expensive regardless of IR (such as register allocation, aggressive inlining, inter-procedural optimization). And yes, "for free" is an overstatement, but inserting type profiling into the code and collecting type information during runtime is far easier than any static analysis.
Nov
22
comment Why does Facebook convert PHP code to C++?
@Alice We're talking about highly dynamic languages. There are no simple and effective AOT (i.e. static) type inference algorithms for languages like Python or JavaScript. There are complicated on-line/run-time algorithms (as used in SpiderMonkey for example) that are effective, and there are complicated AOT algorithms (e.g. Starkiller) which so far failed to prove themselves effective. Algorithm W does not even begin to address the complexities of dynamic languages.
Nov
20
comment type infered statically typed languages?
@Jules Check out Rust. Its memory management is manual (in that one is in full control where stuff is allocated and when it's freed), but it prevents dangling references. There are of course escape hatches, but those exist even in Haskell and OCaml.
Nov
19
comment type infered statically typed languages?
A note on terminology: What you call a typesafe language is usually known as a language with a static type system. What you call typeless would correspond to inferred types, except that the latter implies a static type system while you seem to consider dynamically typed languages typeless too. In summary, you want a language that infers (or rather, can infer) all types.
Nov
19
comment Why do functional programs have a correlation between compilation success and correctness?
@faif Clojure has no type system or compile-time checks either.
Nov
19
comment Why do functional programs have a correlation between compilation success and correctness?
Lisp is a functional language, yet it has no compile time checks to speak of. Same for a few other functional languages. A more accurate characterization of the languages you talk about would be: Languages with powerful formal (at least Hindley-Milner) type systems.
Nov
16
comment Why does Facebook convert PHP code to C++?
@Alice The kind of analysis necessary to put an AOT PHP compiler in the same league as a JIT compiler is expensive (in compile time) even for an AOT compiler and also quite expensive in implementation effort. Fundamentally, an AOT compiler needs to figure out very complicated flow- and data-dependent information (most importantly, the types actually stored in variables and data structures) that a JIT compiler gets for free. That information is the great difference; clearly if an AOT compiler has the same information it can beat a JIT compiler by optimizing more.
Nov
13
awarded  Nice Answer
Nov
12
comment Big O notation allocate array of N element
@KilianFoth Yes, it's certainly possible to get initialization at no extra cost during allocation (though it probably makes other operation, e.g. deallocation, more expensive). But in any case it is a facet that must be considered.
Nov
12
comment Big O notation allocate array of N element
Note that new[] (in C# and also in C++) not only allocated but also initializes.
Nov
12
comment Big O notation allocate array of N element
@11684 While I agree in principle (see my previous comment), those C examples I can't get behind. Nothing any sensible person would call an array is non-contiguous. And speaking of O(gaps) complexity is very misleading: There are many allocator designs, many with quite different performance characteristics. Plus, O(gaps) isn't useful because the number of gaps is completely arbitrary and depends in complicated ways on the internals of the allocator and the global allocation behavior of the program.
Nov
12
comment Big O notation allocate array of N element
@Niels It depends on the model of computation if new[] is considered a primitive operation in your model of computation, or on the assumed implementation of new[] if it's not. Adding two integers may take O(1) time in the RAM model, or O(d) on a Turing machine (where d = the length of the numbers).
Nov
11
comment Race conditions in JVM languages versus C/C++
@Siler No, if there is a (reachable) reference to it, it won't be collected. The GC takes care of that much.
Nov
11
comment Reference counting & GC in LISP
Sure, but that is orthogonal. I only object to implying that refcounting can't handle parent references in trees.
Nov
11
comment Do we really need auto-vectorization?
@Jules Well, not quite, there is also SLP vectorization which transforms straight-line code without loops (basically, basic blocks).
Nov
11
comment What are the practical implications of homotopy type theory in programming?
HoTT seems to be very exciting research into the foundations of mathematics, but if its predecessor/contender (set theory, specifically ZFC) is any indication, the foundation of mathematics has little implications even for most working mathematicians, let alone laymen.
Nov
10
comment Is there any mechanism to make programming language more stable(compatible) for changes?
More stable means to me fewer changes happening (hopefully because they aren't necessary), the exact opposite of backwards-incompatible changes. Which are you interested in, or are you asking about both semi-independently?
Nov
10
comment Reference counting & GC in LISP
There are weak references available in most refcounting implementations.
Nov
10
comment Reference counting & GC in LISP
@amon Pure refcounting is undesirable because of the easy memory leaks. Once you add a cycle GC, however, RAII becomes much less attractive in my mind: Cycles are no longer bugs, so other code with references to your objects would be justified to not deal with cycles of their own, but those cycles keep your objects alive, so prompt object destruction goes down the drain. Also, most optimizations of ref counting break the "prompt destruction" property too (cf. A Unified Theory Of Garbage Collection by David Bacon et al.)