programming-languages
What is the purpose of Scala programming language? [closed]
One of the things mentioned in talks by Martin Odersky on Scala is it being a language which scales well to tackle various problems. He wasn’t talking about scaling in the sense of performance but in the sense that the language itself can seem to be expanded via libraries. So that: val lock = new … Read more
Is there a way in C# to replicate a ‘#ifndef _DEBUG’ from C/C++?
#if DEBUG Console.WriteLine(“Debug version”); #endif #if !DEBUG Console.WriteLine(“NOT Debug version”); #endif See this.
What is meant by “Capture-avoiding substitutions”?
Normally, the specific variable names that we chose in the lambda calculus are meaningless – a function of x is the same thing as a function of a or b or c. In other words: (λx.(λy.yx)) is equivalent to (λa.(λb.ba)) – renaming x to a and y to b does not change anything. From this, … Read more
Why Treat 0 as True in Ruby?
I’m guessing that Matz wanted conceptual simplicity of “truthiness” as such – the only “false” values are false and nil. Period. Using just false would be the cleanest but there is understandable need for including nil. To include the integer zero as a special case might open the mental floodgates of questioning truthiness of other … Read more
Starting off a simple (the simplest perhaps) C compiler?
A compiler consists of three pieces: A parser An abstract syntax tree (AST) An assembly code generator There are lots of nice parser generators that start with language grammars. Maybe ANTLR would be a good place for you to start. If you want to stick to C roots, try lex/yacc or bison. There are grammars … Read more
does a disaster proof language exist?
Erlang was designed for use in Telecommunication systems, where high-rel is fundamental. I think they have standard methodology for building sets of communicating processes in which failures can be gracefully handled. ERLANG is a concurrent functional language, well suited for distributed, highly concurrent and fault-tolerant software. An important part of Erlang is its support for … Read more
Code-Golf: What is the shortest program that compiles and crashes?
Bah – I can crash C in 5 characters: main; This declares an implicit int variable called ‘main’. It’s global so the variable has an initial value of 0. It’s C the names aren’t decorated – so the linker doesn’t realize that it’s a var and not a function. GCC gave me a warning – … Read more
What is the meaning of “quasi” in quasiquotations?
I believe this notion comes from Lisp languages. Program written in Lisp consists of series of lists of lists of lists etc, like this: (defn f [x y] (+ x y)) Because of such uniformity it is possible to represent and manipulate such code as data, so the sequence of characters above is interpreted as … Read more
Variants or Polymorphic variants?
My usage can be divided into the following 5 categories. 1. interface 2. modularity 3. legibility 4. brevity 5. tricks If the variant type is only internal to the module, I use regular variants, because as you said they are compiled more efficiently. If the variant type is exported in the interface and I feel … Read more