programming-languages

Are there any programming languages with functions with variable arguments not at the end?

Python, C++, Scheme, and others all let you define functions that take a variable number of arguments at the end of the argument list... def function(a, b, *args): #etc... ...that can be called as followed: function(1, 2) function(1, 2, 5, 6, 7, 8) etc... Are there any languages that allow you to do variadic functions with the ...

Why does Flex's ArrayCollection's Contain method look at memory reference?

When using .contains() on an ArrayCollection in Flex, it will always look at the memory reference. It does not appear to look at an .equals() method or .toString() method or anything overridable. Instead, I need to loop through the ArrayCollection every time and check each individual item until I find what I'm looking for. Does anyone...

JavaScript parser in Python

There is a JavaScript parser at least in C and Java (Mozilla), in JavaScript (Mozilla again) and Ruby. Is there any currently out there for Python? I don't need a JavaScript interpreter, per se, just a parser that's up to ECMA-262 standards. A quick google search revealed no immediate answers, so I'm asking the SO community. ...

Post an implementation of simple Merry Xmas or Happy holidays in your favourite programming language!

Happy Christmas/[enter your festivity here] everyone! perl -e '$a="How does stAckoverflow PeoPle implement \"happY Holiday\" prOgrams in Language of theIr choice toDAY, chriStmas eve?"; $a=~ tr/[A-Z]//cd; print $a;' ...

What is the difference between abstract function and virtual function ?

Which is the more correct approach? In which cases is it recommended to use virtual or abstract? ...

Inadvertent use of = instead of ==

It seems that if (x=y) { .... } instead of if (x==y) { ... } is a root of many evils. Why don't all compilers mark it as error instead of a configurable warning? I'm interested in finding out cases where the construct if (x=y) is useful. ...

PHP Readonly Properties?

In using PHP's DOM classes (DOMNode, DOMEElement, etc) I have noticed that they possess truly readonly properties. For example, I can read the $nodeName property of a DOMNode, but I cannot write to it (if I do PHP throws a fatal error). How can I create readonly properties of my own in PHP? ...

Convention for prototype inheritance in JavaScript

I see a lot of code like this: function Base() {} function Sub() {} Sub.prototype = new Base(); However, if you do: s = new Sub(); print(s.constructor == Sub); This is false. This seems confusing to me, since s's constructor is, indeed, Sub. Is it conventional/better to do this? function Base() {} function Sub() {} Sub.prototype =...

Switching from Java to C++ - what's the easy way?

I have ~2 years of experience in Java programming, and it is basically the first programming language I have made serious and intensive use of. Currently, I need start switching to C++ for some assignments I have. Up until now I have been very comfortable with Java, and it's concepts made lots of sense to me. Just off the top of my head...

Ruby: More flexibility than Java/C#?

Is is that I'm a newbie learning Ruby, or does it really have more ways to write (the same) things than Java/C#? Also, if it is more flexible than Java, are there any linguistic features of Ruby that are generally not used to avoid confusion? Examples might be parallel assignment and all the different ways to write Strings, perhaps? No...

What are the trade-offs between languages that terminate statements with semicolons and those that don't??

Are there any benefits to languages that terminate statements with a semicolon (C, Perl, etc.) compared with those that don't (Python, Ruby, etc.), or vice versa? (Note to late-comers: the original title and question asked about "do you trust languages that don't use a semi-colon"; it was rewritten to be less argumentative. Some of the...

What programming languages are the following commercial programs written in?

I was always curious what languages these pieces of software were written in? Visual Studio Microsoft Office Adobe Acrobat Google Chrome Firefox ...

Programming Language Choice - Longevity and Community

I work for a start up that is currently researching what programming language they will adopt. The following criteria have been identified by management. The language will be used to develop web based applications. Having a system that allows for easy generation of business reports would be a bonus (iReport, Crystal Reports) Longevity...

What's The Best Language For creating a Social network?

I'm a newbie programmer looking to start a niche social network. I'm looking for opinions on what you guys believe is the best language to create it in. It's a mixed media site with all the usual functions including: profiles user to user messaging new feeds individual user blogs user video/picture galleries I am not willing to use...

Should integer divide by zero halt execution?

I know that modern languages handle integer divide by zero as an error just like the hardware does, but what if we could design a whole new language? Ignoring existing hardware, what should a programming language does when an integer divide by zero occurs? Should it return a NaN of type integer? Or should it mirror IEEE 754 float and ...

Lazy evaluation in C++

C++ does not have native support for lazy evaluation (as Haskell does). I'm wondering if it is possible to implement lazy evaluation in C++ in a reasonable manner. If yes, how would you do it? EDIT: I like Konrad Rudolph's answer. I'm wondering if it's possible to implement it in a more generic fashion, for example by using a parametr...

Should I learn what the market wants, or what I think is cool?

A little subjective question here, but here goes. I'm not a great programmer, by any means - I admit this freely. I dabble in .NET but haven't really used it in a while, so I know little more than the basics. I live in an area that is entirely .NET centric and everything else is pretty much unknown. I've been looking at learning Ruby...

What are core concept differences between C++ and C#?

Let assume one knows C++, what are the main concepts that can confuse them/that work differently when using C#? I do not mean the syntax differences but for example how references works, what "replaces" pointers, etc. or how the idea of managed code affects developer experience? EDIT: Thanks to Chris for pointing out this great blog po...

What would be a good functional language to pick up?

I come from a background of a large variety of languages but my only experience with functional programming languages was a brief stint with OCaml. I want to dive a lot deeper into one of these languages (Lisp/Scheme, Erlang, Scala, Haskell, etc.) but I want it to hopefully be one that is practical in working environments and also has a ...

Language for non-programmers to start learning programming

A non-programmer friend will be starting the Computer Science college course in a few months. I'd like her to try her hand at some programming before she starts her studies (the course itself expects one to know C, but it's an horrible language to learn to program at). What language would be the best to do so? Related question: Best way...