language-design

Why can't I have abstract static methods in c#?

I've been working with providers a fair bit lately and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the topic and it sort of made sense, but I was wondering if someone here might be able to offer a nice clear explanation?...

Why does a "file exists" method in many languages return true for a directory?

I know that it does in PHP, and I'm pretty sure it does in Java. I haven't used the latest versions of .NET, so I won't speak for them. It seems very awkward, but I was wondering if there was an underlying reason for this. ...

Program entry points..

What are the entry points in different languages? Like in C, main() is the entry point. ...

How to make a Side-by-Side Compiler for .NET

Nikhil Kothari's Script# is quite possibly one of the most amazing concepts I've seen in the JavaScript arena for quite some time. This question isn't about JavaScript, but rather about language compilation in the .NET runtime. I've been rather interested in how, using the .NET platform, one can write a compiler for a language that alre...

How to implement closures without gc?

I'm designing a language. First, I want to decide what code to generate. The language will have lexical closures and prototype based inheritance similar to javascript. But I'm not a fan of gc and try to avoid as much as possible. So the question: Is there an elegant way to implement closures without resorting to allocate the stack frame ...

Why aren't variables declared in "try" in scope in "catch" or "finally"?

In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks. For example, the following code does not compile: try { String s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out.println" ...

Would it be useful to change java to support both static and dynamic types?

What if a Java allow both static and dynamic types. That might allow the best of both worlds. i.e.: String str = "Hello"; var temp = str; temp = 10; temp = temp * 5; Would that be possible? Would that be beneficial? Do any languages currently support both and how well does it work out? Here is a better example (generics can't be us...

Why don't languages raise errors on integer overflow by default?

In several modern programming languages (including C++, Java, and C#), the language allows integer overflow to occur at runtime without raising any kind of error condition. For example, consider this (contrived) C# method, which does not account for the possibility of overflow/underflow. (For brevity, the method also doesn't handle the...

What are the "must have" features for a XML based GUI language

Summary for the impatient: What I want to know is what you want to have in a new gui language. About the short answers mentioning $your_favorite_one; I assume you mean that, such a language should look like $your_favorite_one. These are not helpful. Resist the temptation. I'm thinking on the user friendliness of XML based languages suc...

First impressions of the Fan programming language?

Hi, Has anyone here given the Fan programming language a whirl? (pun intended). My first impression: I like the ability to have the code run on either the .NET or Java VM. The syntax is nice and clean and does not try anything fancy. I have a belief that "the library is the language" and the developers of Fan believe that their USP i...

How does "this" keyword work within a JavaScript object literal?

I just came across an interesting situation in Javascript. I have a class with a method that defines several objects using object-literal notation. Inside those objects, the this pointer is being used. From the behavior of the program, I have deduced that the this pointer is referring to the class on which the method was invoked, and ...

Which programming language makes concurrent programming as easy as possible?

If you want to create programs with threads/processes that run parallel you have to learn about many stuff, like race conditions, locks, semaphors, monitors, deadlocks .... Is there a language that makes creation of parallel programs as easy as object-oriented programming languages help creating complex architectures? Or which programmi...

Why does Java not have block-scoped variable declarations?

The following method does not work because the inner block declares a variable of the same name as one in the outer block. Apparently variables belong to the method or class in which they are declared, not to the block in which they are declared, so I therefore can't write a short little temporary block for debugging that happens to push...

How was Adobe Acrobat 9 made?

Can anyone tell how Adobe Acrobat 9 was made? I like the look and feel of the GUI and I'm curious how it was made. Specifically, what programming language was used to make it? ...

What are your language "hangups"?

I've read some of the recent language vs. language questions with interest... Perl vs. Python, Python vs. Java, Can one language be better than another? One thing I've noticed is that a lot of us have very superficial reasons for disliking languages. We notice these things at first glance and they turn us off. We shun what are probabl...

How do you force constructor signatures and static methods?

Sorry in advance if the question is naive... Is there a way of forcing a (child) class to have constructors with particular signatures or particular static methods in C# or Java? You can't obviously use interfaces for this, and I know that it will have a limited usage. One instance in which I do find it useful is when you want to enfor...

C, C++, Java, what is next and what will it look like?

What do you think the next evolution of languages will look like? ...

Combined post-operators?

We're all familiar with the pre- and post-increment operators, e.g. c++; // c = c + 1 ++c; // ditto and the "combined operators" which extend this principle: c += 5; // c = c + 5 s .= ", world"; // s = s . ", world"; e.g. PHP I've often had a need for a 'post-combined operator', which would allow: s =. "Hello "; // ...

what would be the impediments to creating an "Europanto" type universal scripting language?

After switching back and forth between several scripting languages this week, I found myself thinking how similar they all are. Yet I'm always reaching for Google (or nowadays SO) to remember details like what the local equivalents of "instanceof" and "endswith" are, or the right syntax to declare an interface, or whatever. This remind...

Most interesting non-mainstream language?

I'm interested in compilers, interpreters and languages. What is the most interesting, but forgotten or unknown, language you know about? And more importantly, why? I'm interested both in compiled, interpreted and VM languages, but not esoteric languages like Whitespace or BF. Open source would be a plus, of course, since I plan to st...