language-features

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 con's of processing in your opinion? ...

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 popular as it used to be, I wouldn't be surpr...

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 { void Bind(Person p) { name...

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 everything has to implement. Is this possible...

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, Object2) Where inherit is a function that take...

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 seem to have Metaclasses. Smalltalk has no ...

How can I get the callee in PHP?

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 so, if you imagine the get_callee() function and constant existing: function doSomething() { ...

What are the advantages of using Prolog over other languages?

Every language that is being used is being used for its advantages, generally. What are the advantages of Prolog? What are the general situations/ category of problems where one can use Prolog more efficiently than any other language? ...

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 typecast why do i need the keyword as or is...

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 collection this class uses public, but I'...

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 the phenomenon that can be modeled mathema...

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 much more interesting wiki. ...

What's this language token/keyword/thingy mean?

At the following URL: https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsICacheVisitor is the following code chunk: boolean visitDevice(in string deviceID, in nsICacheDeviceInfo deviceInfo); I thought I was dealing with c++, but "in" is not a c++ keyword according to c++ keyword lists i looked up, nor is it a java keyword. S...

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

Java is a popular language & platform, having a huge ecosystem. Are there any features that C# 4.0 onwards and its platforms should have, to make you completely switch to C# programming? ...

How can I find the current windows language from cmd?

I would like to run a script for each language. I need a way to find wich os language is being used, using batch files. Both on windows XP, and on Windows 7. Thanks ...

What is significance of static keyword in Java and in C++ ?

What is the importance of Static keyword in Java and in C++ and how it's functionality differ in both programming languages ? ...

What tools are indispensable for programming in a certain language?

I've recently been implementing my own programming language, mostly to get a feel for what it takes and hopefully to understand quirks of other languages better. I've mostly finished the language itself, so, since I like this project, I'd like to write some development tools for it. What tools would you consider indispensable? For now, ...

Why isn't the eigenclass equivalent to self.class, when it looks so similar?

I've missed the memo somewhere, and I hope you'll explain this to me. Why is the eigenclass of an object different from self.class? class Foo def initialize(symbol) eigenclass = class << self self end eigenclass.class_eval do attr_accessor symbol end end end My train of logic that equates the eigenclas...

Does Java have Automatic Properties?

In c# you can setup properties like this: public int CustomerId {get;set;} Which sets up an automatic property called CustomerId, but I was wondering if there was anything similar in Java? ...

LINQ's FirstOrDefault in SQL script?

Hello! What is the SQL language keyword for the LINQ-to-SQL FirstOrDefault or SingleOrDefault? Is it TOP(1)? EXAMPLE: SELECT TOP(1) @ItemCode = ItemCode FROM VendorItem WHERE VendorId = @VendorId There can't be more than 1 results anyway since there is a Unique Key constranint, do I have to spell out the TOP(1) or whatever it is? ...