3 ms·
Ask HN: Features in a language
Consider your ideal language(s). Some people love the "I don't have to think about it"-ness of garbage collection, others hate the "I don't know when this destructor will be called" effect. Yes, I know these are not exactly opposites, and that different languages have semantics and pragmatics that vary from a little to a lot.
So here, let me ask: What must a language do and have?
For you, for your programming style and purpose, must a language have GC? Must it have strings? Must it be able to take a list of any type and act on it?
In Python you can define the "length" function like this:
length = lambda L: sum(map(lambda x:1,L))
or like this:
def length(L):
if L==[]: return 0
return 1+length(L[1:])
and you don't have to worry about the types held in L. Does that matter to you?
What really matters? When I get enough answers, if I get enough answers, I might turn this into a poll.
- madhouse 16y agoIt all depends on what I want to do. For quick hacks, I prefer a language that supports that: perl or python (since that's the two I know well enough). When writing programs to a very limited platform, I'd rather use something I can control much better, which is most often C. Other times, I don't really have a choice: if I'm writing a web application, there's not much else than JavaScript that I can use on the client side (assuming I want to be reasonably portable, and don't want to use flash). I tend to use whatever language fits the job at hand best, since they all have stronger and weaker areas.
- DanielStraight 16y agoAbsolute necessity: Garbage collection Built-in (or included library) types: string, integer, decimal (precise, not floating-point), boolean, list, dictionary If statically typed, generics First-class, anonymous and inline functions, as well as closures, or at least some convenient way to imitate these Really, really nice to have: If statically typed, type inference List and dictionary literals Consistent naming of all included code Operator overloading Map/select and filter/where functions on built-in list type (preferably all the functions of IEnumerable in .NET and then some) If it wasn't obvious from that list, my favorite language is C# (at least version 3.5 or newer).