Slashdot Mirror


Lightweight Scripting/Extension Languages?

Andy Tai asks: "Extension languages are designed to be embedded in applications to support customization of the application behavior. Common scripting languages, like Perl and Python, are fairly 'large' with powerful run-time engines and libraries and are widely available and 'script' writers usually assume their stand-alone existences in the deployment environment. However, if one is looking for a language that's small enough so its source can be embedded in the distribution of and built as part of the application, Python and Perl may be 'overweight.' For the real lightweight choices there are Lua and Tinyscheme. Are there others? What are people's preferences and opinions regarding lightweight extension languages?"

176 comments

  1. Anything but odd/new language... by cymen · · Score: 2, Insightful

    Is PHP/Perl/Python too big? Just use them. I don't care about a couple more megs of system RAM. RAM is cheap. Learning a new language takes time.

    Unless there are extremely good grounds for using some annoying new/odd language, use something mainstream.

    1. Re:Anything but odd/new language... by awgriff279 · · Score: 2, Insightful

      I would agree with this, except that it makes for somewhat inefficient programs when one blows a couple extra megs of ram. Efficient, small programs are better long run because they are easier to maintain and run faster. However, for a hack, macgyver job nearly anything can be used.

    2. Re:Anything but odd/new language... by Anonymous Coward · · Score: 2, Informative

      Assuming you already know at least one other language, learning LUA takes exactly 1 hour. That's it. Spend an hour on it, and you are a master LUA programmer. That's a big part of its appeal.

    3. Re:Anything but odd/new language... by svanstrom · · Score: 1
      Is PHP/Perl/Python too big?


      Yes, it's HUGE, when you're adding it to the software you've written yourself; and it's seriously overkill if you only want people to control a few things inside you're own program.

      Take a look at AppleScript, a beautifully simple way to control GUI-apps on a Mac.
      --
      perl -e'print$_{$_} for sort%_=`lynx -dump svanstrom.com/t`'
    4. Re:Anything but odd/new language... by JohnFluxx · · Score: 2, Insightful

      I agree - especially as python can be really tiny.

      Also, read this:

      Extend vs Embed

      Often people only think of putting python(etc) inside their program, rather than the other way round - putting their program inside of python. Read the above link.

    5. Re:Anything but odd/new language... by arkanes · · Score: 1
      It's a good rant but it's not really very relevent - writing your app in python (at least in the way he describes) simply isn't plausible if you're writing an app for commercial or even mass distribution - you can't rely on an existing Python installation and if you've got to package one with your installer then theres hardly any more work to embed an interperter instead.

      Thinking on the popular applications out there that I know of that embed Python, you wouldn't want to write ANY of them in Python. Blender? Temple of Elemental Evil?

      And, of course, the rant just ignores the best reason of all - if you don't WANT to write your app in Python.

    6. Re:Anything but odd/new language... by JohnFluxx · · Score: 2, Informative

      I think you misunderstand.
      say I have a program, written in C, and I want to add full python scripting support.

      One way would be to try to add in the python interpreter into the program, and this is the way you immediately think of.

      The second way would be to have a small python program that calls your program (so all you rewrite in python is your main() function and the function that does event handling.)

      The link I provided gives reasons on why they consider the second way better.

    7. Re:Anything but odd/new language... by SilentStrike · · Score: 1

      " It's a good rant but it's not really very relevent - writing your app in python (at least in the way he describes) simply isn't plausible if you're writing an app for commercial or even mass distribution - you can't rely on an existing Python installation and if you've got to package one with your installer then theres hardly any more work to embed an interperter instead."

      The difficulty from doing the mixed langauges thing doesn't come from smacking the intepretter binary somewhere, but rather from the bindings between the langauges. His argument is essentially that it is easier and more flexible to call C from Python, than Python from C.

      "Thinking on the popular applications out there that I know of that embed Python, you wouldn't want to write ANY of them in Python. Blender? Temple of Elemental Evil? "

      Extending Python doesn't mean the whole program must be in Python, it just means that the program flow has Python calling into C, rather than C callinng into Python. Extending doesn't mean that the performance critical portions must be written in Python. Essentially, when you write in Python first, and then replace the slow parts with C, you are more closely following the "premature optimization is the root of all evil" saying.

      "And, of course, the rant just ignores the best reason of all - if you don't WANT to write your app in Python."

      I agree here. The bottom line is it's a question of who is going to wear the pants. But if you do like Python, and are going to use it anyway, why not really take advantage of it? Relegate the lower-level langauges to things which need to run fast.

    8. Re:Anything but odd/new language... by RevAaron · · Score: 1

      And what's even cooler about AppleScript is that there is more to it. AppleScript is merely the default plug-in for the Open Script Archtecture (OSA) into which other languages can plug. I've seen Tcl, JavaScript, Perl and Ruby and there are more. Allows those other languages to call into your Mac apps in the same way AppleScript can- slick as snot man.

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    9. Re:Anything but odd/new language... by RevAaron · · Score: 1

      Don't get me wrong, Lua is an awesome language. Tiny, but not pokey, quite flexible- a real language. Yes, you could learn the basics and be writing some code in an hour, but you could never master it. The only language I know that could be mastered in an hour is PILOT.

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    10. Re:Anything but odd/new language... by boelthorn · · Score: 1

      Consider using Common Lisp as extension language. (For a more controversial aspect: Consider to write your program in Common Lisp) It has a ANSI standard, some very good compilers and all the things you want of a scripting language if you want to use it as such.

      I have personally used ECL (Embeddable Common Lisp) to write a Common Lisp plugin for X-Chat which works very well.

    11. Re:Anything but odd/new language... by Christopher+Cashell · · Score: 3, Insightful
      There are dozens of available library implementations of reasonably well known languages. The trick is simply finding which one fits best for you. And, depending on the application, and how it's used, you might want to consider created a more generalized plug-in architecture, and allow for multiple scripting languages (possibly using something like CORBA).

      One thing I would strongly urge, is to pick a "real" language that already exists. Ideally, something like those listed below. Even if it's a fairly uncommon language that you personally aren't familiar with, the fact that it's in use in the real world means that more people will be familiar with it, and that it will likely be a more stable and usable solution.

      Creating a brand new language just for your application is a gauranteed way to annoy people because there is no chance that they will know the language before using your application.

      Here are some possibilities, depending on what you're looking for:

      Scheme/Lisp* based:
      • librep, used by Sawfish
      • Guile, the official GNU extension language
      • Elk, designed from the start as a small embeddable library
      • tinyscheme, another small implementation designed for embedded use
      • SIOD, a very small implementation that can be easily customized for your application
      • Kawa, a Scheme enivornment written in Java, that compiles Scheme code to java byte-codes, is an excellent choice for use in a Java application
      • Embeddable Common Lisp, while not as small or lightweight as most Scheme implementations, does a pretty decent job

      For larger (and more common) languages, you can choose from:
      • JavaScript/ECMAScript, this is a great choice as it was designed to be used as an extension language, and there are at least a couple of free/open source implementations available. . . and it's use in web browsers/web pages has made it a very well known language
      • eperl, an embeddable form of Perl
      • Python, though not ideally setup for this, can be embedded in another program
      • tcl, tcl was designed parly for use as an embedded scripting language, and works fairly well in this regard

      Some less well known, but still "real" languages that can make an excellent extension language include:
      • ficl, an implementation of Forth that's designed for embedded use
      • Lua, a language that was designed specifically to provide a small but powerful language for embedded use
      • S-Lang, a progammers library that provides a console GUI library and an extension language (used by jed, slrn, newt, mutt (optional), etc
      • cint, a C language style interpreter could probably be used easily enough
      • ch, another c interpreter
      • Bean Scripting Framework, BSF, is a great choice for java applications, as it provides a framework to use a numer of different languages, providing greater choice
      • Scriptix, an extension language with a C/C++ style syntax that evolved out of MUDix
      • ferite, an interpreter with "similiarities to perl, python, C, Java and pascal", and designed for embedded use
      • bsh, or BeanShell, is a small embeddable Java interpeter, written in Java, and has some extra "bonus" features of particular interest to scripters

      * Scheme, due to it's small size and powerful, easily extendable syntax, seems to be quite common when it comes to extension langauges. A list of programs that use Scheme (or a similar lisp dialect) off the top of my head includes: SIAG Office, The Gimp, Emacs, TeXmacs, Gnumeric, AutoCAD, Sawfish, GnuCash, Snd Sound Editor, etc.
      --
      Topher
    12. Re:Anything but odd/new language... by JudasBlue · · Score: 2, Informative

      "It's a good rant but it's not really very relevent - writing your app in python (at least in the way he describes) simply isn't plausible if you're writing an app for commercial or even mass distribution - you can't rely on an existing Python installation and if you've got to package one with your installer then theres hardly any more work to embed an interperter instead."

      This is old enough it will probably never be read, but that isn't true. There are utilites that do this in a snap, in addition to finding any extension package or dll deps that your python is using automagically in almost all cases. Just today I took a small app written in python using WxWindows ran it through py2exe and it runs on all flavors of windows, without python or wxWindows libs installed on either one. Took me about ten minutes.

      McMillian Installer will do the same trick, tho I haven't used it recently. Mcmillan also does the same thing for Linux, where I wish a lot more people were making packages available as no dep binaries as well as more traditional source packages, but that is just me.

      Now, as for your other points, if you happen to want to write your code in Python, well, that is a different matter. But if you choose to, it is very easy and fast to distibute your program binary without deps.

      --

      7. What we cannot speak about we must pass over in silence.

    13. Re:Anything but odd/new language... by PaulBu · · Score: 1


      * Scheme, due to it's small size and powerful, easily extendable syntax, seems to be quite common when it comes to extension langauges. A list of programs that use Scheme (or a similar lisp dialect) off the top of my head includes: SIAG Office, The Gimp, Emacs, TeXmacs, Gnumeric, AutoCAD, Sawfish, GnuCash, Snd Sound Editor, etc.


      Well, add Cadence (one of prolly 2 or 3 top-notch IC (ASIC) design suites, sellable to the tune of couple 100,000/seat) to the list, and take AutoCAD off (it's not really Scheme, more of old LISP, actually Xlisp).

      Paul B.

      P.S. the abundance of ()'s might reflect the amount of time I've spent in that particular environment... ;-)

    14. Re:Anything but odd/new language... by Cato · · Score: 1

      I wouldn't say learning Lua takes an hour, but it is a very nice language and specifically designed for embedding - amazing that it's not mentioned more. It's used by Tomsrtbt (Linux boot disk) for its incredible compactness - many of the Linux utilities are re-implemented as Lua scripts - and by many applications as an extension language.

    15. Re:Anything but odd/new language... by BLAG-blast · · Score: 1
      P.S. the abundance of ()'s might reflect the amount of time I've spent in that particular environment... ;-)

      It wasn't the number of (), but the fact you used them recursively that give you away... ;-)

      --
      M0571y H@rml355.
    16. Re:Anything but odd/new language... by cymen · · Score: 1

      Yes, it's HUGE, when you're adding it to the software you've written yourself; and it's seriously overkill if you only want people to control a few things inside you're own program.

      No, it is NOT huge. 300 MB is huge, 2-3 MB is peanuts. The loss of efficiency to my brain having to learn a new language is much greater than the loss of efficiency to my computer having to use a couple more megs of RAM. Stop punishing your users.

    17. Re:Anything but odd/new language... by svanstrom · · Score: 1
      Yes, it's HUGE, when you're adding it to the software you've written yourself; and it's seriously overkill if you only want people to control a few things inside you're own program.

      No, it is NOT huge. 300 MB is huge, 2-3 MB is peanuts. The loss of efficiency to my brain having to learn a new language is much greater than the loss of efficiency to my computer having to use a couple more megs of RAM. Stop punishing your users.


      It isn't 2-3 MB, it's more like a cpl of 100 MB once people start adding perl to everything; and luckily for most people their brains can handle learning more than just one language, esp. considering that such a "included language" either is very simple, or you'd still have to learn a lot of new stuff even if it is perl... Not to mention that some people will include perl, some will include ruby, some will include javascript; so instead of having to learn enough to control that program, you'd have to learn the basics of a whole new language before you can get anything done.
      --
      perl -e'print$_{$_} for sort%_=`lynx -dump svanstrom.com/t`'
    18. Re:Anything but odd/new language... by cymen · · Score: 1

      It isn't 2-3 MB, it's more like a cpl of 100 MB once people start adding perl to everything; and luckily for most people their brains can handle learning more than just one language, esp. considering that such a "included language" either is very simple, or you'd still have to learn a lot of new stuff even if it is perl... Not to mention that some people will include perl, some will include ruby, some will include javascript; so instead of having to learn enough to control that program, you'd have to learn the basics of a whole new language before you can get anything done.

      Except no self-respecting geek will stand for that so they'll come up with a standard and then the language will be unbundled and life will go on. It's chess, not fate.

  2. Guile by crmartin · · Score: 3, Informative

    God knows the words "lightweight" and "Gnu" don't generally go together, but how about Guile?

    1. Re:Guile by aspjunkie · · Score: 3, Funny

      just Guile!? Don't forget Ryu, Chun Li, and Dhalsim! ;)

    2. Re:Guile by crmartin · · Score: 0, Redundant

      Uh, those links are broken.

    3. Re:Guile by Drantin · · Score: 1

      He was joking... look up the street fighter I/II etc characters...

      --
      Actio personalis moritur cum persona. (Dead men don't sue)
    4. Re:Guile by crmartin · · Score: 1

      Oh. Okay.

      What's "street fighter"?

    5. Re:Guile by Anonymous Coward · · Score: 0

      A very popular computer game from a few years ago. A 2D large-sprites beat-'em-up.

      Was made into a really crappy film too, with Kylie Minogue (looking extremely hot) in it.

    6. Re:Guile by crmartin · · Score: 1

      See, that's the problem with my sense of humor -- I not only don't catch other people's jokes, they don't catch mine.

      (And when does KM *not* look extremely hot?)

    7. Re:Guile by Anonymous Coward · · Score: 0

      When she's got no makeup on and she has her screaming brat in tow. She's pretty old at this stage. Not that I'd say no, of course, but there are more fanciable women.

  3. TinyTCL by the_womble · · Score: 3, Informative
    what about Tiny TCL

    Its easy to learn and use (very good if the people using our embeded language are not programmers). Its mature, supposed to be extensible, and if you decide you need something more powerful later on even the current full verion is not that bloated.

    1. Re:TinyTCL by Twylite · · Score: 4, Informative

      Tcl/Tk proper is not a bad idea either. If one does not need the GUI part (Tk) then Tcl is relatively easy to integrate into a project, and is under 200k.

      HowToEmbed from the Tcl Wiki is a good starting point, and MkTclApp may help.

      Tcl has very consistent and simple syntax (although it can get rather confusing at times), and it is very simple to add new command into your application that are exposed via Tcl. One of the nicest aspects of Tcl is that is it seriously multi-platform.

      Of course this all depends on the requirements: how powerful does the language need to be, what functions must it provide, what types do you need it to be able to handle, how small is "lightweight", etc.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    2. Re:TinyTCL by ianezz · · Score: 4, Informative
      One of the nicest aspects of Tcl is that is it seriously multi-platform.

      Another nice aspect of Tcl is that it can easily evaluate code in a different stack frame (example: in the caller's context), and source code can be easily passed to procedures as strings between braces (as it is usually done), so extending/reimplementing the language control structures is as simple as writing a new procedure (and no special/ugly syntax is required).

      That's as close to Lisp macros as you can get.

    3. Re:TinyTCL by Anonymous Coward · · Score: 0

      That's as close to Lisp macros as you can get.

      Except, of course, for actual Lisp macros. ;) I think various Scheme implementations have been offered up as possible embedding possibilities.

    4. Re:TinyTCL by Khelder · · Score: 1

      It may be better now, but it used to be a huge pain in Tcl to get things to evaluate in the context you wanted, because it doesn't have lambdas/closures. The "everything is a string" approach works ok for small programs and makes the learning curve shallow, but I found I hit a ceiling really fast. The only good thing about Tcl is that it comes with Tk, but since Tk is accessible from other languages, like Python and Perl, I'm happy to avoid Tcl.

      YMMV, of course, but I prefer a language with real control structures and data types.

  4. How much do you need? by Ripsnorter · · Score: 2, Informative

    Just how much customising do you need?

    From my experiance if you only need a little customisation then you can do most of that stuff from a config file, .ini if you want it to be easy to edit, xml if your going to write a gui to do it or your users are compertant. Any more than that your better off going with something like python or perl, they are widely known, and have rich libraries to let the people using the app do some really imaginative things.

    The other thing that you can do is write your app in such a way that it is easy for scripting langs to get there hooks into. For example, on windows you can do this by providing com interfaces to all the things you want to have control over, then you can use any lang you want to control your app.

  5. The need for "extension languages" by be-fan · · Score: 4, Insightful

    Is usually a sign that you are using too low-level a language for the application itself. There is no reason you can't write your whole app in something like Python (or better yet, a compiled high-level language).

    I can see why you might want to stay with C/C++ for a major commercial application (not because of speed reasons, but because the maturity of the implementations of alternative high-level languages) but it pains me to see tons of OSS software, especially non-speed-critical GUI apps, still being written in C!

    --
    A deep unwavering belief is a sure sign you're missing something...
    1. Re:The need for "extension languages" by squiggleslash · · Score: 2, Funny

      Personally, I like C. And to be honest, I always thought the advantage in having a faster CPU was that my programs could run faster.

      --
      You are not alone. This is not normal. None of this is normal.
    2. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      Personally, I like C.

      Let me guess: you don't program for a living.

    3. Re:The need for "extension languages" by squiggleslash · · Score: 1
      I program for a living.

      I think that's the difference between C and Python programmers - C programmers enjoy programming. Python programmers don't, at least everything my Python-loving collegues say suggests that the thing they like about it most is that they never get to understand what's going on under the hood.

      Now, where Perl programmers stand is another issue. I think they're into cryptology...

      --
      You are not alone. This is not normal. None of this is normal.
    4. Re:The need for "extension languages" by ajagci · · Score: 2, Interesting
      I agree: the use of C/C++ for most Linux applications just doesn't make a lot of sense. It's more effort to develop in than a HLL, a lot harder to debug, and usually, it isn't even any faster. Python would probably be a good choice for many desktop apps.

      However, when it comes to statically type checked, non-C/C++ languages on Linux, there isn't much choice:
      • Java: no fully compliant open source implementations; some serious design flaws.
      • C#: not a standard part of major Linux distributions; some concerns (probably unjustified, but still) about Microsoft patents.
      • Eiffel: open source compiler does not support separate compilation; some serious design flaws in its type system.
      • Modula-3, Oberon: not widely used.
      • O'CAML: great language but probably too complex and sophisticated for your average Linux hacker; lacks some facilities essential for high performance computing.

      Overall, C# looks like the most promising to me: it combines the best features and simplicity of Java with most of the efficiency and C-interoperability of C++. Let's hope Mono will make it into all major Linux distributions soon.
    5. Re:The need for "extension languages" by ajagci · · Score: 1

      Personally, I like C. And to be honest, I always thought the advantage in having a faster CPU was that my programs could run faster.

      Yeah, so why do you program in C? C is not a good language for high-performance computing. With a lot of work, you can often get decent performance out of it, but C gets in the way rather than helping you.

    6. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      at least everything my Python-loving collegues say suggests that the thing they like about it most is that they never get to understand what's going on under the hood.

      Of course, C programmers don't understand what's going on "under the hood" either--otherwise, they wouldn't be programming in C. C gives you the impression that you are programming a PDP-11, which is nothing like modern hardware.

    7. Re:The need for "extension languages" by squiggleslash · · Score: 1
      C is not a good language for high-performance computing.
      C is a good language for high-performance computing, as are most third generation languages. I'm baffled as to why you'd think "C gets in the way", I think the thing my Python-loving friends hate most about it is that it doesn't. It does exactly what you ask it to.

      Remember the context of this that lead to my original comment was the suggestion that people should ditch C and C++ for Python and Perl because some-how Python and Perl are "better". Python and Perl have their uses, but the notion that C and C++ are obsolete or that programmers wouldn't see advantages to writing quite substantial projects in either is utterly absurd.

      I love C's simplicity. I love knowing what my code is going to do and being able to predict its strengths and weaknesses. I think well written C is, by itself, beautiful. Don't knock it, it's good stuff.

      --
      You are not alone. This is not normal. None of this is normal.
    8. Re:The need for "extension languages" by Anonymous Coward · · Score: 0
      Er, only if you're programming a PDP-11 emulator. Or an actual PDP-11.

      Would you care to explain what aspects of C force the hardware to resemble a PDP-11, or any other type of computer for that matter?

    9. Re:The need for "extension languages" by msuzio · · Score: 2, Insightful

      I don't think you're visualizing the situation correctly.

      I don't see how the need for an extension language indicates that at all. An extension language (IMHO) is usually needed so that the end user of the application can script that app and extend it to do things you, the application engine writer, did not supply. The needs of the engine and the needs of the extension language are totally different.

      I'm going to want to write the engine to be fast,
      efficient, and easy for me to maintain. The extension mechanism should be simple, allow for ease of re-use (so the user community can exchange code snippets amongst themselves), and powerful enough to allow the sort of add-ons and control structures I (the app designer) *think* the user will need.

      Perfect example is Neverwinter Nights (although the darn app always crashes on me... but I digress ). Powerful engine, with a scripting language bolted on. You would never try to write that application *in* the scripting language. You might ship a large amount of *content* with the app pre-written using the scripting language, though.

    10. Re:The need for "extension languages" by Webmonger · · Score: 2, Informative

      If you accept the notions that
      1. scripting languages speed development
      2. high-level code does not need to be optimized

      Then for an app like Neverwinter Nights, it would make sense to use a scripting language for the high-level code (e.g. menu handling code), while leaving the performance-critical code (e.g. 3-D rendering) in C, C++ or assembler.

      Coded like this, NN might not crash as frequently because either
      - The crashy code would be implemented in a scripting language, and so memory handling would not be a problem

      - The crashy code would still be in C/C++, but since the other code had been written more quickly, there would be more time to fix it.

      The current issue of the C/C++ Users Journal is all about mixed-language development.

    11. Re:The need for "extension languages" by ajagci · · Score: 1

      C is a good language for high-performance computing, as are most third generation languages. I'm baffled as to why you'd think "C gets in the way",

      Because C pointers don't help with writing faster code, but their existence in the language inhibits a lot of optimizations.

      Remember the context of this that lead to my original comment was the suggestion that people should ditch C and C++ for Python and Perl because some-how Python and Perl are "better".

      No, it suggested using high-level languages in general. Which high level language is better depends on the application. Python is probably better for most desktop apps. C# and O'CAML are better for general purpose programming. Fortran (modern versions) is better for high performance numerical computing.

      I love C's simplicity.

      C appears to be simple because it has few constructs, but its semantics are horrendously complex. Think about all the different things a pointer can point to and how those things behave differently as the program executes.

      I love knowing what my code is going to do and being able to predict its strengths and weaknesses.

      But you "can't predict what your code is going to do"--that is, in fact, one of C's biggest weaknesses. Any bug in any library or anywhere in your code means that all bets are off as to the behavior of the rest of the program. Unlike most other high-level languages, C and C++ provide no means of isolating errors and recovering from them reliably.

      I think well written C is, by itself, beautiful. Don't knock it, it's good stuff.

      C was "good stuff" in the days of bell bottoms, PDP-11s, and 64k i-spaces. Even then, 20 years after Lisp and Algol and 10 years after Simula, C was "good stuff" only in a sort of second-hand chic way--look how much I can do with this dirt cheap compiler.

    12. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      C is not a good language for high-performance computing, as it lacks guaranteed referential transparency needed to enable vectorised parallelism. If that sentence means nothing to you, you're not really doing high performance computing (typically involving large parallel clusters), and you probably can't understand why people still use Fortran.

      Admittedly, vendors of C compilers typically include language extensions ("restrict" et al.) to get around this, but C is not natively suited to high performance computing. High performance computing C code is orders of magnitude uglier than Fortran 95 code.

      If you want a high-performance high level language, try a Common Lisp compiler or ML.

    13. Re:The need for "extension languages" by squiggleslash · · Score: 1
      Because C pointers don't help with writing faster code, but their existence in the language inhibits a lot of optimizations.
      Wrong on the first count, right in the second but the very need for optimizations should give you a clue to what my concern is about that.
      Think about all the different things a pointer can point to and how those things behave differently as the program executes.
      Ok, so we've gathered you're not particularly fond of pointers!
      But you "can't predict what your code is going to do"--that is, in fact, one of C's biggest weaknesses. Any bug in any library or anywhere in your code means that all bets are off as to the behavior of the rest of the program. Unlike most other high-level languages, C and C++ provide no means of isolating errors and recovering from them reliably.
      You're confusing two entirely seperate issues. Debugging is an entirely different issue to being able to predict the behaviour of code. Without knowing the underlying basis of the code, I cannot do the latter. If it's over optimized, if it uses hashing I have no control over, if it reads and writes without me having any idea what buffering, etc, is taking place beyond that supplied by the OS, I'm in no position to know how well my program will work.

      Debugging can be fractionally easier in a 4G language, but that's not a substitute, or even the same ballpark, as being able to predict how a correctly written statement will execute.

      C was "good stuff" in the days of bell bottoms, PDP-11s, and 64k i-spaces. Even then, 20 years after Lisp and Algol and 10 years after Simula, C was "good stuff" only in a sort of second-hand chic way--look how much I can do with this dirt cheap compiler.
      Wow. So C isn't trendy enough. I get it now. Good grief.
      --
      You are not alone. This is not normal. None of this is normal.
    14. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      No, c pointers don't help with writing faster code on a parallel architecture (if you are not on a parallel architecture, you are NOT DOING high performance computing). You're confusing high performance FOR YOU with real HPC.

    15. Re:The need for "extension languages" by squiggleslash · · Score: 1
      If you want a high-performance high level language, try a Common Lisp compiler or ML.
      Go back to reading the original context in which "high-performance computing" is used and you'll see it's a reply to a comment from me about faster CPUs meaning faster programs. The guy wasn't changing the subject, he was merely using fuzzy terminology.

      Yeah, sure, I wouldn't necessarily program a Cray in C, but Fortran's not what I'd write a fast, standard, application in either.

      --
      You are not alone. This is not normal. None of this is normal.
    16. Re:The need for "extension languages" by squiggleslash · · Score: 1
      No, you're not reading the thread. Go look at this which is the first mention of "high performance computing" and clearly refers to my comment about faster CPUs.

      You're not calling ajagci an subject-changing troll are you?

      --
      You are not alone. This is not normal. None of this is normal.
    17. Re:The need for "extension languages" by be-fan · · Score: 1

      Well C is quite nice, but there are lots of languages that will get you 80-90% the performance of C, at a much lower investment in time. I'm a performance freak too, but after seeing what d2c (the Dylan compiler) and sbcl (a CL compiler), I know longer consider performance a downside of using a higher-level language.

      --
      A deep unwavering belief is a sure sign you're missing something...
    18. Re:The need for "extension languages" by kruntiform · · Score: 1, Insightful

      I think that's the difference between C and Python programmers - C programmers enjoy programming.

      That's crazy talk.

      Python programmers don't, at least everything my Python-loving collegues say suggests that the thing they like about it most is that they never get to understand what's going on under the hood.

      Supposing that you are not misrepresenting your Python-loving collegues, then yes, they are probably not good programmers (at least not great programmers). But so what? What have they got to do with anything? I don't even know these people. What about the Python programmers who do know what is going on under the hood (like me :D)? Are they bad programmers too? Really, if you are going to critique some technology, then please stick to technical issues. It's easy to make logically fallacious arguments: C programmers are bad because I know some C programmers that only know what goes on under the hood. They don't know anything else beyond that. And they smell. Therefor C is bad. (Note to any particularly dimwitted moderators out there: I don't believe that is an accurate representation of C programmers at all! I think it is quite untrue in fact. It is just an example of a logically fallacious argument used to illustrate a point. Please don't mod me down, you dipshit moderator!)

    19. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      WTF is a "standard application"? A standard application in the high performance computing field will, even today, probably be in Fortran.

      Google for "high performance computing". It's a standard term, and it _doesn't_ mean "x86 riceboy".

      ML also consistently produces higher performance programs than C, BTW, since it can do more optimisation.

      Most Common Lisp compilers also produce competitive performing programs with similar type inferencing techniques to ML, and Common Lisp has be-fan's originally stated advantage of implementation-language-being-the-scripting-langua ge.

    20. Re:The need for "extension languages" by be-fan · · Score: 1

      You neglect the fact that high-level code *can* be optimized. Major PS2 games (Jak and Daxter, I think) have been written mostly in Common Lisp. You'll probably still need assembly on some critical inner loops of the graphics engine, but then again, C code on the PS2 uses assembly on inner loops to take advantage of the vector units.

      --
      A deep unwavering belief is a sure sign you're missing something...
    21. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      It's not exactly C, IMHO, but it is C-plus-Unix. Since programmers make these sorts of "all-the-world's-a-VAX" assumptions depressingly often, hardware manufacturers are forced to cater to their idiocy, even if C itself doesn't technically require it, C-as-typically-programmed does.

    22. Re:The need for "extension languages" by be-fan · · Score: 3, Insightful

      C programs don't force hardware to resemble a PDP-11, but the C machine model doesn't resemble the actual hardware as much as C programmers like to believe.

      - C is entirely serially, and the compiler has to infer paralellism from the code. Modern hardware is significantly parallel.

      - C is entirely memory-based, while modern hardware does everything it can to avoid referencing memory.

      - C has no primitives to describe branching, to aid things like speculative execution.

      - C has no vector types, while most modern processors have vector units.

      etc,etc,etc.

      C has a very nice, simple machine model, but C programmers don't really understand what the computer is doing "under the hood."

      --
      A deep unwavering belief is a sure sign you're missing something...
    23. Re:The need for "extension languages" by bogado · · Score: 1

      Is there a programing language, higher then assemble off course, that do all the things you are stating? I am asking as curiosity, not to be anoying. I do love C, but I do think you are right.

      --
      []'s Victor Bogado da Silva Lins

      ^[:wq

    24. Re:The need for "extension languages" by BRSloth · · Score: 1
      Because C pointers don't help with writing faster code, but their existence in the language inhibits a lot of optimizations.
      C pointers are easy to understand if you understand the machine you are working in. If you don't (or don't care), then you can use a language that doesn't have pointers.

      Also, optimizations are not a code problem. There are part of the project design. A well designed project will need no explicit code optimization, since the compiler will take care of it. And in my experience (I'm a coder for 16 years), compilers can do a better job optimizating your code than you.
    25. Re:The need for "extension languages" by ajagci · · Score: 1

      No, you're not reading the thread. Go look at this which is the first mention of "high performance computing" and clearly refers to my comment about faster CPUs.

      C is no good for "high performance computing", no matter which sense of the term you use. It isn't good for writing high performance desktop apps and it isn't good for writing high performance scientific apps (the more usual use of the term).

    26. Re:The need for "extension languages" by ajagci · · Score: 1

      Wrong on the first count, right in the second but the very need for optimizations should give you a clue to what my concern is about that.

      I guarantee you that your C pointer code will be uniformly no better than Fortran array code.

      And, no, I don't understand what "your concern" is about, other than holding on to a totally obsolete, unsafe programming language that you happen to know.

      You're confusing two entirely seperate issues. Debugging is an entirely different issue to being able to predict the behaviour of code. Without knowing the underlying basis of the code, I cannot do the latter. [...] Debugging can be fractionally easier in a 4G language, but that's not a substitute, or even the same ballpark, as being able to predict how a correctly written statement will execute.

      You don't even understand the problem. It's not about debugging, it's about fault isolation. C doesn't have any. Once your code or any library you call has as much as referenced one past the end of an array, the language guarantees absolutely nothing anymore. There isn't even any indication that anything has gone wrong.

      You have gotten so used to C's misfeatures that you don't even understand that things could be different.

      Wow. So C isn't trendy enough. I get it now. Good grief.

      Yes, indeed, C isn't "trendy" enough in the same way gas lighting isn't trendy enough: it's dangerous and it's completely obsolete.

    27. Re:The need for "extension languages" by be-fan · · Score: 1

      There are a few languages that do one or the other (APL, for example, has built-in vector types), but none that do all of them. My point was just that even with C, you're not really working "at the machine level" but still at a significant level of abstraction above it.

      --
      A deep unwavering belief is a sure sign you're missing something...
    28. Re:The need for "extension languages" by Webmonger · · Score: 1

      You neglect the fact that high-level code *can* be optimized.

      Any code can be optimized, but the question is whether it should. Code optimization (as opposed to compile-time optomization) should only be done where it has a noticeable impact on performance. Most code does not have an obvious impact on performance, and so it should be left alone, so it's more readable.

      If your high-level code has a significant performance impact, it may not be as high-level as you believe.

    29. Re:The need for "extension languages" by be-fan · · Score: 1

      I mean compiler optimizations. High-level language compilers these days are good enough that you can write performance-sensitive programs like games in these languages. It was a response to the OP's reference to using C/C++ to write performance-sensitive parts of games.

      --
      A deep unwavering belief is a sure sign you're missing something...
    30. Re:The need for "extension languages" by arkanes · · Score: 1

      In my experience that's rarely true. For example, the Python compiler does barely any optimization when it generates bytecode, if it does any at all - recent versions did not. Interperted/VM languages are cost-effective now because of the low price of memory and CPU time, not because of magical optimizations. Sure, you can do some spiffy stuff with JIT, but it's a very rare win over compiled code. You can write 3d rendering engines in Java, if you need to - it's a hell of a lot slower than comparable C code would be, but it can be fast enough.

    31. Re:The need for "extension languages" by be-fan · · Score: 2, Informative

      I'm not talking about Python. Python is positioned as a scripting language, and hence doesn't have a powerful compilation infrastructure. Although, Pysco does some very cool dynamic optimizations for Python.

      In contrast, there are many high-level languages like Common Lisp, Dylan, Scheme, ML, Ocaml, etc, that have very powerful native compilers. They do optimizations that C/C++ compilers simply cannot do, because of the low-level C memory model. Literally decades of research has gone into making these compilers, and they have optimizations that (while not quite magical) are very impressive.

      Variously:

      - There are type-inference optimizations that eliminate the overhead of dynamic dispatch.
      - There are heap-analysis optimizations that stack-allocate objects whenever possible, to avoid heap allocation.
      - There are analysis that avoid heap-allocating closures.
      - There are analysis that eliminate type checking and array bounds checking.
      - There are analysis that perform large-scale optimization of class heirarchies, to eliminate the over head of OOP.
      - There are memory allocation analysis that reduce the overhead of garbage collection (region inference).
      - They do method specialization, allowing the C++ template advantage of generic functions optimized for a given type, without actually having to deal with explicit type parameters.

      Some useful pointers:

      Apple Dylan Wiki
      Lisp vs Java vs C/C++ performane
      Bigloo Scheme Compiler
      Gwydion Dylan compiler
      CMU Common Lisp Compiler
      UW Vortex Compiler
      MLKit ML Compiler
      Ocaml Compiler

      --
      A deep unwavering belief is a sure sign you're missing something...
    32. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      This is the greatest evil of all: the myth put about by Perl/Python/Java advocates that high-level means interpreted/VM.

      Okay, maybe paedophilia is slightly more evil than that.

      Oh, and mass murder, too.

      But it's a close-run thing.

    33. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      He's talking about optimisations by the compiler, which pointers inhibit.

    34. Re:The need for "extension languages" by Anonymous Coward · · Score: 1, Informative

      The main reason why applications are developed in C is cross platform compatibility. That said, scripting languages are getting better about being everywhere--but they can never be everywhere where you might need a truly portable application (embedded platforms and wacky operating systems come to mind).

      I agree that writing your basic GUI applet in C is probably counterproductive; scripting languages can certainly be much more portable than C, as they hide a lot of the messy machine internals. However, for core infrastructure like server daemons, core utilities like grep, and other system-level programming tasks should be done in a portable language like C, a compiler for which is one of the first tasks facing the designer of a new architecture (after the core operating system and a few basic libraries). Interpreters like Python and the rest, after all, are written in C.

      Also, C is the de facto language for library bindings and all the rest--you can be pretty much guarantee being able to link a library into any other language if it exposes a C API. The same wouldn't be true for a Python or Perl module, C++ library, or Java class file.

      Finally, C gives you much more control than higher-level languages. That can be both a blessing and a curse, but at least it means you don't need to hack the C compiler to get a feature that you want. In many corner cases, you'll need an extra C function or two to implement lower level functionality. One of the strengths of Python (the main strength, in my POV) is that it makes it easy to script C-based programs and libraries.

    35. Re:The need for "extension languages" by Pseudonym · · Score: 1

      For the overwhelming majority of sufficiently large applications, writing them in a high-level language is going to be inadequate without at least implementing quite a few domain-specific primitives in a lower-level language.

      When you think about it this way, you'll see that there's actually not a lot of difference between implementing the application in a high-level language and providing scripting. It's the same architecture: a low-level performance-sensitive "hard" layer and a high-level user-visible "soft" layer. The difference is that by using a very lightweight high-level language with domain-specific primitives, it can be more domain-specific than a more general language like Python. This can be an advantage in some circumstances.

      I know this because I'm struggling with this issue myself at the moment. My application has a lot of performance-sensitive batch-processing-like code, plus a GUI layer which basically runs at the speed of the user. I solved the problem this by implementing a domain-specific scripting language which I use for the GUI, user scripting, initialisation and so on, and the script's operations and the application's inner loops are in C++. I get the best of both worlds.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    36. Re:The need for "extension languages" by Pseudonym · · Score: 1
      I'm baffled as to why you'd think "C gets in the way" [...]

      I'm not the original poster, but I do agree that C gets in the way in many situations.

      For example, consider implementing a sort algorithm, say, quicksort. Ideally, you only want to implement it once (e.g. using C's qsort()). However, comparison and swap operations for different types (e.g. integers vs structs) are quite different, and in some cases (e.g. integers or floats) can be made quite cheap. So if it matters, you definitely want to optimise for those cases.

      You basically can't do this in C. You're forced to use macros, which are ugly, hard to maintain and provide zero safety, or perhaps write a program that generates C code, making a specialised version for each type that you care about. Languages which actually provide specialisation or code generation facilities as part of the language (C++ is but one example) can do this quite cheaply.

      Another example is memory management. No, I'm not suggesting that you should use a garbage collected language, though this is arguably a good idea in many, possibly most, situations. However, in C, no matter what policy you use, if you do a lot of allocation, you need a lot of repetitive infrastructure to do it. C provides no help for you.

      I know C is simple. That's great if you're writing a compiler for it. However, it is of little assistance if you're writing an application in it.

      Let's invent a hypothetical unit of complexity, the "cu" (i.e. "complexity unit"). Suppose your application is 100cu. A simple language provides, say, 10cu, which means you have to write 90cu of complexity yourself. A less simple language might provide, say, 40cu of complexity, whihc means you only have to write 60cu yourself.

      Given that the 30cu is almost certainly going to be dull, repetitive code, which would you rather write?

      Now I'm not saying that C is obsolete, or people should ditch it wholesale for another language, but I am a professional programmer, and I write high-performance applications with a few million lines of code for a living, as well as medium-sized open source projects on the side, and I would never touch C again if I had the choice. At the very least I'd use C++, which has all the advantages of C plus a huge amount of additional stuff as well.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    37. Re:The need for "extension languages" by Pseudonym · · Score: 1
      I think that's the difference between C and Python programmers - C programmers enjoy programming. Python programmers don't, at least everything my Python-loving collegues say suggests that the thing they like about it most is that they never get to understand what's going on under the hood.

      In the interests of balance, here's the same workplace as seen from the Python programmer's point of view:

      C programmers like engaging in dull, repetitive tasks, whereas Python programmers like having finished products created with the minimum of effort.

      No, I don't believe that either the C programmer's or the Python programmer's respective spin are 100% correct.

      I enjoy programming, but I don't enjoy the part that's non-creative. I do it because I have to. Just like how a music student may love playing the piano but hate the endless scales and exercises.

      I am all for anything which takes the non-creative load off without me losing any of the creative advantages and freedoms of programming.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    38. Re:The need for "extension languages" by be-fan · · Score: 1

      Since when to Perl/Python/Java advocates do that? I think its more ASM/C/C++/Java people that have the idea that all high-level languages are interpreted or run on a virtual machine.

      --
      A deep unwavering belief is a sure sign you're missing something...
    39. Re:The need for "extension languages" by Anonymous Coward · · Score: 0
      Now, where Perl programmers stand is another issue. I think they're into cryptology...

      They are into something. "Special" brownies maybe...

      Offered as evidence, the infamous Black Perl, which i think was valid perl through version 3.

    40. Re:The need for "extension languages" by d_i_r_t_y · · Score: 1

      you know, i think you're spot on the money with this comment. i can program in several languages (though no functional languages i'll admit), in my 5 odd years of professional programming, i don't think there's a single language that one could say is uniformly good for all tasks. which is kindof surprising, since it is easy enough to envision that a language could be more-or-less extended/tweaked without limit by extension modules.

      java could and *should* have been it, but as you say, some idiotic design decisions, the completely arbitrary limitation of java's expressiveness and featureset that makes it ever so dull and tedious to code in, and question marks over performance find it wanting as the real "nextgen" language.

      c++ is fine, but its list of hacks and ugly/inconsistent syntax make it look dated. not surprising its still the no1 programming language though.

      my ideal langiage would borrow the syntactic sugar and excellent core-language threading of java, the speed of c/c++, and the sheer expressiveness and mutability of perl and build it into something that looked at the end like python with braces and static typing ;-)

    41. Re:The need for "extension languages" by msuzio · · Score: 1

      I believe all of these are very true; HLL's can be optimized, and in some cases perform very well, far beyond the usual off-the-cuff expectations for HLL performance.

      However... then we get into a situation where the programming team has to ask themselves:

      - Do we know the language well enough to program in it without increasing our development time?
      - If not, would the increase in time on this project end up benefitting us on the other projects in the pipeline? (Do we even have a 'pipeline'?)
      - Do we know enough about the language and the compiler to know how to exploit the possible optimizations? If we're relatively new to the language, we might write code we think is great, but miss out on even simple tricks that would have let the compiler optimize things. Add a little more time to the learning curve.

      Etc, etc. Hard calls to make, even if this is a project you intend to pursue "on your own" -- because who's to say that in a year, you're not going to want to open the project up on Sourceforge and solicit some of that good old 'open source' collaborative effort? Be nice if the potential pool of contributers were as large as possible...

      I'm a firm believer in languages like Dylan and Common Lisp (despite never having done anything beyond toy programming in them), but it is very hard to make the case in most production, time-sensitive environments to "take a chance" on them. If more programmers were proficient in them, then they would be easier to promote... of course, relatively few people are being trained in them or learning them on their own, because there is not a huge market for that skill. Typical viscious circle promoted by short-term thinking, but that's a fact of life, isn't it?

      In any case... my original point still stands (I think? <g>). The requirements and reasons for an extension language are totally different than those for an implementation language. Even if you decided to implement a project in Lisp and extend it via Lisp (I think I heard of an editor that lets you do that), you still would still be exposing some part of the work to the end-user, and "hiding" the rest as part of the 'black-box' that you are free to change in future revisions. The two goals (user friendly extension interface and highly performant and powerful engine) must be able to be pursued separately, and in many cases, that leads to two different underlying implementations and languages.

    42. Re:The need for "extension languages" by Nutria · · Score: 1
      More languages:

      • Ada (part of gcc)
      • Fortran (part of gcc)
      • COBOL
      --
      "I don't know, therefore Aliens" Wafflebox1
    43. Re:The need for "extension languages" by Anonymous Coward · · Score: 0

      Care to elaborate on the serious design flaws of Java? (and BTW, have you seen Java1.5?) I find this claim somewhat "suspect" after the subsequent comment on Eiffel typing system having serious design flaws... (this is clearly a bait, but oh well ...)

  6. Dupe by bromba · · Score: 0, Troll

    Gentlemen, this one is a dupe. The question is: Was this ask slashdot submitted twice, or did the editor failed to remove it from submission queue last time?

  7. Javascript! by Geek+Boy · · Score: 5, Interesting

    ECMAScript/Javascript seems like a logical choice. it was made for just that - embedding. It's quite small to implement, and there are many opensource implementations out there already. It can be procedural or OO, and everyone knows how to use it if they've done some basic web work.

    1. Re:Javascript! by Anonymous Coward · · Score: 5, Informative
      Mozilla implementation of JavaScript in C is available at http://www.mozilla.org/js/ and pure Java implementation is at http://www.mozilla.org/rhino/

      And btw, ECMAScript/JavaScript can be pure functional as well.

    2. Re:Javascript! by Tablizer · · Score: 0, Troll

      I don't know if they improved it, but JavaScript had some of the worse string-handling abilities I have ever seen in a "scripting language". It lacked a Trim(), for example to clean out white space.

    3. Re:Javascript! by Just3Ws · · Score: 0

      See Mr.Crockford's website at

      http://www.crockford.com

      for an excellent JavaScript extension library that you can use to add in functionality for string operations like trim() as well as many other functions ranging from 'nice to have' to 'my god this makes my life more better, thank you Mr.Crockford'.

    4. Re:Javascript! by Anonymous Coward · · Score: 0

      btw, ECMAScript/JavaScript can be pure functional as well.

      That depends on your definition of functional. Last time I checked ECMAScript lacked anonymous functions and partial application, two of the most useful FP features.

    5. Re:Javascript! by NTDaley · · Score: 1

      If you're doing it in java, I'd suggest using BSF (http://jakarta.apache.org/bsf/) with Rhino. You can plug in scripting engines for different languages. You can register java beans with it, to make parts of the main program available to the scripting environment.

      --
      bits and peace
      Nicholas Daley
    6. Re:Javascript! by Anonymous Coward · · Score: 0

      String.prototype.trim = function() {
      return this.replace(/(^\s*)|(\s*$)/g, "");
      }

    7. Re:Javascript! by ryfar · · Score: 1

      A small company called Nombas also makes a Javascript/ECMAScript interpreter that's specially set up to be embedded in other applications. They have a pretty easy to comprehend API and lots of documentation. It's not free to license it, but it's not expensive either, and once you've licensed it you get good technical support, upgrades, etc. The product is called ScriptEase ISDK. Check it out at http://www.nombas.com. Full Disclosure: I used to be a developer there. But I don't anymore and I still love the product.

  8. s-lang by noselasd · · Score: 1

    I find s-lang a very nice extension language. www.s-lang.org

    1. Re:s-lang by CoolPops · · Score: 1

      I too use and really enjoy S-Lang. It's fast and easy to embed.

  9. ICI by tpv · · Score: 3, Interesting
    ICI is very lightweight and generally quite usable by semi-programmers.

    It's sufficiently C-like to suit anyone who has done C/C++/Java/Perl/... but high level enough to be a feasible extension language.

    Of course it depends on what type of person you expect to use your extension language. Are they programmers?

    --
    Read more of this story at Slashdot.Read more of this story at Slashdot.Read more of this story at Slashdot.
  10. paxscript by glob · · Score: 2, Informative

    i recommend you look at paxscript.

    it's the most complete and quickest of any embedded source stuff that we've investigated.

    supports basic, c, objectpascal (ie delphi) and javascript.

    not free, but you get the source when you purchase it (US$179).

    delphi and borland c++ builder only.

    --
    nostrils
    1. Re:paxscript by arkanes · · Score: 1

      For an open source alternative, look at Delphi Web Script

  11. REBOL by the_greywolf · · Score: 3, Informative

    didn't see anyone else mention it, so i thought i would.

    REBOL is a ridiculously simple and easy-to-learn web-oriented language. so easy, in fact, that i wrote a fully-functional IRC dice bot in under 400 lines, overnight. and if that weren't impressive, then might i add that i was running on ZERO caffeine, learning the language for the first time, learning IRC Client protocol for the first time, and came up with a few unusually witty statements and insults to boot?

    now the bad part: REBOL is not open source. poo. (i really was a bit disappointed.) but REBOL/Core is free (for any use, i gather), and the license fees for View and Command seem rather reasonable.

    the nice part: it has been ported to and runs on about 43 platforms, last i checked, and is light enough that the executable weighs in at around 250kb for the win32 release. (haven't used the other platforms, so no comment.)

    it runs on just about every unix i've heard of, on every relatively common configuration, and works beautifully and seamlessly. and, after a quick glance, i see it runs on serveral major embedded systems, including WinCE, QNX, and Linux, and will even run on my friend's dated Amiga.

    enjoy and happy coding. :)
    --
    grey wolf
    LET FORTRAN DIE!
    1. Re:REBOL by swdunlop · · Score: 3, Informative

      I had a very guilty love for REBOL, but it hasn't changed much in the last three years.. Many of the warts on REBOL/View are still there, and it's still not fully documented. They also haven't finished their port to OS X, so it isn't as perfectly cross platform as I would like..

      And.. Finally.. How does one embed REBOL in an open source application?

    2. Re:REBOL by RevAaron · · Score: 1

      Using R#. the sharp has nothing to do with .NET, mind you. It's an open source REBOL implementation, not sure how done it is- it's a 0.5-0.6 last time I used it. I've just stuck to using the real thing myself.

      But I too have had the same guilty-love of REBOL. It is a very capable and handy language, definately one of the more useful so-called "scripting" languages I've ever seen or used.

      Other than this, there is no way to embed REBOL in an app directly, though you could call the interpreter over a pipe. You only get an exe, not a DLL/so/dynlib/framework. For that, you have to shell out cash.

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
  12. Developing for windows? by KILNA · · Score: 4, Informative
    --
    Error: PANTS NOT FOUND. Press <F1> to continue.
  13. Object Forth? by samjam · · Score: 4, Informative

    ficl.sourceforge.net

    A portable object oriented forth at less than 100K for a full implementation, able to handle calls from your apps as well as call your apps fgunctions or other dll's.

    Under a BSD-ish license.

    The upside:
    1) Its tiny
    2) The forth code you write will be tinier

    Downsides:
    1) You need to learn forth (I mean properly) to appreciate it.

    Forth is unlike most other languages, it was designed to avoid the debug, recompile cycle that is so common.

    Sam

    1. Re:Object Forth? by tyrecius · · Score: 1

      What you mean is:

      Forth is unlike most other languages. Also, it was designed (like LISP, every scripting language, and others) to avoid the debug, recompile cycle that is to common.

      --
      char a[]="lbiitgt l e \n\n\0";main(){for(char*c=a; *(short*)c;c+=2){putchar(*(short*)c);}}
    2. Re:Object Forth? by Gnulix · · Score: 1

      1) You need to learn forth (I mean properly) to appreciate it.

      In this case the word to use is "love", rather than "appreciate". Darn it, it's a lovely language!

    3. Re:Object Forth? by swdunlop · · Score: 1

      Perhaps he meant:

      Forth, unlike most other compiled languages, reduces the length of each iteration of the edit, compile, debug cycle by making it possible to edit definitions in an application interactively.

      In many Forths, there is most definately a compile step, but it happens so quickly, it is easy to miss.

    4. Re:Object Forth? by Anonymous Coward · · Score: 0

      It's so pretty!

      Well... actually it's even uglier than Lisp, but I'd get modded flamebait if I said that.

    5. Re:Object Forth? by Anonymous Coward · · Score: 0

      Pfffft... Forth is a wart of a programming language.

      Gah...

    6. Re:Object Forth? by samjam · · Score: 1

      I think you are right, the previous guy added nothing meaningful.

      Yes, and with forth you get to alter the compiler.

      Oooh, scary!

      Sam

    7. Re:Object Forth? by samjam · · Score: 1

      Lisp is as ugly as worms
      Forth is as ugly as mechano

      Sam

  14. How about JavaScript? by Rich · · Score: 5, Informative

    I've been working on a system for embedding JS in KDE apps (amongst other reasons it is a about 1/10 the size of a python interpreter). You can find lots of information at http://xmelegance.org/kjsembed. The interpreter in KDE has no dependency on KDE/Qt or anything else so you might find it usable in your app.

    1. Re:How about JavaScript? by arkanes · · Score: 1

      The problem I've been having is that I mainly write in C++, and all the scripting languages I'm aware of only have the ability to call C interfaces, even the object oriented ones. Shouldn't it be possible to implement an interface to the C++ ABI so you can (semi-) directly map scripted objects to C++ ones without the annoyance and overhead of flattening to C (via SWIG or whatever)?

    2. Re:How about JavaScript? by Anonymous Coward · · Score: 0

      Sounds like you want COM. You might want to check the various Unix clones (XPCOM, KParts)

    3. Re:How about JavaScript? by Rich · · Score: 1

      I do a similar thing. I've developed a tool that uses doxygen to generate XML descriptions of the code, then xslt to create a binding to JS. This isn't 100% automated yet, but I was able to bind a fairly complex class (QDir) in about 20 minutes. This includes all the enumerations and default argument support.

      Rich.

    4. Re:How about JavaScript? by arkanes · · Score: 1

      Thats a cool idea. You might want to take a look at gcc_xml (which I haven't had a chance to work with in depth yet), which patches GCC to output an XML representation of your code.

    5. Re:How about JavaScript? by smallpaul · · Score: 1

      If the KDE folks shipped Python with the KDE desktop (small in comparison) then every KDE app would have access to a much more powerful embedding language, which already has KDE, QT and DCOP bindings, a powerful library and all of the other good stuff that makes Python more popular for scripting than Javascript (off-Web).

    6. Re:How about JavaScript? by Anonymous Coward · · Score: 0

      Well, a de-facto standard "the C++ ABI" only recently came into existence on linux as gcc+intel+amd finally vaguely standardised it.

      It's only in the past year or two that bridging to the C++ object model would be feasible on linux (n.b. windows has COM, which makes things easier), and even then, the C++ object system is so weak compared to, say, common lisp's, that it would be a poor fit.

    7. Re:How about JavaScript? by elflord · · Score: 1
      Shouldn't it be possible to implement an interface to the C++ ABI so you can (semi-) directly map scripted objects to C++ ones without the annoyance and overhead of flattening to C

      Sip makes it fairly easy to put python bindings on C++ without doing much in the way of "flattening" yourself. It's true that "flattening" needs to be done, but the tool (sip) takes care of it for you.

    8. Re:How about JavaScript? by Scaba · · Score: 1

      I think Boost.Python does what you're asking.

    9. Re:How about JavaScript? by Rich · · Score: 1

      There are a number of problems with that:

      1. The kjsembed library provides access to the existing objects with no (repeat *no*) need for the host app to write any extra code. ie. it can extend apps that were not intended to support this stuff (though obviously it is better if they are).

      2. A huge proportion of kde apps already link kjs via either khtml or via kdeinit. This adds no extra overhead (rather than a large python interpreter).

      3. We would have huge version skew problems because the distros (and users) would immediately rip out the chosen version of python and link the code against their default installed one. This would lead to impossible to track down bugs.

      4. Most of the stuff that people use from the python libs is already available from the kde libs. By providing bindings to those we get better integration with things like cookies, cache handling etc. as well as a very low overhead in terms of type conversions.

      Cheers

      Rich.

    10. Re:How about JavaScript? by Rich · · Score: 1

      You're the second person so suggest that, I haven't had a chance to look at it yet. For now the doxygen solution works nicely and has the advantage of understanding signals and slots.

      Rich.

    11. Re:How about JavaScript? by juhaz · · Score: 1

      1. The kjsembed library provides access to the existing objects with no (repeat *no*) need for the host app to write any extra code. ie. it can extend apps that were not intended to support this stuff (though obviously it is better if they are).

      If the bindings are already there, why couldn't this be extended to another language as well?

      2. A huge proportion of kde apps already link kjs via either khtml or via kdeinit. This adds no extra overhead (rather than a large python interpreter).

      Python can work as a shared library rather than separate executable, windows version does this, mac too, but dunno if there are any Linux implementations around.

      3. We would have huge version skew problems because the distros (and users) would immediately rip out the chosen version of python and link the code against their default installed one. This would lead to impossible to track down bugs.

      4. Most of the stuff that people use from the python libs is already available from the kde libs. By providing bindings to those we get better integration with things like cookies, cache handling etc. as well as a very low overhead in terms of type conversions.


      Solution for problem 2 addresses this automatically, if you ship your own python as a library or inside kdelibs, it's not going to be replaced very easily. And there's no need to include parts of the standard library you don't need, as long as it's possible to import them from some other source if user wants to do so.

  15. Copy of an advogato article by DavidNWelton · · Score: 3, Informative

    I guess atai must have submitted the same question here as well, but the "original" discussion took place on advogato:

    http://www.advogato.org/article/735.html

    It would be useful if he could state what his requirements and limits are, in detail, because that's a very necessary part of evaluating what would work.

  16. Why another language? by Anonymous Coward · · Score: 5, Insightful
    Extension languages are designed to be embedded in applications to support customization of the application behavior. Common scripting languages, like Perl and Python, are fairly 'large' with powerful run-time engines and libraries and are widely available and 'script' writers usually assume their stand-alone existences in the deployment environment.

    Well you're not obligated to provide the libraries. For instance, Blender, which uses Python, did not include Python libraries ; however it was possible for people which really wished it, to set paths to point to libraries. Forcing the users to learn a new language, just to cut the size of the distribution is misguided IMHO. Just provide the extension language (& support) as an optionnal individually downloadable shared library.

    1. Re:Why another language? by sylvandb · · Score: 1

      Optional download is _almost_ but not quite right. The right approach is to make it possible for the user to select their own language.

      You should implement the hooks for a scripting language, probably even provide some simple (whatever you prefer) default. But allow me to pick perl or an interpreted C, allow my brother to pick python, etc.

      Forget the strawman argument about companies not wanting a dozen langauges. They can use their choice. If you choose for them, they have to use yours plus their choice for the rest of the solution.

      It may not be popular, but windows scripting host, or something like that, is the right idea.

      sdb

  17. Freedom Force by IceFreak2000 · · Score: 1

    I know it's not directly relevant to the question, but FWIW the rather excellent Freedom Force uses Python as its scripting language.

    --
    Life is like a sewer; what you get out of it depends on what you put into it...
    1. Re:Freedom Force by juhaz · · Score: 1

      So does the potentially excellent but damn buggy Temple of Elemental Evil

  18. Why so many languages? by Futurepower(R) · · Score: 2, Interesting


    "...learning LUA takes exactly 1 hour."

    I couldn't read the reference manual in one hour. I couldn't learn the quirks of co-routines in one hour.

    I think there is a big, big misunderstanding about computer languages. The "quick and dirty" ones are incomplete and limited. The complete languages are necessarily complex. At one time, Perl was like Lua. Then it needed this and that until now it is beginning to be as complex as C++. The same will happen with Lua, I'm guessing, if it remains popular.

    It seems that every self-motivated serious programmer writes at least one editor or one language or one compiler. Even I wrote a language and compiler -- for Hewlett-Packard data acquisition equipment.

    I think Larry Wall didn't foresee the future when he started Perl. Did he begin Perl with the idea that it would eventually be object-oriented? Did he expect that he would spend his entire life developing his "report language"?

    I'm tired of learning new languages. I don't see the point in it. I'll bet there are hundreds of thousands who learned Pascal in college who wish they had not wasted their time; except for Delphi, Pascal is dead.

    For those who want an embedded scripting language, how about a C interpreter? Try Cint or Ch.

    1. Re:Why so many languages? by smallpaul · · Score: 1

      Great so Pascal is dead. Great example. What about all of the languages people learn that did not die? Java? Perl? C++? Python? PHP? What about the millions people who productively coded tens of millions of lines in languages that were invented since 1972? You can live under a rock pretending that C is good enough if you like but the rest of industry is going to keep learning new languages, improving its productivity.

    2. Re:Why so many languages? by swagr · · Score: 1

      I'm tired of learning new languages. I don't see the point in it.

      Fun. Brain excercise. It makes you a better programmer in general even if you don't end up using that language.
      I can almost guarantee that if you took any Java/C programmer, taught them some Scheme and Forth, they would end up being a better Java programmer for it.

      --

      -... --- .-. . -.. ..--..
  19. EiC? by Futurepower(R) · · Score: 2, Informative

    Or, how about EiC, now hosted at Sourceforge. "EiC is pointer safe."

  20. siod by mschaef · · Score: 1

    I'd reccomend siod, or perhaps guile.

    http://people.delphiforums.com/gjc/siod.html

    I've done a fair bit with siod lately, and can say that while it's not the most sophisticated scheme interpreter around, it dovetails very nicely with C code. It's trivial to write new functions, and defining new data types isn't that much more difficult at all.

    That's as close to Lisp macros as you can get.


    For people looking for Lisp-style macros, siod includes a simple implementation of a feature that works very much like macros. If the symbol in the function spot of a list itself refers to a symbol, the referred to symbol's binding is evaluated as a macro rewriting function.

    Oh, and as an example of its simplicity, the whole thing fits in something like 10,000 lines of code. That's garbage collection, a library of simple string functions, a Scheme evaluator, file I/O, and a bunch of stuff I'm probably forgetting...

    IIRC, SCM and Guile are both derivations of the original siod code base. For that matter, so is STk, as it it itself based on SCM. Either of those would likely be a good choice too.

  21. Consider Ruby by urbangipsy · · Score: 3, Informative

    What about Ruby (ruby-lang.org). It's easy to learn, powerful and has a reasonable set of classes and methods built-in. It's also quiet widespread nowadays, lightweight compared to Python and easy to embed via libruby.so
    see the Ruby book (section Embedding a Ruby Interpreter

  22. Re: non-speed-critical apps written in C by Anonymous Coward · · Score: 0
    Bah! When my app isn't speed critical, I make fun definitions like:

    #define WAIT() do { } while( rand() % rand() )

    Then I just sprinkle in a few WAIT()'s wherever my code runs too fast.
  23. Re: non-speed-critical apps written in C by Anonymous Coward · · Score: 0

    Yes, I'm aware that rand() can return 0.
    Hint: I never said my code doesn't crash! :)

  24. Depends on the host programming language and OS by angel'o'sphere · · Score: 2, Interesting

    On Mac OS X you definitly will use AppleScript. Regardless of programming language used for your application. OTOH, you can use any language that offers a library to send high levle events to your apps(not sure about that in our days).

    On Windows you likely will use Visual Basic for Applications or Visual Basic Script or any other Active Scripting language.

    If you write ONLY Java, like I do in our days, its easy: the scripting language will be either Java(Dynamic Java, see: http://koala.ilog.fr/djava/ or Bean Shell, aka bsh, see: http:www.beanshell.org) or Java Script, aka Rhino, see: http://www.mozilla.org/rhino/ or any other language running on a JVM see: http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.ht ml

    If you write your program ina C-ish language I would consider to use CORBA --- yes indeed!! --- to be able to script it with everything.

    If you want to use traditional scripting languages like TCL, PERL etc. you likely will want to look into SWIG, see: http://www.swig.org.

    But ... as soon as you start working with SWIG you will realise that making an application scriptable menas to craft special hook functions to access only the wanted part of the application, likely via strings only arguments and return values.

    The bigger your applicatin gets, the more complex will be the access layer for the scripting languages.

    When you have reached that point you likely regret not to have used something more suiteable, like CORBA or the Java stuff I sketched above or you are to the point where you throw it away and rewrite it in a "embed" approach where you will use a scripting language as development language and write certain modules as plugins into that language.

    Then however you are bind to the scripting language as host language.

    BTW: there are a lot of free mini orbs which make CORBA a toy. And writing IDL is not much harder than writing SWIG config files. If you like to shield your customer from CORBA give him a lib for his scripting language, which hides the fact that CORBA is used.

    Regards,
    angel'o'sphere

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  25. Io, Groovy by alice_in_cipherland · · Score: 1
    Io is a minimalist language.

    If the app runs on JavaVM, then JavaVM-based languages (such as Jython and Groovy) may be good choices, since the VM and its large set of libs are there anyway.

    1. Re:Io, Groovy by swdunlop · · Score: 1

      Io is wonderful, but I have had chronic problems with its garbage collection when writing complicated applications. Frankly, the GC system is incredibly buggy, and the coroutine implementation requires some very ugly manipulation of the C stack. Right now, for sophisticated, long running applications, the interpreter is just not mature enough. Give it a year or two..

  26. Perl 4 by duffbeer703 · · Score: 1

    Perl 4, while dated for newer Perl programmers is a very effective language and weighs in around 400k.

    I can think of a couple of big, $$ applications that embed it.

    --
    Conformity is the jailer of freedom and enemy of growth. -JFK
  27. Nasal, a javascript-like language by truth_revealed · · Score: 2, Informative

    Nasal is a very well designed small embeddable language with a Javascript-like syntax and an LGPL license. I prefer it to Lua because I am not fond of Lua's Pascal-style syntax. Be aware that Nasal is not very battle-hardened yet and does not have even a 1/100th of the developer community of Lua.

  28. LUA by schapman · · Score: 2, Informative

    lua is a great scripting language when it's used well. When i was studying game development in school, we were introduced to it as a good way to drive out games. Its easy to add functionality for it... its fast... it simple. I could write all my rendering/sound/network/input code in c++, and just have interfaces for everything from lua... this way, when i wanted to drive a game app, i could do the following: (pseudo lua... hmm... pseudo scripting :) ) load level load char at xyz load enemy at xyz go then, my c++ code could handle all the collision detection/AI/proper sounds for things... it all comes down to good design. Something like lua is great for having somethign high level drive a low level engine.

    --
    Wouldnt you like to be a pepper too?
    1. Re:LUA by Anonymous Coward · · Score: 0

      I'd like to second Lua.

      It has been designed from the ground up to be a language to be embedded in to other applications.

      It is very easy to write C or C++ functions and call them from within in Lua.

      It is very easy to write Lua functions and call them from within C or C++.

      It is small, functional and fun.

  29. Nasal by Nevyn · · Score: 2, Informative

    When I was answering this question, I ended up looking at nasal. While not perfect, it was the closest to what I wanted ... and was under a compatible license (LGPL). But then I wanted something small, lua is way too big.

    --
    ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
  30. Has to be one that people already know by Cardbox · · Score: 1

    Assuming that end users are going to be writing things in this language, you have to use one that there are already books/courses about, that their friends already know how to program in, etc.
    This pretty much forces things like Javascript or VBScript, which may not be pretty but have the mindshare. You could use something more elegant and exotic, but will anyone bother to learn it? Will you be willing to support them when they haven't?

  31. Pascal was the most taught language. by Futurepower(R) · · Score: 1


    Pascal wasn't just any language. It was the most taught computer language in the world at one time. It died within a few years. No one seems to be mourning it. So, how many languages do we really need, if one can die without causing problems?

    My vote: Put all the good stuff into one language.

    1. Re:Pascal was the most taught language. by miniver · · Score: 1
      My vote: Put all the good stuff into one language.

      Been there, done that ... it was called PL/I.

      --
      We call it art because we have names for the things we understand.
    2. Re:Pascal was the most taught language. by Anonymous Coward · · Score: 0

      My vote: Put all the good stuff into one language.

      Good plan. Which language did you have in mind? From your earlier post it appears you're a fan of C/C++, both of which are SERIOUSLY limited in terms of modern programming - manual memory management is so '70s, and if you're going to insist on static variables you could at least be inferring their types. C++ doesn't even have proper higher-order functions for heavens' sake!

    3. Re:Pascal was the most taught language. by Anonymous Coward · · Score: 0

      Note that "Delphi" and "Kylix" are Pascal at heart, just a bit Borlandized.

  32. Lua too big? Are you on crack? by Anonymous Coward · · Score: 0

    Lua as a library is 60K on x86. Nasal is not much smaller - 45K. Lua can be smaller if you do not register some builtin functions. They are basically the same sizewise, but Lua interpreted code runs several times faster.

    1. Re:Lua too big? Are you on crack? by Nevyn · · Score: 1

      /usr/bin/lua is 140k ... a simple compile of the example nasal binary is 60k. lua also links to a whole bunch of extra libraries. wc -l of the .c files shows lua to have 13.4k and nasal 3.4k. Running lua gives a default prompt and takes 6.2Meg VSZ, 848K RSS. Running an infinite loop nasal script (it doesn't have an interactive mode in the example binary) gives 1.7Meg VSZ and 456K RSS. Hell tinyscheme is less than lua in every regard and is pretty close to a real language.

      And it's much easier to tweak nasal (because it's so much smaller), so if you don't need bits you can just rm them.

      --
      ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
    2. Re:Lua too big? Are you on crack? by Anonymous Coward · · Score: 0

      Who cares how big /usr/bin/lua is? The Lua library code when linked into your application is just a fraction of that size if you choose not to register all the lua functions that Nasal does not have. Your lines of source comparison is ridiculous. Compare apples with apples. The Lua core is the same size as Nasal.

      As for your runtime memory tests - try running anything with any complexity at all and watch Nasal's memory explode (especially with recursion).

      Don't get me wrong - I like Nasal. It's a good language. But it's just not quite ready yet.

      And it's much easier to tweak nasal (because it's so much smaller), so if you don't need bits you can just rm them.

      Just remove them? I hope you are abiding by Lua's LGPL license and posting code for your library changes. Lua's MIT license does not have this restriction. That's why game developers prefer Lua.

  33. Language Confusion by Anonymous Coward · · Score: 0

    Is there a place that describe all the major programming languages with descriptions?

  34. I'm looking for a permanent relationship. by Futurepower(R) · · Score: 1

    I agree, but I've already had a lot of fun and brain exercise doing programming. I'm looking for a permanent relationship. I want to get married.

  35. Parrot? by Anonymous Coward · · Score: 0

    It's under 2 megs when stripped.
    That's small, isn't it?

  36. winbatch by asciiRider · · Score: 1

    for you windows guys, better check out winbatch. It's BASIC - but you can compile it. There are "extenders" for just about every task you can think of. You can access OLE/COM - but chances are there is already a library for what you need. There is an IDE with built in debugging. Context sensitive help. Fantastic documentation too - great support community as well.

    Stolen from their webpage:

    WinBatch is:
    A complete programming language designed for all utilities
    A perfect tool for power users and system administrators
    A LAN utility development tool
    An Internet utility development tool
    A business process automator
    A high level programming language that is easy to learn and use, without the learning curve and complexity of traditional programming languages such as C, C++, and VB.

    No - it's not free - but it's cheap. The compiler is fairly expensive at $500 though.

    It's a fantastic tool - couldn't imagine managing windows boxes without it. Screw VBScript, why should I mess with objects to send something to the console or get at an environment variable?

  37. There's nothing wrong with Python anyway. by Randolpho · · Score: 1

    You know... most of the size of embedding Python is from the default library, which does not need to be included for embedded scripting. The actual binary of the python interpreter is barely over 20k.

    There's no reason *not* to use Python for your embedded scripting, IMO.

    --
    "Times have not become more violent. They have just become more televised."
    -Marilyn Manson
    1. Re:There's nothing wrong with Python anyway. by Christopher+Cashell · · Score: 1

      Erm. . . Python is a little bigger than that (and it's also getting bigger with each new release):

      nexus:~$ dir /usr/bin/python*
      -rwxr-xr-x 1 root root 511K Jul 4 2003 /usr/bin/python2.1*
      -rwxr-xr-x 1 root root 832K Nov 17 18:22 /usr/bin/python2.2*
      -rwxr-xr-x 1 root root 961K Jan 4 05:29 /usr/bin/python2.3*


      If you're only seeing it as 20k, it's possible your distribution uses some kind of wrapper program that calls the "real" Python binary. I assure you, Python would not be nearly as useful as it is, if it were only a 20k binary.

      And before anyone jumps in saying, "Those must be statically compiled and non-stripped binaries!", or something to that effect:

      nexus:~$ file /usr/bin/python2.*
      /usr/bin/python2.1: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), stripped
      /usr/bin/python2.2: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), stripped
      /usr/bin/python2.3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), stripped


      Python is a decent language, but it's definitely not lightweight, not when compared to languages like Scheme, Lua, etc.

      --
      Topher
    2. Re:There's nothing wrong with Python anyway. by Randolpho · · Score: 1

      Bah, you're right. I was looking at my windows install, not paying attention to the fact that the required .dll was in the system folder, not the install folder.

      It's 800k on windows, BTW.

      --
      "Times have not become more violent. They have just become more televised."
      -Marilyn Manson
  38. BeanShell for Java... by patniemeyer · · Score: 1


    BeanShell is the original lightweight scripting extension language for Java.

    http://www.beanshell.org/

    Pat

    1. Re:BeanShell for Java... by Anonymous Coward · · Score: 0

      What's the point of having a lightweight language embedded in a language that requires 40 megs of RAM to display a pop-up dialog box?

  39. TCL! by mi · · Score: 1

    Small (without the Tk part), multi-platform, truly interpretive, and created to be embeddable. From John Ousterhout's introduction to his book about his language:

    Tcl was born of frustration. In the early 1980s my students and I developed a number of interactive tools at the University of California at Berkeley, mostly for integrated circuit design, and we found ourselves spending a lot of time building bad command languages. Each tool needed to have a command language of some sort, but our main interest was in the tool rather than its command language. We spent as little time as possible on the command language and always ended up with a language that was weak and quirky. Furthermore, the command language for one tool was never quite right for the next tool, so we ended up building a new bad command language for each tool. This became increasingly frustrating.

    In the fall of 1987 it occurred to me that the solution was to build a reusable command language. If a general-purpose scripting language could be built as a C library package, then perhaps it could be reused for many different purposes in many different applications. Of course, the language would need to be extensible so that each application could add its own specific features to the core provided by the library. In the spring of 1988 I decided to implement such a language, and the result was Tcl.

    What else do you need? Oh, and if you are still thinking of making your own -- keep rereading the first paragraph of the quote above, until the silly thought leaves your mind...

    --
    In Soviet Washington the swamp drains you.
  40. I'm doing this with Ruby by CatGrep · · Score: 2, Interesting

    Until the 1.8 release the whole Ruby source code and libraries could be distributed on a 1.4MB floppy with room to spare. With 1.8 a lot of libraries have been added so it's about twice as big. (you can always leave out libraries you don't need to keep it light)

    Ruby is also easy to embed as well, but we decided to use swig to wrap our C++ classes so that they're accessable from Ruby and then script the whole thing in Ruby. This offers several advantages for our application since we wanted to allow users to script it anyway.

    Another project involves including Ruby and libs on a CD with a Ruby script that is used for license detection/management and installation. The Ruby script queries the rpm repository (on Linux) or registry (on windoze) and makes certain determinations about the system on which the actual software on the CD is to be installed. Turns out that including Ruby and most of it's libraries on the CD took much less room than the statically linked executables we used to include for doing the same thing (which were developed in C++). At any rate, the potential user of our CD doesn't need to have Ruby installed on their system because we include it on the CDROM and start up the Ruby script from a shell script (or a bat file on Windows.). Oh, and the Ruby code for this particular project that replaced C++ code is about 1/3 as big and only took us 1/4 of the time to develop & debug as compared to the previous C++ solution. And the Ruby-based system is much more flexible than the previous C++ one - when new requirements come in we can usually have the Ruby system updated & tested in a matter of hours as compared to days for the previous C++ based system. The productivity gains alone were well worth the conversion to Ruby.

  41. Re:!TCL by Anonymous Coward · · Score: 1, Interesting

    But TCL is showing it's age these days. TCL is really a pretty ugly language (has 'let' assignment syntax as I recall - oh the pain, I don't want to remember). It was fine in 1988, but now programmers hope for more. Seriously, there are much better choices now. I'm partial to Ruby myself (http://www.ruby-lang.org). It's quite easy to embed in a C/C++ app, or you can use SWIG to wrap your C/C++ code for access from Ruby. Ruby is pretty small as well, the sourcecode and libraries are about 1MB (well, it's a bit larger now with the 1.8 release, but you don't need all of the libraries that are included now).

  42. COM interfaces and stuff like it by Latent+Heat · · Score: 2, Informative
    Multi-language capability gets slammed with the argument that 5 different programming teams within an organization are going to write in 7 different languages, and how do you maintain that mess. To me, multi-language means I write the app in whatever language suits me, and users of my app write scripts and extensions in whatever language suits them.

    COM/ActiveX works swimmingly in this regard in that you have a choice of languages for both producing and consuming COM/ActiveX components, and COM allows you to pass object references across the barrier while ActiveX allows you to work with GUI widgets in this way. And it is true multi-language, not the fake multi-language of the .NET languages.

    On the other hand, COM/ActiveX pretty much limits you to Windows, you have to be careful of the lowest-common-denominator effect of which COM data types work in which languages (the more restrictive set of "Automation" types compared to the wider set of C-compatible types and a more restrictive situation for scripting languages and Web browsers than with Visual Basic 6). Also, COM/ActiveX can get ugly in some environments (C++ and MFC/ATL -- you are really stuck taking the Wizard-generated code at face value unless you really know what you are doing), and as a component developer you have to pick up some IDL basics.

    Is there anything out there that even comes close? With the Python/C-C++ meld, you are pretty much restricted to Python on one end and C++ on the other hand, and the C++ end is, shall we say, a bit lower level than the Python end, although there are things like SWIG that look amazingly like, hey, IDL and Visual Studio Wizard code.

    Another thing I have looked into is the Matlab-Java meld -- a lot of academic engineer and scientists use Matlab as their all-purpose scripting tool, but I wouldn't want to develop high power apps in it. The Matlab-Java meld is surprisingly clean, the Java side can be a Swing app and it runs in its own Swing windows. Again, you are restricted to Matlab on the scripting side, Java on the custom app side, but the interesting thing is that it is pointedly the sort of thing SUN isn't interested in. According to the SUN world view, Java is everything you would ever need and the idea of scripting Java from anything else doesn't enter into their universe.

    Is there anything else out there that scripts Java? I suppose there is Jython. Anything else?

    1. Re:COM interfaces and stuff like it by Valar · · Score: 1

      Multi-language capability gets slammed with the argument that 5 different programming teams within an organization are going to write in 7 different languages, and how do you maintain that mess.
      For many organizations, the issue is hiring and efficient staffing. If you have 7 languages, but you can only find programmers that know 3 of them, then you can only use those programmers for some of your projects. They go without work while you can't even find staff for some of your other projects.

      The place where I work "standardized" on one language and is probably about to pick up another one, because we are expanding beyond just webapps. I say "standardized" with quotations because we do have some perl and java stuff, despite being officially a coldfusion (and soon to be c#, maybe) shop. No one that works there came in knowing cf, but it is easy to learn, to the managers just hire programmers and we toss the manual at them. Works suprisingly well.

      By the way, why do you say that .NET is fake multi-language? I haven't done any work with it outside of c#, but I'm led to believe that VB.NET, j# and managed c++ work well as well (though it is obvious that c++ and j++ are just peace offers to companies that don't want to retrain their programmers). I've even seen Lisp, component Pascal and Forth compilers for .NET. Is it just the MS enthusism for C# that makes you say that?

  43. Existing scripting languages not always helpful by Anonymous Coward · · Score: 0

    One aspect of the big scripting languages that has been deeply unsatisfying in my own personal search for a language to embed has been the lack of robust sandboxing support, and generally weird hacks to support multiple simultaneous interpreters.

    My own particular application requires executing scripts entered in by unprivileged users. Basically, the idea is that users can log into the service and run (simple) programs on the server to perform mundane tasks. I suppose the closest idea you could compare it to would be the use of procedural languages in SQL DBs (the actual idea was inspired by MU*s with scripting languages, specifically the MUSH lines).

    Most of the big scripting languages are far too powerful for this task, leaving open possibilities for compromises and exploits galore. Efforts to sandbox these advanced scripting languages generally seem to fail due to the sheer complexity of possible interactions.

    As much as I'd like to support something everyone is familiar with, it seems like the only feasible approach is to develop my own interpreter from the ground-up, keeping in mind my security and resource management goals from the very start. I'm sure there's a scripting language invented like that already, but it's (1) hard to find, and (2) probably isn't documented well enough for me to have confidence in its design. Without a big mass of similar developers who have successfully used the source code, I'd have to vet the code myself anyway.

    So there you have it, an embedding problem which you can't solve by simply 'rewriting the application in the scripting language' or 'embed popular engine X'. It seems to require a scripting language specifically designed for embedding, sandboxing, and multiple interpreter instances from the very start. I think Scheme might work pretty well.

  44. LISP? by OmniVector · · Score: 1

    I can't believe LISP wasn't suggested. LISP has one of the most simple syntaxes in the world to parse. A lisp program basically consists of a list of functions. (functionName arg1 arg2 arg3) .... (function) such that each arg is! you guessed it, a function. parsing is so easy a 4 year old could handle it. implement some of the more basic methods needed for a useful application and you are pretty much done.

    --
    - tristan
    1. Re:LISP? by Anonymous Coward · · Score: 0

      I believe that he said small language. Common Lisp is one of the most gigantic languages that I've ever seen.

    2. Re:LISP? by RayFix · · Score: 1

      In fact, Scheme is a dialect of LISP. The other dialect, CommonLisp, is probably too large.

  45. REXX by Anonymous Coward · · Score: 0

    'Nuff said.

  46. Check out Ferite by FireChipmunk · · Score: 4, Informative

    Ferite is a scripting language and engine all in one managable chunk. It is designed to be easily extended in terms of API, and to be used within other applications making them more configurable and useful to the end user. It has a syntax similiar to a number of other langauges but remains clean and it's own language.

    I love that it was designed from the Start to be Thread Safe and Embeded, unlike PHP or Python.

  47. How could those features be sensibly added? by Futurepower(R) · · Score: 1

    I agree. So, how could those features be sensibly added to C++?

    Why do we have to abandon a language and invent new ones, with new quirkinesses?

    1. Re:How could those features be sensibly added? by buckinm · · Score: 1

      I agree. So, how could those features be sensibly added to C++?

      That's exactly the problem.
      You can't add every nice language feature to a single language without creating a huge mess.
      C++ is the prime example of this...
      C++ supports functions, it supports objects, it supports bit-twiddling. Because of this, any decently large project coded in C++ contains functions, objects, and bit-twiddling.
      One language for everything is just not the answer.

      --
      This isn't any ordinary darkness. It's advanced darkness.
  48. It takes great ability... by Futurepower(R) · · Score: 1

    It takes great ability to put stuff into a language, and do it right. I'm not talking about doing it wrong.

    1. Re:It takes great ability... by miniver · · Score: 1
      It takes great ability to put stuff into a language, and do it right. I'm not talking about doing it wrong.

      No, anyone can put stuff into a language. The hard part is identifying the 'good stuff'. The creator's of PL/I did a great job of integrating all of the concepts of Fortran, Algol, and COBOL into a single language. Unfortunately, they put ALL of the concepts into PL/I, not just the good ones. So instead of voting to 'Put all the good stuff into one language', why don't you start identifying the good stuff ... and then getting the rest of the programmers to agree with you? Once that's done, it can be put into a language by almost anyone.

      Personally, I'm not a single-language fanatic ... I've been programming for 25+ years, and I've probably learned more than a eighty languages (I stopped counting years ago, but I learn 3-4 a year). Not one of the languages I've used would have been perfect for ALL purposes, but many of them were damned good for their intended purpose (even COBOL).

      --
      We call it art because we have names for the things we understand.
  49. Groovy by Anonymous Coward · · Score: 0

    If you use Java, possible the best choice is Groovy

    http://groovy.codehaus.org/

    Groovy is very tightly integrated with Java, you can use Groovy classes from Java and Java classes in Groovy.

    " Groovy supports both static and dynamic typing so Java objects are seamlessly available in Groovy and vice versa. I can derive/overload Java classes in Groovy that are available to Java developers. i.e. Groovy is Java really; just using a Ruby-ish syntax." - James Strachan

  50. 5 teams and 7 languages by Latent+Heat · · Score: 1
    I presented 5 teams and 7 languages as a strawman argument. I am advocating that I develop applications or applications as a collection of software modules in the language I work with best, and I offer clients developing extensions using those modules the option of using whatever (one) language they work with best. It seems every time I advocate this approach people, come back at me with the "5 teams and 7 languages" as a bad way to develop systems -- that is not why I want multi-language.

    SUN and Java is in the one language is all you need for anything camp. Python is perhaps in the 2-language camp -- use Python for scripting, extensions, and even for major parts of the system, use C/C++ for core modules.

    .NET is sort of in the multi-language camp -- I would argue that VB.NET is a peace offer to the PHBs. I am not a VBer apart from having used it to see that my ActiveX widgets work in VB OK. But I know some VBers, and there is a remarkable lack of enthusiasm to upgrade to VB.NET. If you have ever seen Java, C# is no big deal, but VB.NET is an enormous shift, and it is not just that VBers don't want to learn new tricks -- I told that some features of VB 6 are no longer there.

  51. forgot for Java... Tcl by mughi · · Score: 1
    If you write ONLY Java, like I do in our days, its easy: the scripting language will be either Java(Dynamic Java, see: http://koala.ilog.fr/djava/ or Bean Shell, aka bsh, see: http:www.beanshell.org) or Java Script, aka Rhino, see: http://www.mozilla.org/rhino/ or any other language running on a JVM see: http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.ht ml

    You forgot a big one: Tcl. There is a pure Java Tcl interpreter Jacl. It's trivial to embed and use. I've used it to add scripting to tools, and to run the same Tcl scripts on Windows, Linux, Solaris, OS X, all from a single Java jar running on all of those.

    Remember, Tcl does stand for "tool command language:. :-)

  52. lu4 15 0nly f0r 3mb3dd1ng by Deraj+DeZine · · Score: 1

    Lua will not get more complicated because it is designed to be a lightweight embedded scripting language. The only complexity is that which the embedders choose to add to make the language useful within their programs. I read the Lua mailing list and it looks like it's going to remain as simple as it is (~10k lines of the common subest of ANSI C and C++).

    --
    True story.
  53. Re:!!TCL by mi · · Score: 1
    But TCL is showing it's age these days.

    And so does Unix -- if you listen to Windows zealots -- the 1970-ies technology...

    TCL is really a pretty ugly language

    Yes, and penguins are pretty ugly creatures. It is a matter of perception and -- as you mention -- partiality.

    easy to embed in a C/C++ app, or you can use SWIG to wrap your C/C++ code for access from Ruby

    SWIG can generate TCL wrappers (and Python, and Perl) just as well. TCL, however, was created to be embeddable. And its syntax allows for easy to understand application configuration files. Ruby may well be good, but that does not mean TCL is not.

    --
    In Soviet Washington the swamp drains you.
  54. Extensions and Spammers..... by tiger99 · · Score: 1

    Now here is a good thing, the spammers can bombard us with junk about language extensions instead of extensions to a part of the male anatomy, which at the moment seems to constitute 90% of all spam.

  55. Now the serious comment... by tiger99 · · Score: 1
    The only extension I personally need is not for a language per se, but for a spreadsheet. I really need to be able to run something in a spreadsheet cell which will do text processing like awk, or sed, or maybe like something else entirely, which as you all know is orders of magnitude more powerful than the pathetic string handling that Bill has deemed to give us. I really need good user-defined functions (and no, VBA will not do the job!), and I even need the facility to split a row containing a cell with a comma-separated list of things into multiple rows, one for each, with all the other cells replicated. No way known in VB, it can't add rows for example. I also really need a good case statement (like the dBase one, where you can test a lot more than a simple integer).

    The only way I can do this is by using a database instead, and a lot of bothersome fiddling about. Neither a database nor a spreadsheet come close to what I really need, an entirely new dimension of programming capability is needed.

    Even better if it would only work in OpenOffice.org, and under Linux or BSD, it would then provide a lever to move the management....

    Some way of actually putting shell scripts into cells, and connect the variables to other cells, would be the ultimate perfection, because then any other functionality needed would be accessible.

    I know what I need, but am not a good enough programmer to do it.

    Now, I hope that this is not completely off topic, it is after all an extension, even if not to a language as such. I also hope it will inspire competent people to progress spreadsheets to the next dimension and get way ahead of M$.... Maybe a super-extended spreadsheet would be the very thing to make several open source spreadsheets give M$ Office the sound thrashing that it deserves.