Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which programming language allows to update any class on-the-fly?

I am wondering, are there any languages allows you to add/delete/update any class on the fly without reloading whole application? (Provided that I can accept some inconveniences like making sure that there is no methods running at the moment + some extra effort to 'migrate' class data members).

Web applications where you replace 1 file and it is used on the next client request is not what I need (like Perl, PHP). Application must be continuously running, and it have some internal state.

Other requirements are

  1. No GIL or similar issues preventing from utilizing SMP
  2. Preferably - existence of JIT-like VM (i.e. where performance is close to native code). Ideal solution would be to be able to reload module in CLang or any other LLVM-based language. It would be just perfect.

About the answers already made:

  • .NET/Java is not suitable - they both have too bulky VM's, and significant part of app will be running on Linux.
  • Erlang - looks like it's possible, but it's terrible for my naked eye, I just cannot look calm at it's if's, case's and strings. Also, I would prefer to avoid transfering bare sources to clients, compiled bytecode would be much better.
like image 789
BarsMonster Avatar asked Mar 12 '11 17:03

BarsMonster


4 Answers

Erlang was designed to support hot code swapping as one of its high availability features.

like image 94
geekosaur Avatar answered Oct 02 '22 10:10

geekosaur


Objective-C might fit the bill. You can use the functions documented here to add new classes and swap method implementations at runtime, and you can load new NSBundles with additional classes or categories on existing classes if additional implementations are required. GNUStep, while not implementing all of the recent Apple additions to the language, does claim to implement these features (see [1] and [2]).

like image 38
Anomie Avatar answered Oct 02 '22 10:10

Anomie


The following are generally considered dynamic languages:

  1. ActionScript
  2. BeanShell
  3. Common Lisp and some other Lisps
  4. Groovy
  5. JavaScript
  6. VBScript
  7. Matlab
  8. Lua
  9. Objective-C
  10. Perl
  11. PHP
  12. Python
  13. Ruby
  14. Smalltalk
  15. Tcl
  16. ...

Some of these languages are supported in the .NET Framework by the Microsoft Dynamic Language Runtime.

like image 40
Andrei Andrushkevich Avatar answered Oct 02 '22 08:10

Andrei Andrushkevich


What type of application are you trying to write? On what platform?

The question of GUI vs. Server may rule things out as will linux vs. windows.

The following languages are dynamic:

  • Smalltalk
  • Perl
  • JavaScript
  • VBScript
  • Ruby

Modern JavaScript is currently in an arms race to be as fast as possible, so should be pretty quick on any platform.

like image 24
Ben Avatar answered Oct 02 '22 10:10

Ben