language-features

What is your wishlist for Python 3.2 (or Python 3.x)?

I've just read the What's New in Python 3.1 text (and I like many things). What's your idea of the thing that didn't go there but you would like to see in the future Python versions? ...

Should I Use self Keyword (Properties) In The Implementation?

Hey guys. I believe I understand properties for the most part. My question is, if I have a property for an instance variable, and I am setting or retrieving it from within a method in my implementation file, should I use self.myProperty or just myProperty? I know either one works, but I have seen mixed conventions, sometimes code accesse...

Thread specific memory with language features.

Are there languages that support process common memory in one address space and thread specific memory in another address space using language features rather than through a mechanism like function calls? process int x; thread int y; ...

How can I access the Groovy setter shortcut for multiparameter setters?

Let's say I have a java.util.Properties object. The Properties object has a method called setProperty(String name,String value). Is there a setter shortcut for it? EDIT: maybe the Properties class was not the best example, because I think it handles that by adding the keys as properties. But how about a setter method that takes an arbit...

Best Java 7 features

Possible Duplicate: What new features in java 7 do you find most useful? What are some features that you like in the next version of Java? ...

When and in what language were certain programming features introduced?

Programming has come a long way. I am still relatively young (first Computer: C64), hence I take many things in programming for granted that were obviously introduced at some point and facilitated ways of programming that are now commonplace. What follows is a (by no means complete) list of features, where I would love to know in which ...

Can I be warned when I used a generator function by accident

I was working with generator functions and private functions of a class. I am wondering Why when yielding (which in my one case was by accident) in __someFunc that this function just appears not to be called from within __someGenerator. Also what is the terminology I want to use when referring to these aspects of the language? Can the ...

What is the most dangerous feature of C++?

I've heard lots of times that phrase of Bjarne Stroustrup "C++ makes it harder to shoot yourself in the foot; but when you do, it takes off the whole leg" and I don't really know if it is as terrible as it sounds. What's the worst thing that has ever happened to you (or more properly, to your software) while programming in C++? In which...

How are these type of python decorators written?

I'd like to write a decorator that would limit the number of times a function can be executed, something along the following syntax : @max_execs(5) def my_method(*a,**k): # do something here pass I think it's possible to write this type of decorator, but I don't know how. I think a function won't be this decorator's first argum...

Objective-C Method Types

Hi, I'm just starting to teach myself objective-c and attempting to learn the cocoa touch frameworks, as like many people recently I have developed an interested in a certain little multi-touch device. Anyway, I'm following the Stanford tutorials and I have couple of Objective-C books that im starting to make my way through. While comp...

How to hide (remove) a base class's methods in C#?

The essence of the problem is, given a class hierarchy like this: class A { protected void MethodToExpose() {} protected void MethodToHide(object param) {} } class B : A { new private void MethodToHide(object param) {} protected void NewMethodInB() {} } class C : B { public void DoSomething() ...

Name this python/ruby language construct (using array values to satisfy function parameters)

What is this language construct called? In Python I can say: def a(b,c): return b+c a(*[4,5]) and get 9. Likewise in Ruby: def a(b,c) b+c end a(*[4,5]) What is this called, when one passes a single array to a function which otherwise requires multiple arguments? What is the name of the * operator? What other languages support th...

Mechanism to ensure a loop ends

When I was in college we had a guest lecture from David Parnas. In it he mentioned a mechanism that is used to guarantee that a loop (while loop, for loop, etc.) exits safely at some point. He scoffed at the fact that nobody knew what it was....the sad thing is that years later I dont know either. Does anyone know what this mechanism is ...

Do Redundant Namespaces incur any overhead

Other than maintenance complexity (and I would argue there is little to none), and the fact that it is not a clean solution (this I agree with) does importing redundant namespaces in a .NET class incur any overhead in terms of memory/space/etc.? For instance, if i import My.Namespace but do not invoke any of its functionality, is the Vi...

When do I need to use Begin / End Blocks and the Go keyword in SQL Server?

Can someone tell me when and where I need to use begin and end blocks in SQL Server? Also, what exactly does the Go keyword do? Thanks in advance... ...

Why is the order of declarations important for static initializers?

I have this code private static Set<String> myField; static { myField = new HashSet<String>(); myField.add("test"); } and it works. But when I flip the order, I get an illegal forward reference error. static { myField = new HashSet<String>(); myField.add("test"); // illegal forward reference } private static Set<St...

Is there a way to have callable objects in Groovy?

If for example I have a class named A. Can I make an object be callable, just like Python does? For example : def myObject = new A() myObject() and that would call some object method. Can it be done? ...

What is the most dangerous feature in Java?

Which feature of the Java-language is the source of the most misunderstandings and bugs in your experience? The scope of this question is about the language, not the class-library. ...

How can I add a field dynamically to a Java class using Groovy?

In Ruby I can add instance variables to a class by opening it, and doing something like this : class Whatever def add_x @x = 20 end end and this would add me an instance variable by the name of x. How can I do the same thing in Groovy? ...

How can I intercept execution of all the methods in a Java application using Groovy?

Is it possible to intercept all the methods called in a application? I'd like to do something with them, and then let them execute. I tried to override this behaviour in Object.metaClass.invokeMethod, but it doesn't seem to work. Is this doable? ...