views:

2205

answers:

94

I always miss python's built-in doc strings when working in other languages. I know this may seem odd, but it allows me to cut down significantly on excess comments while still providing a clean description of my code and any interfaces therein.

  • What Language Feature Can You Just Not Live Without?

If someone were building a new language and they asked you what one feature they absolutely must include, what would it be?

This is getting kind of long, so I figured I'd do my best to summarize:

Paraphrased to be language agnostic. If you know of a language which uses something mentioned, please at it in the parenthesis to the right of the feature. And if you have a better format for this list, by all means try it out (if it doesn't seem to work, I'll just roll back).

Regular Expressions ~ torial (Perl)

Garbage Collection ~ SaaS Developer (Python, Perl, Ruby, Java, .NET)

Anonymous Functions ~ Vinko Vrsalovic (Lisp, Python)

Arithmetic Operators ~ Jeremy Ross (Python, Perl, Ruby, Java, C#, Visual Basic, C, C++, Pascal, Smalltalk, etc.)

Exception Handling ~ torial (Python, Java, .NET)

Pass By Reference ~ Chris (Python)

Unified String Format WalloWizard (C#)

Generics ~ torial (Python, Java, C#)

Integrated Query Equivalent to LINQ ~ Vyrotek (C#)

Namespacing ~ Garry Shutler ()

Short Circuit Logic ~ Adam Bellaire ()

+39  A: 

Anonymous functions

Vinko Vrsalovic
But only if they're also closures.
Steve Jessop
Yeah. Closureness is far more interesting that anonymity. Naming things isn't hard. Duplicating closures without language support is.
Jay Kominek
+9  A: 

Namespacing

Garry Shutler
+44  A: 

Regular Expressions.

torial
Are regular expressions really a language feature?
Paul Batum
Absolutely, consider VB6 which had no real Regex support. You had a lot more hoops to jump through to do the same work.
torial
Regex is great, but it isn't really a language feature.
Landon
It is a language feature in Ruby and Perl. They are my favorite.
TonyOssa
As syntactic sugar goes, regex literals and operators (=~ s/// in Perl for example) are pretty nifty. But a regex library without language support isn't a "language feature", and is still considerably better than a poke in the eye with a sharp stick
Steve Jessop
And SQL Server has no regex support..
jcollum
+19  A: 

Pass by reference

Chris
+8  A: 

Generic Containers (.Net)

torial
+6  A: 

Generics and Enums (Java 1.5)

GHad
Java 1.5 Enums are indeed awesome! I've written some recently that have just mutated into something incredible. It's amazing what happens when you define an enum and then say, "Okay, each one of these [Type]s knows how to ..." and then list behaviors.
skiphoppy
+15  A: 

Unified string format (unlike C++, like C#)

WalloWizard
+7  A: 

Delegates in .NET..

Don
+3  A: 

A way to apply a function to all/some/any elements on a collection in a single statement

Vinko Vrsalovic
+9  A: 

Reflection.

torial
+19  A: 

Definitely Generics...

RWendi
A: 

Reflection, serialization, generics,... (C#)

starec
+20  A: 

Exception Handling :-D

torial
+1  A: 

with .. do (Delphi)

mwore
+3  A: 

Conditional compiling

#if .. #then .. #else

Horcrux7
+2  A: 

Attributes/Annotations

EricSchaefer
+18  A: 

Turing completeness... (Well, duh.)

Kevin Little
Welcome to INTERCAL.
Steve Jessop
How did you get your company to buy you infinite storage!
Aidan
Nah. Sometimes it's good to work with languages that only describe programs that must terminate. But +1 for not being a wimp.
Charles Stewart
Perhaps he meant Turing equivalence? Nah...
Gabe
+8  A: 

Clean consistent syntax which is easily scanned and reads naturally (like poetry). I've always felt strongly that language code should speak best to people, and tell the story of what it does. Let the compiler/interpreter figure out how to instruct the computer...

Kris
+57  A: 

Garbage Collection

SaaS Developer
Yes, yes, yes. I don't know how I made it through 5 years of manual memory management...
TonyOssa
+2  A: 

With keyword in VB.NET

adriaanp
+2  A: 

Turing complete... :)

daniel
+9  A: 

The foreach statement in C#

Petter Wigle
+11  A: 

.Net LINQ !

Vyrotek
LINQ specifically, or FP techniques in general?
Matt Briggs
+2  A: 

Ruby's Closures

Pablo Fernandez
That's Lisp's closures to you. Although I still agree: closures and anonymous functions should be part of the standard language toolkit.
Steve Jessop
I heard they first appeard in Lisp. But i knew them while learning ruby/javascript.I suggested ruby ones since ruby's "annonymous function literal" is clean and beautiful
Pablo Fernandez
A: 

Single and double hash in macros...

epatel
+26  A: 

Couldn't live without arithmetic operators.

Jeremy Ross
Small things make life better, for sure... :-P
PhiLho
Not an Intercal fan, I see.
David Thornley
+1 not wimpy. But, you know, the lambda calculus doesn't have any arithmetic built-in, and I don't use sh's arithmetic facilities all that much...
Charles Stewart
A: 

Any language should support some way of creating abstractions and allow tasks decomposition.

Yacoder
Why? Machine code is perfectly useful.
Charles Stewart
@Charles Stewart: If that machine supports instructions similar to call and ret/retn (of x86 asm), I'm fine with it =)
Yacoder
Bah! x86 assembler is mollycoddling softness. When I were a lad, microprocessors had four-bit data buses and no fancy stack abstractions.
Charles Stewart
Good for you!!!
Yacoder
+9  A: 

variable declarations :)

mattlant
+2  A: 

list comprehensions

Ed L
+10  A: 

I can't live without if-else

mbac32768
+1 not wimpy. But, well, the lambda calculus doesn't have if-else and gets by just fine with true and false combinators.
Charles Stewart
test combinator ftw
mbac32768
+4  A: 

Variable name declarations. When I realized that both Python and Ruby gladly will interpret your fat-fingerings as the introduction of a new variable, I was really, really horrified. It made me thankful once again for Perl's use strict and my $var declarations.

Dave Rolsky
Could you elaborate on what you mean by "introduction of a new variable"? In Python, new variables can only be introduced by an assignment operation (well, there are some other ways, let's forget those for now), but an access to an undefined variable will always lead to an exception.
Torsten Marek
I think that's what he means - typo an assignment to "mything" and you create a variable called "mythign". Which probably wasn't what you wanted. With formal variable declarations this doesn't happen. Perl's warning about only using a variable name once is nice, though.
Steve Jessop
Yes, what he said ^^With Perl (in strict mode, which any sane developer uses 99.9% of the time), this doesn't work: my $thing; $thign = foo();Perl recognizes the fact that you haven't declared the $thign variable and gives you a nice helpful error.
Dave Rolsky
the number 1 reason that I hate PhP.
WolfmanDragon
+3  A: 

The ability to define DSLs, incorporated directly into the language. As easy to define an operator in the custom DSL language as it is to define a normal function in the "plain" language.

Writing my code as a description of the problem using a vocabulary that fits the problem and lets me focus on the hard parts, instead of writing low-level plumbing and boilerplate code.

Lisp macros.

Mikael Jansson
+23  A: 

short-circuit logic. Seriously, try programming VBscript for a while and you'll be begging to be able to do this:

   if (foo.exists && foo.var > 0)

and not have it crash...

tloach
I second that - very annoying.
Uros Calakovic
I miss short circuit evaluation when I am forced to do things in Excel, too.
Coxy
+2  A: 

*args and **kwargs in Python.

Torsten Marek
+2  A: 

a [plus equals] b

shogun
+3  A: 

Hashtables, hashmaps or php arrays :D

iBobo
+2  A: 

"first class functions" aka "functions as first class objects"

whoisjake
A: 

Symbolic names.

+2  A: 

Parametric polymorphism and dependent types.

DrPizza
A: 

Subqueries in SQL

Matthew Watson
+6  A: 

comments: single or multiline.

Kevin
A: 

Solid: the iterator ++ -- etc...

Abstract: recursion (once I 'got' it)

defmeta
+1  A: 

User-Friendly Exception Handling ;)

A: 

HTTP(s) support

codemeit
+1  A: 

ColdFusion's cfdump

Use the cfdump tag to get the elements, variables, and values of most kinds of ColdFusion objects. Useful for debugging. You can display the contents of simple and complex variables, objects, components, user-defined functions, and other elements.

There's nothing that cfdump can't do :D

Now that I'm messing with .NET, this is by far the most useful feature of ColdFusion that I wish I could replicate (of course, when I do JavaScript I wish for it as well :D ).

James Skemp
A: 

command line compiles

SqlACID
+1  A: 

the language feature I am missing is "remove all bug". Might have to be implemented as a compiler option though, so that oldtimers can continue to do without that feature.

Serious answer: Templates/Generics

A: 

In C#, the Using () {....} blocks have solved more memory leaks than I can count.

Kind of goes with garbage collection, but more specific.

Doug L.
+3  A: 

Pointers!

Really, I'm an old C fart. I cannot live without them anymore..

Nils Pipenbrinck
A: 

Locking for thread safety

Nick
A: 

Attributes in .NET. Once you really understand them and learn how to use them properly (that is, not to overuse them), it opens up a whole new world (now I'm exaggerating a bit).

petr k.
A: 

For in statement for object inspection.

+5  A: 

Lambdas for sure.

+1  A: 

I'm a big fan of functions.

donair
A: 

Tables. Those save me a lot of the headache I had with plain arrays.

Daddy Warbox
A: 

pointer to methods (C++)
well, maybe I could have lived without it but its neat non the less.

shoosh
+1  A: 

Scoped Guards (for RAII.)

Sorry, C# - other than that, I think you're swell.

Matt Cruikshank
+7  A: 

Object-orientation! I can't believe nobody seems to have said this!

skiphoppy
Maybe everyone can live without it :-P
Hamish Downer
to quote rich hickey "OO is the new spaghetti code"
Matt Briggs
+3  A: 

Multi-dimensional Arrays.

Fernando Barrocal
+1  A: 

operator overloading

computergeek6
+3  A: 

Extension method of C#

cvs
A: 

Good collection classes.

Kendall Helmstetter Gelner
+2  A: 

Got to say reflection. It really empowers you to do great stuff in statically typed languages.

Tom
A: 

.NET Generics

Johannes Hädrich
A: 

first class functions and lexical scope!

Steve
A: 

Operator overloading (Python-style, a la str())

Dan Udey
A: 

Static type inferencing.

Mark Cidade
+3  A: 

Properties

Mark Cidade
Definitely. Many benefits here.
Patrick Szalapski
+2  A: 

LINQ to XML. Seriously :)

With the incredible proliferation of XML used across business problem domains, LINQ to XML can generally turn hundreds of lines of terrible, unmaintainable code into a 10-line query.

Gabriel Isenberg
A: 

The lower half of the right brace }

Lasse V. Karlsen
+1  A: 

Introspection combined with running interactively to try out things live. (Python, Perl, Ruby and others I'm sure)

Hamish Downer
A: 

Assignment ;-)

André
A: 

Closures.

(First-class functions in general, but those are implied.)

Rich
A: 

Delimited continuations. When you can express the future of the computation as a series of composable partial evaluation control structures nested within one another like Russian dolls, going back to iteration seems so mundane. ;)

Granted, when your standards are this high, it severely limits your available programming languages.

Kyle Cronin
+1  A: 

Argument defaults a la Python and PHP

>>>def foo(bar='baz',qux='42'):
...  print bar + ' ' + qux

>>>foo('hello')
'hello 42'
akdom
+3  A: 

Dot.Notation as opposed to arrow->notation, (notation prefix), or function(call(everything))

Mark Cidade
A: 

A full list would comprise the API documentation for a small programming language. I'm also seeing things here that would be a poor fit for certain applications, so I'm trying to list things that aren't ubiquitous, but probably should be.

First-class functions, preferably with a good function literal syntax. Ruby is good here. Arc and Clojure are great. (Missing from Java, PHP and only available in a roundabout way in C and C++. I think C# has some form of this with LINQ.)

Namespaces, packages or some similar way to control what names are visible where. (Missing from Emacs Lisp and, until recently, PHP.)

Pretty much everything else I can't live without is ubiquitous in modern general-purpose languages. A discussion of what features you can live without might be just as interesting, and probably more controversial.

Zak
A: 

LinkedHashMap. Use them once and you will love them forever.

WolfmanDragon
+2  A: 

Good user community!

Mark Harrison
+1  A: 

I can't live without introspection anymore...

BloodySmartie
+1  A: 

good documentation

php and python, java

A: 

Generics and LINQ

andy
A: 

meta-programming features: -runtime class and methods definition (ruby) -method_missing , being able to catch all calls to non-defined method and act with a custom logic (eg: ActiveRecord dynamic finders)

Maximiliano Guzman
A: 

Without a doubt, the one feature that I just can not live without is variables.

BigDave
A: 

I require sensible rules for the declaration of variables. This specifically excludes old time Fortran, with the I-N (?) implicit integer rule. I hated that so much that there is a tumor in my brain at the location of the memory. Well, back to the current century...

The "sensible rules" feature has several components, so I can mention several things, right? A language must have declaration scoping - the ability to keep variable names local to a block of code. Even assembler languages must have local code labels (branch points); The language must be able to flag (or deny) implicit declarations, and detect the use of a variable before initialization.

gary
A: 

Destructors

[extra characters to exceed limit 15]

maxim1000
A: 

var keyword in c#

iChaib
A: 

I can live without just about anything. Starve me of anonymous functions, make me manage memory without even malloc/free, omit arithmetic or Booleans - fine, if there is some point to the restriction. Absence of both iteration, backwards branches, and recursion: yes, that too.

One thing, though: I think I do want something corresponding to conditionals, be it an if test facility, or lambda-calculus-like true and false combinators, or sh-like &&s and ||s on exit status. Without that, well, it's not really programming, is it.

Charles Stewart
A: 

Closures, closures and closures. I also come from the Ruby world and I am now using Scala, I can say that the Scala's type system is something I really love. It makes it easier to test, since all type related things are tested by the Scala compiler. Also, Erlang's and Scala's Actors are really really nice. :)

Pekka Mattila
+1  A: 

Symbolic representation - I just don't fancy machine code.

justkt
A: 

Deterministic destruction of objects (as in C++ and Delphi, unlike Java and .NET), typesafe containers, static type system are some of the most improtant features to me.

Nemanja Trifunovic
A: 

polymorphism & heritage

Ephemere
+1  A: 

Strings

As funny as it may sound, certain languages lack proper official/standard/renowned string support, namely C (especially) and C++. In other languages, strings look like a last minute add-on class (namely Java), others portray it beautifully, namely Delphi, PHP and Javascript.

Some people prefer a large array of choices, such as the hundreds of string options in C++ (std::str, QString, nsString, gchar* and char*, to name a few).

Others prefer a more low level approach, such as C's chars, where you manually allocate memory when concatenating (and calling such functions to do this stuff).

Personally, I prefer the easy approach, where "a"+"b"=="ab", regardless of object reference, or any other limiting language construct.

Doesn't exist yet? Many interpreted languages do this by default. Some compiled languages, such as Delphi, has supported this from day one.

Why does bad habits keep on being transmitted forward?* It is the dependence on these low-level (and bad) coding that result in many of the known buffer overflows etc.

* Even as I speak, "modern" institutions still teach undergraduates (ie people with their next step in life being "work") the use of strings via C's char*!!

Christian Sciberras
A: 

Statically typed

Chris B