Detecting programming language from a snippet [closed]

I think that the method used in spam filters would work very well. You split the snippet into words. Then you compare the occurences of these words with known snippets, and compute the probability that this snippet is written in language X for every language you’re interested in. http://en.wikipedia.org/wiki/Bayesian_spam_filtering If you have the basic mechanism … Read more

Scalar vs. primitive data type – are they the same thing?

I don’t think they’re interchangeable. They are frequently similar, but differences do exist, and seems to mainly be in what they are contrasted with and what is relevant in context. Scalars are typically contrasted with compounds, such as arrays, maps, sets, structs, etc. A scalar is a “single” value – integer, boolean, perhaps a string … Read more

Dynamic type languages versus static type languages

The ability of the interpreter to deduce type and type conversions makes development time faster, but it also can provoke runtime failures which you just cannot get in a statically typed language where you catch them at compile time. But which one’s better (or even if that’s always true) is hotly discussed in the community … Read more

Best explanation for languages without null

I think the succinct summary of why null is undesirable is that meaningless states should not be representable. Suppose I’m modeling a door. It can be in one of three states: open, shut but unlocked, and shut and locked. Now I could model it along the lines of class Door private bool isShut private bool … Read more

Function overloading by return type?

Contrary to what others are saying, overloading by return type is possible and is done by some modern languages. The usual objection is that in code like int func(); string func(); int main() { func(); } you can’t tell which func() is being called. This can be resolved in a few ways: Have a predictable … Read more

Why functional languages? [closed]

Functional languages use a different paradigm than imperative and object-oriented languages. They use side-effect-free functions as a basic building block in the language. This enables lots of things and makes a lot of things more difficult (or in most cases different from what people are used to). One of the biggest advantages with functional programming … Read more

What are five things you hate about your favorite language? [closed]

Wow, I’m surprised that SQL hasn’t made it up here yet. Guess that means nobody loves it 🙂 Inconsistent syntax across implementations Subtle code differences can have massive performance ramifications for seemingly obscure reasons Poor support for text manipulation Easy cost of entry but steep learning curve towards mastering the language Minimal standardization across the … Read more

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