Slashdot: "Favourite Programming Language Features?"

There's a discussion about favoured programming language features on Slashdot.

Unification, parametric polymorphism etc. are mentioned.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


To what extent is garbage collection / automatic memory management (which gets the lion's share of the Slashdot vote) a language feature, and to what extent is it a runtime/environment feature?

C++ with Boehm libraries has GC, but can still do direct memory management. C# has GC "built-in" (to the CLR) and "unsafe" code for when you need to do things like direct memory management. Java and Python have built-in GC and no facility for direct memory management.

I'm not sure what Smalltalk and Lisp can do, if you ask them nicely.


re: GC

GC is related to several other core language features (e.g., tail call optimization, finalization, reference types), so I would definitely not see it is as merely an implementation issue. Languages that mandate GC can be designed to make use of the fact that all implementations will offer GC. Obviously, a non-GC language can have a GC implementation, and a language can be designed in such a way that building a GC implementation would be an easier undertaking (e.g., Ada).

This is similar to what happens with other language features. The interaction between various language features is often subtle, and considering languages by enumerating features is quite a problematic approach.


I'm not sure what Smalltalk and Lisp can do, if you ask them nicely.

CMUCL will let you drop down to the level of C if you're determined to. That includes calling malloc, dereferencing and arithmetic'ing pointers, etc.

See the manual for details, particularly the "System Area Pointers", "Alien Objects", and "Garbage Collection" nodes.

A couple of related low-level CMUCL features are directly calling C functions and using Lisp functions as Unix signal handlers. This is pretty fun. For illustration here's a snippet of a backtrace from the interactive debugger in a program that's handling SIGIO with Lisp code:

  9: (SWANK-BACKEND::SIGIO-HANDLER #<#1=unused-arg> #<#1#> #<#1#>)
  10: ("call_into_lisp+#x8C [#x80546CC] /usr/local/cmucl-19a-pre3/bin/lisp")
  11: ("funcall3+#x29 [#x80544DC] /usr/local/cmucl-19a-pre3/bin/lisp")
  12: ("interrupt_handle_now+#xEE [#x80501CF] /usr/local/cmucl-19a-pre3/bin/lisp")
  13: ("NIL+#x80505EF [#x80505EF] /usr/local/cmucl-19a-pre3/bin/lisp")
  14: ("Foreign function call land")
The mixture of Lisp and C stack frames is quite eye-catching.

The debugger was invoked by sending SIGINT to the process (i.e. the Lisp debugger is the default handler for that signal). From the debugger you can EVAL and poke around in stack frames, and then choose either to continue execution or abort back to some restart-point on the stack. The debugger itself is just a Lisp program that uses the low-level features to parse the stack, etc.

I get a definite "alien technology" vibe from CMUCL.

Related question

What is the minimal number of features that uniquely identify (one of) your favorite language(s)?

Bonus points if your favorite language can be uniquely identified by just one or two features.


One features of one of my favorite languages: Lazy evaluation.

There are probably other languages with lazy evaluation but don't tell me you don't know which one I'm talking about :)

Hmm, let's see...

I can't tell whether you're talking about Miranda, or Clean...? I hear there's also a non-commercial spinoff of Miranda that's lazy... ;)

How about hygienic macros as a uniquely identifying feature of a language? And if that's not specific enough, add continuations to really narrow it down.


I presume ;-)

for large values of 2

1. Every method call can have a closure ('block') attached to it

2. EverythingIsAnObject, but there is syntactic sugar for inline anonymous arrays, hashes and regular expressions



It is a huuuuge time-saver when languages like Perl allow functions to return tuples. Instructions like '($a, $b, $c) = $sth->fetchrow_array()' is a wonderful thing.

Hard to believe people program in languages without such a basic feature! That no language designer with even a cursory understanding of typed lambda-calculus would omit this from a typed language shows the value of a basic grounding in PLT.


.. or in Perl. :-)

Two features

I think there are actually two different features here:

1 - a representation of a tuple can be returned from a function (think structs, records, arrays etc.)

I think most languages have this.

2 - pattern matching assignment (as in the Perl example)

A very cool feature (much safer and more meaningful in a typeful language IMHO). This one is relatively more rare.