language-features

What language features are needed for game scripting?

I am looking into designing a game scripting language and was wondering what people employed in the games industry considered essential items/properties for a good game scripting language. This includes things like: static vs dynamic types Who should it be aimed at: programmers or designers? syntax(must it look like C?) How high level...

What is the overall design philosophy of php?

I recently had my first encounter with PHP (5) through a Drupal application for a client. There was certainly nothing difficult about the experience (documentation is good for instance), but I never had a moment where I thought, "that's really clever!", or "wow this is fun to use!" Moreover, I couldn't accurately predict how functions we...

Is it possible to replace a function/method decorator at runtime? [ python ]

If I have a function : @aDecorator def myfunc1(): # do something here if __name__ = "__main__": # this will call the function and will use the decorator @aDecorator myfunc1() # now I want the @aDecorator to be replaced with the decorator @otherDecorator # so that when this code executes, the function no longer goes through ...

How to deliver a Java program locally through a browser

Hello, I want to write an application that runs entirely locally on one machine - there is no need for connection to the internet or to any external machines. I was thinking that it would be a good idea to use a web browser as the platform for this application so that I would not have to mess around with lots of UI stuff - I could just...

Is the order of fields in a javascript object predicatble when looping through them?

In php, if you have the following code: $map = array( "first" => 1, "second" => 2 ); $map["third"] = 3; foreach($map as $key => $value) { // code } You know the entries will be listed in the order they have been added to the array. Now, can I assume the same rule applies to the Javascript equivalent below? map = { "first":...

What are C macros useful for?

I have written a little bit of C, and I can read it well enough to get a general idea of what it is doing, but every time I have encountered a macro it has thrown me completely. I end up having to remember what the macro is a and substitute it in my head as I read. The ones that I have encountered that were intuitive and easy to understa...

A null coalescing assignment operator?

It would be really nice if C# allowed an ??= operator. I've found myself writing the following frequently: something = something ?? new Something(); I'd rather write it like this: something ??= new Something(); Thoughts? New language extensions are always controversial by their nature. ...

Three value variables, max, min, actual

A long while ago I developed systems using Egeria an expert system language. It had a really useful feature where variables had three values, a min, max and current. In this way the probability of a partly known value could calculated, with the results ending up as a range. I can't remember the syntax, but it was something like this :- ...

What is a maximum number of arguments in a Python function?

It's somewhat common knowledge that Python functions can have a maximum of 256 arguments. What I'm curious to know is if this limit applies to *args and **kwargs when they're unrolled in the following manner: items = [1,2,3,4,5,6] def do_something(*items): pass I ask because, hypothetically, there might be cases where a list lar...

If monkey patching is permitted in both Ruby and Python, why is it more controversial in Ruby?

In many discussions I have heard about Ruby in which people have expressed their reservations about the language, the issue of monkey patching comes up as one of their primary concerns. However, I rarely hear the same arguments made in the context of Python although it is also permitted in the Python language. Why this distinction? ...

What's the bright side of Cobol?

I love spending my time investigating cool features of languages, even if I won't have a chance to use them anytime soon, but keep hearing only bad things about Cobol, but I'm sure it must of had some nice features for it to become as important as it did. So what would be some good features that could be learnt from Cobol? ...

What is the purpose of python's inner classes?

Python's inner/nested classes confuse me. Is there something that can't be accomplished without them? If so, what is that thing? ...

What's so great about Scala?

What makes Scala such a wonderful language, other than the type system? Almost everything I read about the language brings out 'strong typing' as a big reason to use Scala, but there has to be more than that. What are some of the other compelling and/or cool language features that make Scala a really useful tool? ...

Issues with C++ 'new' operator?

I've recently come across this rant. I don't quite understand a few of the points mentioned in the article: The author mentions the small annoyance of delete vs delete[], but seems to argue that it is actually necessary (for the compiler), without ever offering a solution. Did I miss something? In the section 'Specialized allocators',...

C# Nested null checks in if statements

I have a question on programming style and C# language design in general, I'd love to know if there is a better way to do what I'm doing. If you have a complex data object, with properties that can be null but you want to check or operate on data if it is there, you cannot write a line like so if(Myobject.MyNestedObject != null || Myob...

Is the const value parameter in definition but not declaration really C++?

This is similar to (but different from) this question. Here is some simple test code to illustrate some weridness I have discovered with Sun CC: //---------------main.cpp #include "wtc.hpp" int main(int, char**) { testy t; t.lame(99); return 0; } //--------------wtc.hpp #ifndef WTC_HPP_INCLUDED #define WTC_HPP_INCLUDED class te...

Which are the features of C++0x that will remain for sure (if any)?

Are there any features of C++0x that are known to be there for sure? Like, maybe, threads in the standard library? ...

Does C# have too many language features?

This is a discussion that pops a from time to time in our team. While a few quickly learned C# 3.0 features, other stick with classical techniques. Some never use Linq, think that lambda expressions are confusing and yield is "scary". Sometimes they can hardly understand code that is written by people using all the new features. We can ...

Why is Self assignable in Delphi?

This code in a GUI application compiles and runs: procedure TForm1.Button1Click(Sender: TObject); begin Self := TForm1.Create(Owner); end; (tested with Delphi 6 and 2009) why is Self writable and not read-only? in which situations could this be useful? Edit: is this also possible in Delphi Prism? (I think yes it is, see here) ...

What do you wish was automatic in your favorite programming language?

As a programmer, I often look at some features of the language I'm currently using and think to myself "This is pretty hard to do for a programmer, and could be taken care of automatically by the machine". One example of such a feature is memory management, which has been automatic for a while in a variety of languages. While memory man...