language-design

overview of DLR?

I'm looking for a high level overview of how one goes from an AST to working code via the DLR, does anyone have (a link for) something like that? ...

Why do Perl control statements require braces?

This may look like the recent question that asked why Perl doesn't allow one-liners to be "unblocked," but I found the answers to that question unsatisfactory because they either referred to the syntax documentation that says that braces are required, which I think is just begging the question, or ignored the question and simply gave bra...

Why is it #elif and not #elsif in C/C++

Is there a particular reason when C / C++ were created that #elif was chosen over #elsif? if ( ) { } else if ( ) { } else { } Fixed syntax ...

Is C# platform neutral?

Hi, Today I purchased C# 3.0 Pocket Reference (O'Reilly Publishers). In that book in the first para of the first page it is given that "The C# language is platform neutral, but it was written to work well with Microsoft .Net platform" If I am not wrong, Platform Neutral mean that the softwares made from that language should run in...

Who invented the throw/try/catch[/finally] kind of error handling?

My questions are more of historical nature than practical: Who invented it? Which language used it first (and to what extent)? What was the original idea, the underlying concept (which actual problems had to be solved these days, papers welcome) ? Is LISPs condition system the ancestor of current exception handling? ...

References on statemachine optimization and code generation?

As a follow-up to my state machines as a C++-like language extension question, I'd like some more help. My compiler has been extended to parse my state machine extensions and now I'm beginning semantic analysis and code generation. There is a description on this page. Can anyone point me to good references on state machine optimization...

Why value-types are stored onto Stacks?

Why does C# prefer stack to store value types ? What is the primary reason behind this design ? Won't stack R/W operations would be processing-savy ? or may be you can justify why not others ? ...

Why aren't hot-swappable vtables a popular language feature?

In object-oriented programming, it's sometimes nice to be able to modify the behavior of an already-created object. Of course this can be done with relatively verbose techniques such as the strategy pattern. However, sometimes it would be nice to just completely change the type of the object by changing the vtable pointer after instant...

How does/should global data in modules across packages be managed in Python/other languages?

I am trying to design the package and module system for a programming language (Heron) which can be both compiled and interpreted, and from what I have seen I really like the Python approach. Python has a rich choice of modules, which seems to contribute largely to its success. What I don`t know is what happens in Python if a module is ...

Multiple Language Support for Classic-Asp

Hi, I want to translate my web page to 7 different languages and I'm curious about what is the best way to handle this? I know this subject opened multiple times but I didn't get a reasonable answer. Actually, all the topics are about php and gettext but I use classic asp (vbscript). The method I'm using now is that; I have en.asp an...

Why python super does not accept only instance ?

In python 2.x, super accepts the following cases class super(object) | super(type) -> unbound super object | super(type, obj) -> bound super object; requires isinstance(obj, type) | super(type, type2) -> bound super object; requires issubclass(type2, type) | Typical use to call a cooperative superclass method: as far as I see,...

anonymous functions considered harmful ?

The more I delve into javascript, the more I think about the consequences of certain design decisions and encouraged practices. In this case, I am observing anonymous functions, a feature which is not only JavaScript-provided, but I see strongly used. I think we can all agree on the following facts: the human mind does not deal with m...

C nested switches: outer switch's case inside inner switch

I'm adding coroutine support to an interpreter I'm writing and I'd like to do something like the following: typedef enum { bar_stuff, bar_other } Bar; typedef enum { foo_error=-1, foo_none=0, foo_again } Foo_state; Foo_state do_foo(Bar bar,Foo_state foo) { switch(foo) { case foo_none...

Why python doesn't have a sign() function?

I can't understand why python has not a sign() function. It has an abs() builtin (which I consider sign()'s sister), but no sign. In python 2.6 there is even a copysign() function (in math), but no sign. Why bother to write a copysign(x,y) when you could just write a sign() and then get the copysign() directly from abs(x) * sign(y)? The...

What is a universal type?

I have heard the term "universal type" thrown around in the context of programming language type systems, does anybody know what this means? Is is something to do with objects like a String where two instances of "foo" are identical even though ("foo"=="foo") may be false? ...

Read/Write Python Closures

Closures are an incredibly useful language feature. They let us do clever things that would otherwise take a lot of code, and often enable us to write code that is more elegant and more clear. In Python, closures are read-only affairs; that is, a function defined inside another lexical scope cannot change variables outside of its local...

got type inference, want to add class inheritance

If I design a new language with type inference, no explicit types and no class inheritance support and then want to add inheritance, what are the minimum extra hints to the compiler needed to resolve type ambiguity when adding the feature? Are class names needed? EDIT The type-tainting is traced through assignments throughout the prog...

Why aren't "and" and "or" operators in Python?

I wasn't aware of this, but apparently the and and or keywords aren't operators. They don't appear in the list of python operators. Just out of sheer curiosity, why is this? And if they aren't operators, what exactly are they? ...

Why must C# operator overloads be static?

Why does C# require operator overloads to be static methods rather than member functions (like C++)? (Perhaps more specifically: what was the design motivation for this decision?) ...

c# hide Attribute in derived Class

Hi, I have a base class with an attribute and I want to hide it in a derived class. Is there any way to do this other than using reflection? [Authorize(Roles = "User,Admin,Customs")] public abstract class ApplicationController : Controller { } // hide the Authorize attribute public class ErrorController : ApplicationController { } ...