Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×

Searching for the Best Scripting Language 673

prostoalex writes "Folks at the Scriptometer conducted a practical survey of which scripting language is the best. While question like that is bound to generate flamewars between the usual Perl vs PHP, Python vs Perl, VBScript vs everything crowds, the Scriptometer survey is practical: if I have to write a script, I have to write it fast, it has to be small (less typing), it should allow me to either debug itself via a debugger or just verbose output mode. sh, Perl and Ruby won the competition, and with the difference of 1-2 points they were essentially tied for first place. Smalltalk, tcc, C# and Java are the last ones, with Java being completely unusable in scripting environment (part of that could be the fact that neither Java nor C# are scripting languages). See the 'Hello world' examples and the smallest code examples. Interesting that ICFP contests lately pronounced OCaml as the winner for rapid development."
This discussion has been archived. No new comments can be posted.

Searching for the Best Scripting Language

Comments Filter:
  • by Dimwit ( 36756 ) * on Saturday June 12, 2004 @11:38PM (#9410778)
    Two languages missing are:

    Io [iolanguage.com], which is an awesome, prototype-based scripting language that's super-easy to embed in C applications, and has an incredibly simple and consistent syntax.

    REXX [sf.net] (Regina's just one implementation). REXX makes it incredibly easy to do system scripting, with powerful string-manipulation and I/O redirection.

    Another one's ficl [sf.net], which is basically an embedable Forth interpreter. (To all you young geeks out there - LEARN FORTH. You may never need to write a line of it ever in your life, but you'll learn a hell of a lot about how computers work. Trust me on this.)
  • Scripting with Java (Score:3, Informative)

    by los furtive ( 232491 ) <ChrisLamotheNO@SPAMgmail.com> on Saturday June 12, 2004 @11:45PM (#9410840) Homepage
    If you'd like to try scripting with Java, then I suggest looking into Mozilla Rhino [mozilla.org], which allows one to script Java via JavaScript.
  • by rsidd ( 6328 ) on Saturday June 12, 2004 @11:46PM (#9410846)
    It's an incredible language. I'm writing programs now that are more concise than the Python equivalent and about as fast as C. It's really the holy grail I was looking for. (According to a more thorough shootout [bagley.org], ocaml is competitive in speed with C and often faster than C++, and well ahead of all other competition in speed.)

    The flip side is that before becoming productive one has to get used to a whole new way of thinking about problems: immutable data, everything is a function evaluation, no sequential statements, no side-effects, rely on recursion as much as possible, especially tail-recursion. But ocaml isn't religious about it: it has imperative features, including for and while loops, sequential statements (essentially successive function calls with side-effects and null output), and so on. After a while, though, you find you hardly need any of that. Maybe it's just me, but the sort of work I do is well suited to the functional approach. Also, it has a rich set of data structures and is pretty much agnostic about them: you can use linked lists, hashes, mutable arrays or records, sets, whatever suits your purposes.

    The other drawback is the libraries (modules) aren't as complete as the Perl and Python equivalents (though far ahead of most other competition). I imagine that will get cured with time.

  • Re:Biased (Score:5, Informative)

    by jelle ( 14827 ) on Saturday June 12, 2004 @11:49PM (#9410865) Homepage
    One-letter class names? Is he nuts? That guy never had to maintain code I guess...

  • by Teckla ( 630646 ) on Saturday June 12, 2004 @11:51PM (#9410883)

    If you'd like to try scripting with Java, then I suggest looking into Mozilla Rhino, which allows one to script Java via JavaScript.

    Rhino is a JavaScript interpreter written in Java, it's not a Java interpreter.

  • by krumms ( 613921 ) on Saturday June 12, 2004 @11:55PM (#9410909) Journal
    But it really does depend. I'd use Perl over Python for web development any day of the week (exception: Zope seems pretty cool, but I've not fooled with it enough. The 'everything is an object' metaphor is heaps cool though :)). Perl is faster to write and more expressive, Python is easier to read and - IMHO - often better structured.

    PHP is great for hacking web stuff together, but ... yeah ... the language itself seems a little hacked together - PHP5 fixes a lot of things, mind you so my opinion might change in a few months time after I've used it a little more.

    It worries me that a "feature complete" version of PHP instantly becomes a release candidate, rather than stewing in Beta for a while.
  • pulling a Tcl boner (Score:4, Informative)

    by Anonymous Coward on Saturday June 12, 2004 @11:57PM (#9410919)
    His Tcl example is not written fairly. The dude should know that that Tcl supports getopts:

    package require GetOpts 1.1

  • No PHP? (Score:3, Informative)

    by Anonymous Coward on Saturday June 12, 2004 @11:57PM (#9410920)
    I don't see PHP listed. It's possition on the list is arguable, but it certainly belongs there.
  • by linuxbaby ( 124641 ) * on Sunday June 13, 2004 @12:08AM (#9410978)
    Anyone interested in the benefits of different programming languages should read some of the great well-thought-out essays by Paul Graham [paulgraham.com]:
  • by Estanislao Martínez ( 203477 ) on Sunday June 13, 2004 @12:08AM (#9410982) Homepage
    And it made a good impression in one of my job applications, where the contact person knows it pretty well. It won't impress most people, sure, but (a) people who don't know Ruby will understand that means you could do Python, PHP or Perl; (b) people who do know Ruby will think better of you.
  • by KingOfBLASH ( 620432 ) on Sunday June 13, 2004 @12:14AM (#9411020) Journal
    php for real-time multiuser applications on the high level, C for real performance


    perl for non-real-time application (unless you're slashdot and have oodles of resources at your disposal, even then, it's still inefficient)

    Most copies of PHP use the equivalent of mod_perl [apache.org] -- i.e. they cache the compilation. Use mod_perl [apache.org], cache your compilations, and you will find performance is as good if not better than PHP.

  • by shimpei ( 3348 ) on Sunday June 13, 2004 @12:24AM (#9411082) Homepage
    Bah.. Perl doesn't even have an interactive interpreter..
    perl -de 0
  • by rolling_bits ( 754633 ) on Sunday June 13, 2004 @12:32AM (#9411130)
    Check out my site for some Ruby GUI stuff:
    (the gotcha is it's mostly in Portuguese. So jump to the "Exemplos Meus" (My Examples) section. Or use babelfish: http://babelfish.altavista.com [altavista.com])
    http://geocities.com/canalruby [geocities.com]

    Hey, web stuff is easy with Ruby as well. But I don't have such examples for you. You have to get a taste of Ruby to find about its web capabilities. I Know IOWA has an example:
    http://enigo.com/projects/iowa/index.html [enigo.com]

    Further enlightening at:
    http://www.ruby-doc.com [ruby-doc.com]
    http://www.rubyforge.org [rubyforge.org]
    http://raa.ruby-lang.org [ruby-lang.org]

    You know, once you get addicted, there is no going back! :-)
  • Re:vbscript (Score:5, Informative)

    by chromatic ( 9471 ) on Sunday June 13, 2004 @12:34AM (#9411141) Homepage
    PERLScript (why do people not spell it like an acronym any more?)

    It never was an acronym. See an explanation of Perl's name [wordiq.com] for an explanation of the backronym.

  • by CatGrep ( 707480 ) on Sunday June 13, 2004 @12:50AM (#9411207)
    now lets say i put Ruby on my resume....how much respect will that get?

    I just hired my replacement for a contract I was doing (I accepted another offer that was more in line with my field). One of the requirements was that the person hired would have to know Ruby because much of the code base was in Ruby. They hired someone from our local Ruby User's Group.

    So to answer your question: for this particular job if you didn't have Ruby on your resume it wouldn't get a second look. If you had Ruby on your resume, but it became apparent in the interview that you didn't know Ruby... well, the interview was over.
  • by SSpade ( 549608 ) on Sunday June 13, 2004 @01:02AM (#9411258) Homepage

    Forth? No.

    Learning forth will help you learn reverse polish notation, one specific trick for building high-performance interpreted languages and a very lightweight, easily extensible and embeddable scripting language.

    It won't, though, teach you anything about computers work beyond the small amount you'll pick up by learning any new language. Including French.

    If you want to learn how computers work there are far better things to play with. Assembly language [hkrmicro.com], obviously, whether it be a synthetic assembly language such as DLX or a real architecture. x86 isn't the most enlightening assembly language to start with (6502 is excellent, MIPS or for a really nice architecture, Alpha) but it'll run on your PC.

    Books. Patterson and Hennesey, Computer Organization and Design, The Hardware/Software Interface is pretty good for a programmers intro, but Hennesey and Patterson, Computer Architecture, A Quantative Approach will teach you a lot more, as will most texts with Superscalar in the title

    Learn a hardware description language. Verilog [verilog.net] is better, but VHDL is OK. Compilers and simulators are freely available [faqs.org] for both.

    Get an FPGA development kit. Compile yourself some hardware. You can put full CPUs [optushome.com.au] on a fairly cheap FPGA development board.

    Design your own CPU. It's possible for an individual or a small group to design a CPU [openip.org] and have it fabricated as a tinychip. I've seen individuals design a full, if tiny, CPU at mask level in a couple of months, and a small group put together a fairly decent gate level design in a few more. Commonly done as part of a college course, but an individual can have a tinychip fabricated for around $1000. Not cheap, but cheaper than some hobbies.

    You can do full circuit level design and simulate it using either gate level or spice transistor level simulators and see just why addition or multiplication takes as long as it does.

    As a general rule I've found that some of the best software engineers have some hardware design background, and a good understanding of computer architecture, so even if you never plan to do any hardware design, understanding how it all works is a good idea.

    Of course, I've also found that a large fraction of good software engineers have also spent time working as theatre technicians, so who knows what the correlations are...

  • by wirelessbuzzers ( 552513 ) on Sunday June 13, 2004 @01:16AM (#9411315)
    I suggest you also take a look at Haskell, if you have not done so already. Haskell completely does away with side effects, performing IO operations in a controlled manner through the use of a mathematical concept known as monads. It also adds lazy evaluation. This has some nice capabilities, such as being able to express concepts as infinite lists, which are then only evaluated as far as necessary.

    Yes, lazy evaluation can be done in OCaml too, but the syntax is uglier. You use the lazy module.

    I have used OCaml a bit, and one of the things that most irritated me about it was its complete lack of operator overloading; having to use "+" for integer addition, and ".+" for floating point addition, just seems so wrong to me. Haskell uses type classes to allow ad-hoc polymorphism in a controlled manner.

    Haskell's solution to the problem is ingenius, but unfortunately very often requires tagging of those classes, which is slow.

    One advantage that OCaml has over Haskell is speed; current Haskell implementations produce code somewhere between imperitive compiled languages and interpreted languages. However, there is another language, called Clean, that is nearly identical to Haskell in many ways, but claims to have speed comparable to C.

    Looks like Clean has a more powerful set generator than Haskell (it's basically SQL queries), a different class system, and rather different syntax. But it could be useful, I'll check it out.
  • Re:Duh (Score:3, Informative)

    by belmolis ( 702863 ) <billposer.alum@mit@edu> on Sunday June 13, 2004 @01:29AM (#9411370) Homepage

    I can't speak for other people, but I know that my decisions about what language to use haven't been based just on what I already know and what community I want to join. For instance, my first language was Fortran. After that I learned Basic and assembly language (Mix, just on paper, and the language of a Japanese laboratory minicomputer the model of which I no longer remember. The only documentation I had was in Japanese, which at the time I was just learning. And people complain about man pages!). When I first learned C, it was in a situation in which I could also have used Fortran. I learned C because it looked like it would be a better language and I was interested in trying something new.

    For scripting languages, for many years I used either a shell (sh or csh) or awk. When Perl came along, I read the book and twice made stabs at writing something non-trivial in it, but just couldn't bring myself to do it. I attribute this to my innate sense of good taste. Both the language itself (through non-orthogonality, excessive overloading, and lots of little tricks) and the Perl community (through typical practices and valuing short, cryptic code) encourage unreadable code. At the same time, I knew that AWK was not ideal for some kinds of programs (and I"ve written 500 line AWK scripts, and AWK scripts that write and then execute other AWK scripts) so when Python came along, I was interested. I still use AWK for some things since I know it well and the automatic parsing is handy, but more and more I am using Python. I find that Python encourages good programming practice and provides everything that I would get from Perl. I've also tried Tcl, to the extent of writing a moderately complex (1500 line) program. For some things it is fine, but I don't think it scales up as well as Python.

    So I think that my choices, and probably other people's, aren't just a matter of inertia and general type of programming.

    For me, by the way, in a lot of cases, Unicode support is important. That's a nice feature of Python. Ruby looks interesting, but as far as I can tell doesn't support Unicode. Anybody know if Ruby does, or will soon, support Unicode?

  • by Tablizer ( 95088 ) on Sunday June 13, 2004 @01:33AM (#9411386) Journal
    In a similar vain, I wrote up a scripting language comparison document, but focused more on features rather than particular languages. Comparison Link [geocities.com]. I describe the various feature options, and then weigh the pro's and con's of each.

    After years of debating language features, I generally conclude that a lot of it is subjective. No language will ever satisfy everybody.
  • Re:Biased (Score:1, Informative)

    by Anonymous Coward on Sunday June 13, 2004 @01:39AM (#9411415)
    mono-debugger [ximian.com]
  • by jwkane ( 180726 ) on Sunday June 13, 2004 @01:42AM (#9411430) Homepage
    .*? = snag all chars in non-greedy mode
  • by davegust ( 624570 ) <gustafson@ieee.org> on Sunday June 13, 2004 @01:43AM (#9411434)

    nothing in the OS was ever really meant to be scriptable

    That's not really true. Most OS functions are available through COM interfaces [microsoft.com]. VBScript and JScript interact with any COM interface through the Windows Scripting Host, either in a windowed enviornment (wscript) or a command line environment (cscript). You can manage users, files, ACLs, the registry, network configurations, IIS, application deployment (MSI), multimedia, services, etc. And's it's all done with a nice component paradigm of methods, collections, and properties. Those same COM interfaces are also available for application development to VB6 (native), C++ and .NET.

    We've had this COM environment for 10 years with Windows. In my opinion it's more powerful than the "everything's a pipe" approach.

  • by Heywood Jablonski ( 543761 ) on Sunday June 13, 2004 @01:56AM (#9411476)
    I thought the first P stood for "Personal" originally ("Personal Home Pages"). Now it's supposed to stand for "PHP" ("PHP: Hypertext Processor").
  • by Hungus ( 585181 ) on Sunday June 13, 2004 @01:57AM (#9411480) Journal
    I don't know where you got your info on the origin of PHP but the official history found at PHP.net [php.net] states this:
    PHP succeeds an older product, named PHP/FI. PHP/FI was created by Rasmus Lerdorf in 1995, initially as a simple set of Perl scripts for tracking accesses to his online resume. He named this set of scripts 'Personal Home Page Tools'. As more functionality was required, Rasmus wrote a much larger C implementation, which was able to communicate with databases, and enabled users to develop simple dynamic Web applications. Rasmus chose to release the source code for PHP/FI for everybody to see, so that anybody can use it, as well as fix bugs in it and improve the code.

    PHP/FI, which stood for Personal Home Page / Forms Interpreter, included some of the basic functionality of PHP as we know it today. It had Perl-like variables, automatic interpretation of form variables and HTML embedded syntax. The syntax itself was similar to that of Perl, albeit much more limited, simple, and somewhat inconsistent.
    So while its origins lie directly in PERL it was not names Perl Header Pages. So 5 points for effort, -27 points for accuracy
  • by RedWizzard ( 192002 ) on Sunday June 13, 2004 @02:55AM (#9411678)
    You're assuming 'limit' is less than or equal to 256 without checking. You're assuming that x, y, and z are set to nulls. You're not handling regional text (i.e. accented alphabetics) or unicode. You also haven't accounted for the fact that the Perl code returns the three bracketed sections of the match in variables.
  • by _pruegel_ ( 581143 ) on Sunday June 13, 2004 @03:03AM (#9411691)
    The BeanShell lets you use pure Java as a scripting language and it's almost trivial to include the BeanShell in your Java application.
    See http://www.beanshell.org/ [beanshell.org].
  • Re:vbscript (Score:3, Informative)

    by Yath ( 6378 ) on Sunday June 13, 2004 @03:05AM (#9411697) Journal
    You may not be aware of this, but the article you linked to is a copy of this one [wikipedia.org]. In the interest of giving credit where it's due, you might want to give Wikipedia more exposure in the future.
  • by DavidNWelton ( 142216 ) on Sunday June 13, 2004 @03:20AM (#9411735) Homepage
    My friend Salvatore and I did a similar site, although we haven't added so many languages and tests, and are more focused on benchmarking. It's available at: scutigena.sf.net [sf.net]
  • by MoonChildCY ( 581211 ) on Sunday June 13, 2004 @03:45AM (#9411808) Homepage
    If you bothered to read the article...

    The lines of code needed to achieve a task are measured, as they serve as an indicator on how fast one can create a script.

    If you need 20 lines of C# to check if a file exists, but only one in Perl, then according to the study, Perl should receive a better weighted score for ease of implementation.

    Read the articles people! They are interesting (at least most of the time).
  • Re:PHP (Score:3, Informative)

    by jpkunst ( 612360 ) on Sunday June 13, 2004 @03:49AM (#9411815)

    A prime example is the way that Perl has seperate numrical and string comparitors (==/!= and eq/ne) whereas PHP has only the one (==). This recently came up in the story about the Perl periodic table of elements and I even gave my own answer on this problem. Just to rehash: Perl and PHP are loosely-typed languages so the programmer really needs to tell the interpreter how to compare the mixed numerical/string "scalar" type that both Perl and PHP use. But PHP tries to simplify at the expense of introducing ambiguity.

    PHP has == and != for simple comparison, and === and !== for enforcing that the comparants (is that a word?) are also of the same type.

    See http://nl3.php.net/manual/en/language.operators.co mparison.php [php.net].

    JP

  • by Anonymous Coward on Sunday June 13, 2004 @04:28AM (#9411916)
    okay. you are completely playing an apples and oranges game here comparing command-line piping to a heavy component architecture. (COM vs. CORBA would have been more appropriate.) But I'll bite.

    COM as it compares to Common Unix CLI Utils:

    - it's much slower

    - requires a huge amount of effort and code bloat to create your own.

    - requires a messy register/unregister process to distribute or use

    - even with the huge amount of COM objects MS offers, they still can't match the functionality of common unix tools.

    - generally COM objects are either undocumented, or suffer from poor documentation compared to unix command-line equivalents.

    - as was pointed out by another...COM requires a full implementation/interface to be loaded and exposed even when the client needs very limited functionality 99% of the time.

    - COM collections are awful. Particularly since most of MS's languages do not know how to box a primitive into an object. (IE, try putting a few ints into a collection and pulling them back out in a foreach. better hope you are in VB and can grab that 16byte(!!!) variant object.)

    - 10 years. Wow. I can't think of one common unix tool that hasn't been around for at least ten years.

    - COM sucks. Even MS knows it. Why do you think they ditched it?
  • by Fourier ( 60719 ) on Sunday June 13, 2004 @04:38AM (#9411935) Journal
    I searched around a bit, and found that someone's already done it [u-tokyo.ac.jp]. It uses the PCRE library along with a camlp4 macro that provides an elegant "match ____ with" construct tailored specifically to regexps. I'm impressed.
  • Re:Biased (Score:2, Informative)

    by djeca ( 670911 ) on Sunday June 13, 2004 @04:45AM (#9411954)

    sh doesn't have true RE handling builtin, it only has globs through 'case'

    Note that this isn't true in bash - bash scripting has extended globs feature equivalent to POSIX REs except for lacking backreferences. And you don't have to use case, you can use the [[ builtin.

  • Re:Why I like perl (Score:4, Informative)

    by davegaramond ( 632107 ) on Sunday June 13, 2004 @05:06AM (#9412004)
    Before you cough on Ruby and said "2" + 2 in Ruby will equal 4, have you even tried it? Ruby (and Python) are _strongly-typed_ languages, unlike Perl (and PHP) which are weakly-typed. Ruby protects you from mixing string and numbers in operations like +. You'll have to say "2".to_i + 2.

    And having used all four of those for projects large and small, I can say with confidence that I prefer strongly typed language. Weakly typed language is more dangerous and error-prone.
  • Re:flamewar volley 1 (Score:5, Informative)

    by JWSmythe ( 446288 ) <jwsmytheNO@SPAMjwsmythe.com> on Sunday June 13, 2004 @05:12AM (#9412022) Homepage Journal
    But they probably would want it at least in the language, so it would be:

    <? print "Hello World" ?>

    or

    <? echo "Hello World" ?>

    They probably should have included it, but that would add quite a few other "web" scripting languages, as long as they have a way to run them locally. Off the top of my head, I'm thinking ColdFusion, I'm sure there are more.

    I think a fun game would be to find the longest way to print "Hello World", without unnecessary filler functions or comments. My first attempt would be to have the Base64 encoded string as a variable, then decode it, then print it, and have all that in an encoded eval.

    I found a script someone had that did their "protection" that way. Without the registration key, you couldn't run it, and they had this beautiful set of encoded strings in evals that did the checking. Took me a good 20 minutes to figure the whole thing out. Then I rewrote that part, so I could try the software without a working key. :)

    The software was otherwise crap, except for all the work they had put into requiring the key. I tried it, and proceeded to delete it. It would have been nice if they had a shareware version to try first. I'm really glad I didn't spend the $200 they wanted for it.

  • Re:Why I like perl (Score:3, Informative)

    by JamesKPolk ( 13313 ) on Sunday June 13, 2004 @05:28AM (#9412066) Homepage
    irb(main):001:0> 2 + "2" TypeError: String can't be coerced into Fixnum from (irb):1:in `+' from (irb):1
  • by Cato ( 8296 ) on Sunday June 13, 2004 @05:58AM (#9412140)
    Perl is definitely more capable in regexes than most languages, and having regexes in the language makes it easier to do regex-heavy tasks, or use them where most languages would support imperative code. Since Perl's regex support is so strong, it enables commented multi-line regexes using the '/x' modifier at the end of the regex, e.g. (with broken indentation and comment alignment due to Slash/HTML...):
    $str =~ /
    (.*?) \& # Match zero or more characters up to '&', non-greedy
    (\w+) \( # Match one or more word characters up to '('
    (.*?) \) # Match zero or more characters up to '(', non-greedy
    /gisx;
    This is not so quick to type, but still less than the equivalent non-regex code typically, and makes it easier to see what is going on a year later. Perl also has great regex debugging available. Perl is a sharp tool - it enables you to write very concise and unreadable code, just as it enables you to write slightly more verbose and more readable code. With Perl 6 and its Parrot virtual machine implementation, users of Python and other languages should also be able to access the thousands of CPAN modules, bringing the amazing reach of CPAN to a wider audience that doesn't necessarily want the Perl syntax.
  • by brewt ( 709694 ) on Sunday June 13, 2004 @06:20AM (#9412190)
    When a program says "shift;", I can't just look up "shift" in the perl manual somewhere,

    You mean, "perldoc -f shift"? wow that was hard!

    I have to already know about how @_ works in order to understand what the program is doing.

    That's just fairly basic Perl.
  • by Haeleth ( 414428 ) on Sunday June 13, 2004 @06:28AM (#9412201) Journal
    I also like OCaml (learned it in school), although it has a missing feature: you can't for instance define a union type with a member that would have a set of the same type e.g.:

    type t =
    A of a |
    B of t Set
    won't work...


    That's because Set is a module, not a type. Sets are done with functors, you need to instantiate Set.Make with a module whose signature matches Set.OrderedType.

    It's possible to do exactly what you want using recursive modules - in fact, this is the example the OCaml Reference Manual gives for recursive modules:
    module A:
    sig
    type t = Leaf of string | Node of ASet.t
    val compare: t -> t -> int
    end
    = struct
    type t = Leaf of string | Node of ASet.t
    let compare t1 t2 =
    match (t1, t2) with
    (Leaf s1, Leaf s2) -> Pervasives.compare s1 s2
    | (Leaf _, Node _) -> 1
    | (Node _, Leaf _) -> -1
    | (Node n1, Node n2) -> ASet.compare n1 n2
    end
    and ASet: Set.S with type elt = A.t = Set.Make(A)
    As for the lack of overloading, in the few cases where it's actually useful you can normally achieve the same effect by wrapping your types in objects, since OCaml conveniently separates object typing from inheritance.
  • by Daath ( 225404 ) <lp AT coder DOT dk> on Sunday June 13, 2004 @06:31AM (#9412204) Homepage Journal
    Also Small [compuphase.com].
    Lisp.
    Scheme [scheme.org].
    Actually just pick [dmoz.org] one [google.com] ;)
  • TCL Got shortchanged (Score:4, Informative)

    by EvilTwinSkippy ( 112490 ) <yoda AT etoyoc DOT com> on Sunday June 13, 2004 @07:10AM (#9412283) Homepage Journal
    I was reading through the criteria, and TCL was docked points for not being able to pass commands through the command line and not having a debugger.

    Both are untrue. TCL will happily take command line arguments, and if you set the execute bit under unix, will happily act as programs. If by "programs can be passed over the command line" that he wants to bang out to the shell, there is the exec command. Of course in his hello world program he uses BOTH features.

    TCL gives you a complete stack dump on every error that is stored in a global variable "lastError", and you can override the background error with the bgError command. That also covers the "FullInterpreter in Debugger". The language was designed AS a debugger to C programs for christ's sake.

    All told that cost TCL 15 points.

    Sure I'm quibbling, but if you aren't going to compentantly seek out features save in all your favorites, you look like an idiot putting these comparisons together.

    (Disclosure: TCL Guru.)

  • by Karellen ( 104380 ) on Sunday June 13, 2004 @07:47AM (#9412334) Homepage
    Heh. Not only did he do that, he returned the pointer into an int (which isn't guaranteed to work), and then failed to return any value at all if limit = 0 (which is always fun for the caller).

    Burn your keyboard. And your C manuals. Take up Visual Basic or something :)
  • by Almost-Retired ( 637760 ) on Sunday June 13, 2004 @08:21AM (#9412405) Homepage
    It is a 24/7/365 environment. The box itself usually gets uptimes measured in months, and if we discover its gone away, we have catchup scripts that can bring things back uptodate in just a few minutes.

    We've considered redoing that script in php so we could run it on one of the linux boxes there, but haven't managed to find a round "tuit" yet :)

    Thats the only machine in the place thats still stuck with a bnc type 10BaseT card. Its an elderly 2k, with an FF40 card for brains, a picasso-II video and 32 megs of ram. For all the hoorah about the FF40 card being made without some of the system bus signals, with the version 3.4 Plug-n-go roms for use with os3.1, its been very very bulletproof, for a "migi".

    Usually, when we have to reboot it to get thigs back among the living, we have to reboot the NT server its getting its data from because something in the NT networking has a tummy ache too. The news room clients can access it, but the migi can't until the NT box has been rebooted too. :-)
  • Re:flamewar volley 1 (Score:2, Informative)

    by dieScheisse ( 554308 ) on Sunday June 13, 2004 @08:39AM (#9412465)
    True, except the latest versions of php 4.x have a 'CLI', non-web version.

    As a matter of fact, the older versions had a CGI version which could be run from the console as well.

    So, yes, it should have been included.
  • by menkhaura ( 103150 ) <espinafre@gmail.com> on Sunday June 13, 2004 @09:06AM (#9412532) Homepage Journal
    The function signature is 'int', whereas at this point it is returning a char *... Yeah, burn it!
  • by srussell ( 39342 ) on Sunday June 13, 2004 @09:21AM (#9412564) Homepage Journal
    This is not flaimbait: I'm honestly curious.

    About six months ago, I decided I needed to re-learn functional programming, so I did a project in Haskell and learned that. More or less. I still find Modads awkward, and IO is a total pain in the ass, but all in all, I really like Haskell. However, at some point, I noticed the performance issues; Haskell is pretty slow -- slower than some scripting languages, like Ruby, for a lot of tasks.

    So then I looked at OCaml, because OCaml has a reputation for being fast, and it is also a functional programming language that compiles to native executables.

    I have to say, my first (and lasting) impression was: WTF? Look at this:

    1 + 1 (* Add two ints *)
    1. +. 1. (* Add two floats. WTF? Why?
    Is the compiler so stupid that it
    can't recognise floats? *)
    1 + 1.0 (* Error! *)
    1 +. 1.0 (* Error! *)
    let f x y = x + y (* Define a function *)
    let rec f x y = f (x-1) y (* Define a recursive
    function. Again, why? *)

    Why do I have to *tell* the compiler that the function is recursive? The compiler is able to do inferrence type checking; why can't it tell that a function is going to recurse? In fact, why is there "let" anyway? Seriously, the compiler should be able to figure these things out. Haskell's compilers do. And did they decide to end lines with two semi-colons just to add keystrokes? Why? Why? Why?

    The simple fact is that Ocaml requires the programmer to do a lot of the compiler's work for it. I find this to be the most annoying feature of any programming language. Ocaml gets rid of some stupidities, like variable type declarations, but it adds all of this other stupid syntactic cruft that shouldn't be necessary.

    OCaml is popular. It is efficient (lines of code), and it creates fast executables (second only to C). There are a lot of reasons to love it, and I feel obligated to learn it, but I'm having a hard time getting over what superficially appear to be poor language design decisions. So, is there a good reason for the extra syntactic oddness in OCaml, or is it just there because it always has been?

  • Scripting is good (Score:3, Informative)

    by X-Nc ( 34250 ) <nilrin@gmail.COMMAcom minus punct> on Sunday June 13, 2004 @09:29AM (#9412584) Homepage Journal
    I was rather surprized at the results of the test. I knew perl would be on top. Whether it's best or not it will always be in the winners circle because it is the "tool of choice" even when it isn't the best tool for the job. ruby was nice to see up there. It's a really good language; kind of what you'd bet if perl and python had a baby. But the real shocker was that sh was picked. In any kind of "test" like this the Bourne shell should always be a run away winner. UNIX shell programing, with all the UNIX command line tools (awk, sed, grep, etc.) if the hands down best generic scripting option for simple to medium level, cross platform, portable scripts. Hell, that's what it was created for.

    One of the down sides to the advancement of the free "as in everything" OSs is that people are learning lots of perl and python and such but not learning shell. Whether you are a developer, sysadmin, user or tinkerer you should learn shell first and always add it to the list of tools to evaluate for any situation that comes up.

  • by rsidd ( 6328 ) on Sunday June 13, 2004 @10:40AM (#9412949)
    Actually, the infix operators + and +. are themselves syntactic sugar for the prefix operators ( + ) and ( +. ). (Try it.) As for why different operators are needed for floats and ints, it's to make type inference easier for the compiler, I think. In an expression like "let triple x = 3 * x", you don't have to tell the compiler the type of x or triple: it assumes both are ints. If you instead use a float, you get a compile error; if you want floats, you have to write the expression differently. The nice thing is that once you get rid of all these compile warnings/errors, the program usually runs correctly first time.

    As to the double semicolon, it's because the single semicolon is a statement separator (like in other languages, except you don't use it often in ocaml), while the double semicolon is a function terminator. You don't need the double semicolon all that much: using the interactive toploop, you may need it once in a large block (basically to let the toploop know you're done), and when compiling from a file, often even that can be omitted (for example, if the next statement is a "let"). So you could write rather large programs without any double semicolons.

  • by daniel_yokomiso ( 641714 ) on Sunday June 13, 2004 @11:43AM (#9413315) Journal
    You can do this in Haskell:

    match-all $ case-insensitive $
    do {
    many (not '&');
    char '&';
    many whitespace;
    char '(';
    many (not ')');
    char ')'
    }

    Not one-hundred lines, descriptive and do, IIUC, what your one-liner does. Functional programming languages (specially Haskell and Scheme) can be both concise and clear. BTW we can easily abstract common regexes away, for example the parenthesis thing above:

    parenthesis pattern =
    do {
    char '(';
    pattern;
    char ')'
    }

    match-all $ case-insensitive $
    do {
    many (not '&');
    char '&';
    many whitespace;
    parenthesis $ many (not ')')
    }
  • by Estanislao Martínez ( 203477 ) on Sunday June 13, 2004 @12:15PM (#9413507) Homepage
    $ sml
    Standard ML of New Jersey v110.42 [FLINT v1.5], October 16, 2002
    - 1 + 1; (* Add two ints *)
    val it = 2 : int
    - 1.0 + 1.0; (* Add two floats *)
    val it = 2.0 : real
    - 1 + 1.0; (* Error! *)
    stdIn:5.1-5.8 Error: operator and operand don't agree [literal]
    operator domain: int * int
    operand: int * real
    in expression:
    1 + 1.0
    uncaught exception Error
    raised at: ../compiler/TopLevel/interact/evalloop.sml:52.48-5 2.56
    ../compiler/TopLevel/interact/evalloop.sml:35.55

    - fun f x y = x + y; (* Define a function *)
    val f = fn : int -> int -> int
    - fun f x y = f (x-1) y; (* Define a recursive function *)
    val f = fn : int -> 'a -> 'b
  • by Decaff ( 42676 ) on Sunday June 13, 2004 @12:51PM (#9413723)
    Beanshell is not Java, so your point is moot..

    I would argue that this is not true. You can type in and execute Java code into the BeanShell prompt and it will execute interactively. BeanShell itself is written 100% in Java.

    You may say its not Java because its not a part of the standard Java APIs, but there are plenty of other scripting extensions to Java that are: Java scriptlets in JSP pages; the Java Standard Tag Library in JSP pages.

    I can complete most string manipulation tasks in Perl in 5 lines as compared to over 100 in Java.

    Yes, Perl is a very consise language that is superb for scripting. For string manipulation and many other tasks it's unbeatable.

    Java is simply not suitable in a scripting environment.

    That was not the point that was being made. The article said 'Java was completely unusable in a scripting environment'. This not true. Perhaps the most widely used example is JSP, the java equivalent to PHP and ASP. You can open up a JSP page, type in Java code, and have that page run immediately as part of a live web application. As with PHP you can add and edit pages containing code without shutting anything down. As far as the developer is concerned there is no compile-edit-run cycle. If that is not scripting, what is?
  • by chromatic ( 9471 ) on Sunday June 13, 2004 @02:07PM (#9414193) Homepage
    I personally would much rather somebody came up with a longhand way to do real regexps.

    How about Regexp::English [cpan.org] in Perl 5 or Perl6::Rules [cpan.org] in Perls 5 and 6?

  • by mtsv01 ( 688338 ) on Sunday June 13, 2004 @03:35PM (#9414679) Homepage
    Another interesting comparison of programming languages is "An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl" [fu-berlin.de]
    The interesting conclusions are:
    • Designing and writing the program in Perl, Python, Rexx, or Tcl takes no more than half as much time as writing it in C, C++, or Java and the resulting program is only half as long.
    • No unambiguous differences in program reliability between the language groups were observed.
    • The typical memory consumption of a script program is about twice that of a C or C++ program. For Java it is another factor of two higher.
    • For the initialization phase of the phonecode program (reading the 1 MB dictionary file and creating the 70k- entry internal data structure), the C and C++ programs have a strong run time advantage of about factor 3 to 4 compared to Java and about 5 to 10 compared to the script languages.
    • For the main phase of the phonecode program (search through the internal data structure), the advantage in run time of C or C++ versus Java is only about factor 2 and the script programs even tend to be faster than the Java programs.
    • Within the script languages, Python and in particular Perl are faster than Tcl for both phases.
    • For all program aspects investigated, the performance variability due to different programmers (as described by the bad/good ratios) is on average about as large or even larger than the variability due to different languages.
  • by Rubidium ( 109518 ) on Sunday June 13, 2004 @09:35PM (#9416612)
    The use of + versus +. is necessary in OCaml so that the compiler knows what types to properly infer in an expression. Otherwise, if there are nothing else that provides fixed types in the expression which could help limit the types of other parameters and the result of the expression, then explicit types have to be used to force types to those wanted, which is a major problem in SML, which doesn't use + versus +.

    As for the use of let versus let rec, this is necessary as the two scope differently. With let the scope in the function or binding is that before it, whereas with let rec the scope in the function or binding includes the new function or binding. You imply above that let should always have let rec semantics, but this would have the problem that functions could not use previous functions of the same name, and bindings could not refer to previous bindings of the same name, as they would already have themselves in their own scope, which would mask any previous functions or bindings of the same name.
  • by killjoe ( 766577 ) on Sunday June 13, 2004 @09:52PM (#9416671)
    It's apparent by now you haven't used perl or CPAN. If you had you would know how much jakarta and CPAN differ.

    You seem to confuse a build system like Maven and a package installer system like CPAN. CPAN is more like apt-get and maven is more like make on steroids.
  • Until another language offers what CPAN does I don't care that much about it

    I know it probably doesn't matter to most of you, but even lisp has something like CPAN. Its called ASDF, and there is a library called ASDF-Install. Of course common lisp lacks the huge number of libraries that more popular languages have, but (I have to admit) its getting better (getting better all the time).

    ASDF on cliki [cliki.net]

  • by SewersOfRivendell ( 646620 ) on Sunday June 13, 2004 @11:29PM (#9417132)
    For example. Python and ruby are both MoreObjectOriented then perl. They both have large and active communities. They both have extremely smart and dedicated communities and yet neither one has the equavalent of CPAN. Ruby has an archive at least and python has a half assed repository but all of it poorly documented and can't be installed without manual downloading.

    The answer is that perl came first. Building sophisticated infrastructure like CPAN takes time, and requires a certain critical mass of contributing developers to be effective and useful. As it happens, the Ruby folks are rapidly building a solution of their own devising, already quite usable. [rubyforge.org]

  • by Baby Duck ( 176251 ) on Monday June 14, 2004 @12:36AM (#9417393) Homepage
    los furtive was correct in his statement.

    Rhino is a JavaScript interpretter written in Java, but it is also a JavaScript-Java bridge. So it de facto does indeed allow you to script Java via JavaScript. I do it all the time. The Rhino site even suggests using Rhino for exactly this purpose.

    Beanshell lets you script Java, as well. Those scripts just like Java, with some additional console-friendly global commands thrown in the mix.

  • by rffrff ( 787845 ) on Monday June 14, 2004 @06:30AM (#9418384)
    You're right about docs and the fact that CPAN is more mature.

    You're wrong about the large library: what do you really need and could not find in ruby or python? Ask for it and probably you'll find that it exists.

    db access, pdf/xsl/OOo docs/svg creation, numerical stuff, GUI stuff, ssh/ssl/tsl stuff, smtp/imap/pop/nntp, web libs/templating, csv handling, xml/xsl/Schema/Relax-ng,YAML, SOAP,xmlrpc, Linda/tuplespace/remote objects access, TestUnit, optparse/getopt/GO::Declare.. I really don't have need for something else.

    And ruby has a way to install stuff automatically, it's called rubygems, and it interacts with rubyforge.org. It's a young project, but it's fully functional.

This file will self-destruct in five minutes.

Working...