How can CoffeeScript be written in CoffeeScript?

This is nothing new. C compilers have been written in C. Python has been written in Python. It’s possible to use a compiler for Language X to compile a newer version of itself, with more features. It’s called bootstrapping. Bootstrapping a language Writing a compiler in its own language How do you write a compiler … Read more

Why not always use compiler optimization?

If there is no undefined behavior, but there is definite broken behavior (either deterministic normal bugs, or indeterminate like race-conditions), it pays to turn off optimization so you can step through your code with a debugger. Typically, when I reach this kind of state, I like to do a combination of: debug build (no optimizations) … Read more

How do system calls work?

Your understanding is pretty close; the trick is that most compilers will never write system calls, because the functions that programs call (e.g. getpid(2), chdir(2), etc.) are actually provided by the standard C library. The standard C library contains the code for the system call, whether it is called via INT 0x80 or SYSENTER. It’d … Read more

Maximum Method Name Length

For C# I don’t believe there’s a specified hard limit. (Section 2.4.2 of the C# 5 spec doesn’t give a limit, for example.) Roslyn v2.2.0.61624 seems to have a limit of 1024 characters; this is way beyond the bounds of readability and even a sensible machine-generated name. For Java, section 3.8 of the spec states: … Read more

Why interpreted langs are mostly ducktyped while compiled have strong typing?

The premises behind the question are a bit dodgy. It is not true that interpreted languages are mostly ducktyped. It is not true that compiled languages mostly have strong typing. The type system is a property of a language. Compiled versus interpreted is a property of an implementation. Examples: The programming language Scheme is dynamically … Read more

Compiler test cases or how to test a compiler [closed]

Good test suites for real languages are expensive to create and maintain. There’s a reason that the Plum Hall test suite, which is industry standard for ANSI C, is so bloody expensive. George Necula’s translation validation is a brilliant idea but also quite expensive to implement. The one thing that’s cheap and easy is this: maintain … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)