24
голосов
24ответов
3041 просмотров

What features should Java 7 onwards have to encourage switching from C#?

C# has a good momentum at the moment. What are the features that you would need to have in order to switch (or return) to Java? It would also be quite useful if people posted workarounds for these for the current Java versions, e.g. Nullables being wrapped around custom classes, to make this a m...

6
голосов
4ответов
1200 просмотров

Convergence of Mathematics and Programming Languages

It seems that there is a strong movement for the convergence of mathematics and computer programming languages, this is notably evidenced by the influence of the lambda calculus on modern languages. Most of the time I do not think with mathematics, I think with logic. It seems to me that many of ...

7
голосов
3ответов
1784 просмотров

How do I overload the in operator in Groovy?

def array = [1,2,3,4,5] println 3 in array prints true. What do I need to overload to support in for any object? Example: class Whatever { def addItem(item) { // add the item } } def w = new Whatever() w.addItem("one") w.addItem("two") println "two" in w I know I could make the...

14
голосов
14ответов
1255 просмотров

A real use for `as` and `is`

I have -never- used as or is in C# or any language that supports the keyword. What have you used it for? I dont mean how do i use it i mean how have you actually need it? I also got away with doing no typecasting in a fairly large c++ project (i was proud). So considering i almost never t...

4
голосов
3ответов
6219 просмотров

How can I get the callee in PHP?

Possible Duplicate: Caller function in PHP 5? I would like to know from where a global function or public method is being called. I guess I could do it by inspecting debug_backtrace but I'd rather use a lighterweight mechanism if one exists. Any suggestions? For example something like...

6
голосов
5ответов
3473 просмотров

How does Smalltalk (Pharo for example) compare to Python?

I've seen some comparisons between Smalltalk and Ruby on the one hand and Ruby and Python on the other, but not between Python and Smalltalk. I'd especially like to know what the fundamental differences in Implementation, Syntax, Extensiabillity and Philosophy are. For example Python does not s...

6
голосов
4ответов
1716 просмотров

Extending javascript with keywords

My Google-ing on this has been unsuccessful, so here's the question: I am wondering if it is possible to add my own keywords to extend the JavaScript language in a given framework. For example Object1 extends Object2 in the code would result in executing this method inherit(Object1, Object...

0
голосов
1ответов
77 просмотров

Keeping track of a value type without making a copy, or "Are there ref fields"?

Is it possible to maintain a reference to a value type so that when changes are made to it my code can see them? Example: i am building a 2D camera for XNA and i want to be able to give it a reference to an arbitrary vector2 so that i don't have to have a special interface or something that eve...

6
голосов
4ответов
388 просмотров

Is there a way of making C# binding work statically?

This probably applies to other places, but in WinForms, when I use binding I find many methods want to take the name of the property to bind to. Something like: class Person { public String Name { get { ... } set { ... } } public int Age { get { ... } set { ... } } } class PersonView { ...

2
голосов
4ответов
1684 просмотров

Does any dialect of Pascal allow a variable number of arguments?

This is a question for the older programmers. Years ago, I encountered a dialect of Pascal which allowed a variable number of arguments, through some kind of extension. Does anyone know of a current dialect of Pascal which allows a variable number of arguments? Given that Pascal is not as pop...

9
голосов
2ответов
5119 просмотров

When to use Processing language?

When it comes to online or desktop presentation we've options like actionscript, java, picolo, flare, prefuse. Now choosing a perfect language for needs is subjective and depends on project. But if you've to choose Processing (language), then on what basis you'll choose? what are the pro's and co...

140
голосов
10ответов
52532 просмотров

Why doesn't a python dict.update() return the object?

I 'm trying to do : award_dict = { "url" : "http://facebook.com", "imageurl" : "http://farm4.static.flickr.com/3431/3939267074_feb9eb19b1_o.png", "count" : 1, } def award(name, count, points, desc_string, my_size, parent) : if my_size > count : a = { "name...

1
голосов
7ответов
285 просмотров

Should const functionality be expanded?

EDIT: this question could probably use a more apropos title. Feel free to suggest one in the comments. In using C++ with a large class set I once came upon a situation where const became a hassle, not because of its functionality, but because it's got a very simplistic definition. Its applicab...

39
голосов
6ответов
29458 просмотров

What is the difference between VB and VBScript

What is the difference between VB and VBScript?

6
голосов
8ответов
267 просмотров

Something similar to sql IN statement within .NET framework?

I have this function: public bool IsValidProduct(int productTypeId) { bool isValid = false; if (productTypeId == 10 || productTypeId == 11 || productTypeId == 12) { isValid = true; } return isValid; } but...

8
голосов
6ответов
4283 просмотров

What are the differences between VB.NET and previous versions of VB?

I'm reasonably familiar with the various forms of VB that existed prior to .NET (VB6, VBA, VBScript...), but have yet to delve into The Sweet New Flavor that is VB.NET. So I would very much appreciate it if someone would provide a quick summary of the major differences in the language brought a...

28
голосов
9ответов
4321 просмотров

Can someone demystify the yield keyword?

I have seen the yield keyword being used quite a lot on Stack Overflow and blogs. I don't use LINQ. Can someone explain the yield keyword? I know that similar questions exist. But none really explain what is its use in plain simple language.

6
голосов
2ответов
966 просмотров

interface for only certain classes?

Can you create an interface which can only be applied to certain classes and subclasses? If my interface is only added to different subclasses of JComponent, and I need to refer to both the methods of JComponent and my interface... how should I do this? Off the top of my head I can accomplish ...

13
голосов
5ответов
2950 просмотров

Is there a way to escape root namespace in VB?

namespace ConsoleApplication1 { class Program { static void Main(string[] args) { System.Text.MyCustom mc = new System.Text.MyCustom(); } } } namespace System.Text { public class MyCustom { } } How do I do this in VB, while having a root na...

16
голосов
4ответов
5367 просмотров

Scala equivalent to Haskell's where-clauses?

Is it possible to use something similar to where-clauses in Scala? Maybe there is some trick I didn't think of? Edit: Thanks for all your answers, they are very much appreciated. To sum up: Local vars, vals and defs can be used to achieve almost the same thing. For lazy evaluation, one can use ...

1
голосов
3ответов
360 просмотров

How to prevent "fat finger syndrome" in absence of req. predeclearation?

For example: on rising edge (reset): sync = defaultValue; ... ... various processing constructs ... ... if (event == someEvent) // Back at the Batcave // The vilianous Fat finger Syndrome // strikes again! synch = someEventProcessing() ... ... various processing constructs ... ... ...

7
голосов
13ответов
625 просмотров

Is JavaScript an application language?

I have always thought of JavaScript as a client-side scripting tool for augmenting the functionality of HTML, which in turn is usually generated by some other server-side technology - Java, .NET, Rails, Django, PHP, etc. Recently though I have heard people talk about JavaScript as an "applicatio...

5
голосов
5ответов
6497 просмотров

How can I pass my locals and access the variables directly from another function?

Let's say I have this : def a(dict): locals().update(dict) print size def b(): size = 20 f(locals()) What do I have to do to access the size variable directly from the a function? I know of : size = dict["size"] but I think there should be a more direct way. I tried using locals(...

1
голосов
2ответов
975 просмотров

Programmatically setting Repeated Parameters in Scala

I'm trying to call Futures.awaitAll with a variable number of well... Futures. awaitAll is defined as awaitAll(timeout : Long, fts : Future[Any]*). I have tried passing in a List and an Array but both won't work: list = future1 :: future2 :: Nil Futures.awaitAll(1000, list) found : List[scala....

-2
голосов
6ответов
448 просмотров

Seemingly Inconsistent "Pass By Value" rules. Was the choice of int [] just syntactic sugar to make array objects look like C/C++ arrays?

I read something online that incorrectly stated that standard int [], etc arrays in Java were passed as copies, rather than passing references to the arrays, in analogy with the basic numerical types, and ended up overwriting an array when I thought I was modifying a copy. Can I chalk this up as ...

1
голосов
2ответов
410 просмотров

Flex : Assignment in Conditionals

If I use an Assignment within conditional, for e.g. if(userType='admin') Flex throws a warning,unlike Java, which throws an error. Why should Flex be doing this, despite being one of the newest languages? 1100: Assignment within conditional. Did you mean == instead of =?

3
голосов
5ответов
1813 просмотров

How-to: short-circuiting inverted ternary operator implemented in, e.g. C#? Does it matter?

Suppose you are using the ternary operator, or the null coalescing operator, or nested if-else statements to choose assignment to an object. Now suppose that within the conditional statement, you have the evaluation of an expensive or volatile operation, requiring that you put the result into a t...

5
голосов
2ответов
2411 просмотров

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?

3
голосов
1ответов
2121 просмотров

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?

4
голосов
1ответов
2390 просмотров

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?