language-design

PEMDAS - why is it this order

This is probably an easy math question but what is the reason for the order of PEMDAS. I mean, why isnt' it SADMEP? Parenthesis, Exponents, Multiplication, Division, Addition, Subtraction Below was added because it does require knowledge of PEMDAS albeit a very basic concept it's one that I thought was more interesting in terms of why...

JavaScript equality between objects and strings

According to Firebug console, we have the following in JavaScript: >>> [''] == '' true >>> [''] == [''] false Finding Python to be much more logical here, I'd expect it to be the way round. Anyway, I can understand the second one — apparently two different objects never compare equal to each other, — but what is the reason for the fi...

Why doesn't Java have automatic properties like C#?

C# has automatic properties which greatly simplify your code: public string Name { get; set; } public string MiddleName { get; set; } public string LastName { get; set; } Whereas Java has you write this much code: private String name; private String middleName; private String LastName; public String Name(){ return this.name; } e...

Code that exercises type inference

I'm working on an experimental programming language that has global polymorphic type inference. I recently got the algorithm working sufficiently well to correctly type the bits of sample code I'm throwing at it. I'm now looking for something more complex that will exercise the edge cases. Can anyone point me at a source of really gnar...

Preferred books or study to know internal working of .net

Hello experts, I want to know the internal working of .net when we doing any thing at application level. Like if in my project I will create an object of class then what happened in the behind of the scene in .net internal level or when I inherit a base class to a child class then how my child class get all method of base class what exa...

Why can't templates take function local types?

In C++ it's OK to have a funcction that takes a function local type: int main() { struct S { static void M(const S& s) { } }; S s; S::M(s); } but not OK to have a template that does: template<typename T> void Foo(const T& t) { } int main() { struct S { } s; Foo(s); // Line 5: error: no matching function for call to 'Foo(...

Would JavaScript fare any better had it been multithreaded

This is a follow up question to Is there a point to multithreading? If JavaScript were multithreaded, would it fare better than the existing system? Would multithreading with one UI thread and other tasks in different threads (background) bring in greater responsiveness and efficient usage of resources? Why did the designers of th...

Why is the sealed keyword not included in the list of access modifiers?

I think sealed should be included in the list of access modifiers in C# language. Can somebody tell the reason why it has been excluded? ...

Purpose of Scala's Symbol?

Possible Duplicate: What are some example use cases for symbol literals in Scala? What's the purpose of Symbol and why does it deserve some special literal synatx e. g. 'FooSymbol? ...

Why does C++ not allow inherited friendship?

Why is friendship not at least optionally inheritable in C++? I understand transitivity and reflexivity being forbidden for obvious reasons (I say this only to head off simple FAQ quote answers), but the lack of something along the lines of virtual friend class Foo; puzzles me. Does anyone know the historical background behind this dec...

Would it make sense to have a 'constify' operation in C++?

Would it make sense to have a "constify" operation in C/C++ that makes a variable const? Here is an example where it could be useful, where obviously we don't want to declare it const yet in the first line: std::vector<int> v; v.push_back(5); constify v; // now it's const Currently, without such a possibility, you'd have to introduce...

Why does the postfix increment operator take a dummy parameter?

Have a look at these function signatures: class Number { public: Number& operator++ (); // prefix ++ Number operator++ (int); // postfix ++ }; Prefix doesn't take any parameter but postfix does. Why? I thought we can recognize them with different return types. ...

In-language semantic variance

I've been thinking about doing my own language (practicality: it's a thought experiment). One of the ideas I came up with is in-language semantic variation. You'd write essentially semantic regular expressions, to be replaced with equivalent code. You can see this in a somewhat less direct form in D- they have string mixins that convert ...

Language Simplicity: Spec vs. Code?

I often see people commenting that what they want is a simple language, with a simple specification and not too many excess features, odd rules and multiple ways of doing things. I've never understood this except when the opposite is taken to the extreme. Isn't a more meaningful measure of language complexity the complexity of the code...

Design Patterns, A New Criterion for Comparing Languages?

I've been reading through Code Complete, and I just got to the part about Design Patterns. I thought I'd see what questions were popular and tagged design-patterns. I was reading this question, and I agree with what seems to be the consensus there, that Design Patterns exist to address the limits of a paradigm (Functional, Object-Oriente...

Is there a specific reason nested namespace declarations are not allowed in C++?

The standard does not allow code like this: namespace Hello::World { //Things that are in namespace Hello::World } and instead requires namespace Hello { namespace World { //Things that are in namespace Hello::World }} What is the rationale? Was this simply not thought of at the time, or is there a specific reason it is not inc...

Whitespace aware C

Possible Duplicate: Tool for braceless, whitespace sensitive C syntax It recently occurred to me, after returning to C after several years of C++ and Python, that the use of curly braces is both ugly and contentious in a language for which I have great admiration. In particular, the use of K&R style leads to "hurried" statemen...

Does Perl language aim at producing fast programs at runtime?

I recently had a friend tell me "see perl was never designed to be fast" Is that true? The relevant piece of information I can find is this from Wikipedia: The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal). But it doesn't directly talk about speed. I ...

Why can I do this in language X but not PHP?

Possible Duplicate: Access array element from function call in php For example: $info = pathinfo($fileName); header('Content-Description: File Transfer'); header('Content-Type: '.Mimetypes::get($info['extension'])); Notice here I am using $info['extension'] and $info derived from calling pathinfo($fileName). So the...

C# design: Why is new/override required on abstract methods but not on virtual methods?

Hi all Why is new/override required on abstract methods but not on virtual methods? Sample 1: abstract class ShapesClass { abstract public int Area(); // abstract! } class Square : ShapesClass { int x, y; public int Area() // Error: missing 'override' or 'new' { return x * y; } } The compiler will show ...