Slashdot Mirror


The State of the Scripting Universe

r.jimenezz writes "Via PragDave's blog I learned of an article by Lynn Greiner on the state of scripting languages, a.k.a. scripting dynamic languages. A number of influential personalities (Guido von Rossum, Damien Conway, PragDave himself and others) were interviewed and it's interesting to see how much their opinions coincide despite being interviewed separately. A lengthy but worthwhile reading."

131 comments

  1. Dun dun dun... by ciroknight · · Score: 4, Funny

    The research firm reports that over 41 percent of the 666 developers surveyed use Perl, 32 percent use PHP, and 15.6 percent use Python

    The Number of the Devil of Programmers.. looks like it's as I always said, scripting languages are evil..

    --
    "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
    1. Re:Dun dun dun... by FidelCatsro · · Score: 2, Funny

      You see the unholy trilogy of Perl Python and PHP == PPP which if you turn upside will give you bbb ,then add the satanic powers of non compilation and you get a twisting effect turning the bbb to 666 ... i need more sleep

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
    2. Re:Dun dun dun... by ciroknight · · Score: 2, Funny

      Haha, and that was supposed to be a joke..

      Gosh I really need some sensitivity training or something.

      --
      "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
    3. Re:Dun dun dun... by ahdeoz · · Score: 1

      ddd... better hold it up to a warped mirror.

  2. What, no comments? by erykjj · · Score: 0, Offtopic

    I had to refresh a few times and still nothing! Then I tried submitting this and got a 500 server error and thought "Ah, now I understand!".

  3. What defines a scripting language? by tchuladdiass · · Score: 3, Interesting

    I have often wondered what makes a particular language a "scripting" language v.s. a "real" language. One thing scripting languages all have in common is that they are interpreted. However Basic is interpreted (even though some may dissagree that it is a "real" language), and there have been interpreted versions of Pascal and others.
    The best I can come up with is that a scripting language is an interpreted language that is normally attached to an application in order to allow the end user to automate functions within that app. So for example BASH programming is "scripting" since most of what you do is items that would normally be done at the command line. Same with Word/Excel macros. Also, TCL was designed to be attached to other programs (although the typical use is stand-alone). But I wouldn't put PERL in that catagory, anymore than GW-Basic or interpreted Pascal are scripting languages.
    So, what does a language need to be called a "real" language, other than being compiled?

    1. Re:What defines a scripting language? by Deagol · · Score: 2, Insightful
      Perhaps it's standardization? I'm just guessing here. Is there a IEFT/IEEE/ANSI/whatever standard for things like BASH, Ruby, and Perl?

      I'm not trying to be a wise-ass. I'm sincere here. Maybe a ratified standard by some authority is what sets COBOL, BASIC, and Ada apart from their more agile scripting counterparts, whether or not a compiler or interpreter implimentation exists.

    2. Re:What defines a scripting language? by Anonymous Coward · · Score: 0

      Nothing. I program in Ruby and the other P languages, and I don't distinguish between them and languages like Java or C++ (except that the later are slow and unproductive for me).

      When I write a short program in Ruby, I call it a "short program". I don't call it a "script".

      The days of "agile" languages being treated differently are over.

    3. Re:What defines a scripting language? by tha_mink · · Score: 0, Redundant

      I always considered it a top-down kinda thing.

      --
      You'll have that sometimes...
    4. Re:What defines a scripting language? by arkanes · · Score: 1

      The differences are rapidly shrinking. For example, there is very little technical difference between the way Java is compiled and ran and the Python is compiled and ran. It's really more a matter of feel and attitude than anything else.

    5. Re:What defines a scripting language? by FriedTurkey · · Score: 2, Insightful

      I would consider any programming language directly run from a text file a scripting language.

    6. Re:What defines a scripting language? by tchuladdiass · · Score: 1

      Just curious, what do you mean by "run from a text file"? Are your refering to the ability to say "perl mycode.pl"? Is there any case where an interpeted low-level language isn't run in this fashion?
      For example, back in the day your could run from a DOS command promt "gwbasic mycode.bas".
      Or are your refering to the ability to put for example "#!/bin/perl" at the top of a script and run the script directly? Because the that is a function of the OS, not the language (i.e, if gwbasic was available for unix you could use the same syntax, assuming that you could convince the interpreter to ignore the first line if it begins with "#").

    7. Re:What defines a scripting language? by Frequency+Domain · · Score: 3, Insightful
      I have often wondered what makes a particular language a "scripting" language v.s. a "real" language.
      I think languages were traditionally classified as "scripting" when their primary use was to control the execution of other executables. A point made by all of the folks in the interview is that languages such as perl, python, and ruby have developed well beyond that to the point where they can compete head-to-head with C, C#, Java, etc. In other words, trying to categorize languages as either "scripting" or "real" is inappropriate with these more modern tools.
    8. Re:What defines a scripting language? by bill_mcgonigle · · Score: 1

      So your argument is that a non-scripting language is one where the runtime is too dumb to figure out which source files need to be compiled to bytecode or interpreted before execution?

      I like it!

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    9. Re:What defines a scripting language? by FriedTurkey · · Score: 2, Informative

      If you say "perl mycode.pl", mycode.pl is still a text file.

      If you have file with "#!/bin/perl" at the top it is still a text file if you run it directly.

      Doesn't matter how you call it, it is still a text file.

      Yes, PERL is a scripting language.

    10. Re:What defines a scripting language? by cant_get_a_good_nick · · Score: 1

      Bourne shell (not Bash) is a POSIX standard. Not sure if Ksh ever made it that way.

    11. Re:What defines a scripting language? by chris_mahan · · Score: 3, Informative

      But what if I use py2exe for windows and transform my python program into a windows .exe file? Is python still a scripting language then?

      --

      "Piter, too, is dead."

    12. Re:What defines a scripting language? by tchuladdiass · · Score: 2, Insightful

      Then what about interpreted Basic or Pascal? Both of these can be run the same way. Keep in mind I'm refering to the language, not the implimentation.
      Of course, some will argue that Basic is a scripting language (or not a language at all), but I won't go there :-)
      Also, even though Pascal is usually compiled, it used to exist primarily as an interpreted language.
      I do agree that Perl is a scripting language, I just can't figure out why (since a perl script doesn't interact "control" another program), whereas a shell sciprt is a script because it is attached to and controls another program (the shell). Yet a Pascal or Basic program isn't a script even if it is run through an interpreter (although some dialects of Basic are scripts simply because of the primary purpose of the dialect, i.e. VB scripts atached to Excel macros).

    13. Re:What defines a scripting language? by FriedTurkey · · Score: 1

      No, it is not if produces a compiled program. Kinda like how Visual Basic Script is scripting and Visual Basic is not. Doesn't matter if Visual Basic uses runtime DLLs, it is still a compiled file. VBS uses another set of DLLs but runs from a text file.

    14. Re:What defines a scripting language? by binford2k · · Score: 1

      As he said already, "Doesn't matter how you call it, it is still a text file."

      There's even a project out there to run C code as a script. In that case, it would be a script written in C. A script is a text file, a program is a compiled file, that's all there is to it.

    15. Re:What defines a scripting language? by FriedTurkey · · Score: 3, Insightful

      Are you talking about a BASIC program run with MS BASICA or something? That is a text file and a therefore a script.

      Let's assume you are talking about Visual Basic. Yes, like Java, Visual Basic requires a runtime engine to execute. However, C++ and C require calls to the operating system. Try running a C++ program without an operating system and see how well it works. So in reality all progamming languages really require an "interperter" to execute. Maybe OS kernel code is the only real stand alone code.

    16. Re:What defines a scripting language? by Frequency+Domain · · Score: 1
      I would consider any programming language directly run from a text file a scripting language.
      You're confusing "scripting" and "interpreted" (as opposed to compiled). The fact that most scripting languages are intepreted doesn't mean that the two concepts are interchangeable. Most people wouldn't consider BASIC a scripting language.
    17. Re:What defines a scripting language? by FriedTurkey · · Score: 1

      Most people wouldn't consider BASIC a scripting language.

      I would have to disagree. Most people would consider the old DOS BASIC scripting.

    18. Re:What defines a scripting language? by Scott7477 · · Score: 3, Informative

      In the article, van Rossum defines a scripting language as one that lacks compile time checking. Pall includes as part of the definition the fact that in these languages memory management is handled
      by the interpreter.

      Hobbs refers the interview reader to a whitepaper which defines scripting languages as follows:

      "There is a category of programming languages which share the properties of being high-level, dynamically typed and open source. These languages have been referred to in the past by some
      as "scripting languages," and by others as "general-purpose programming languages". Neither moniker accurately represents the true strengths of these languages. We propose the term dynamic languages as a compact term which evokes both the technical strengths of the languages and the social strengths of their communities of contributors and users."

      One statement that Pall makes is great: "As more programming is done with scripting languages, doing memory management yourself, or implementing yet another LZW-based compression library will be seen as a risky proposition when deadlines approach."

      I totally agree with this; given that an interpreter manages memory decently, why reinvent the wheel? It is like building your own spark plugs from scratch when you want to do a tune up on your car.

      --
      "Lack of technical competence coupled with the arrogance of power, as usual, leads to no good end."
    19. Re:What defines a scripting language? by some+guy+I+know · · Score: 1
      languages were traditionally classified as "scripting" when their primary use was to control the execution of other executables.
      I agree completely.
      In fact, I have never considered Python or Ruby to be scripting languages at all; rather, they are interpreted languages, which is something quite orthogonal to being a scripting language.
      Simlarly, languages like awk are not scripting languages.
      Perl is somewhere in between.

      The one thing that I would add to your definition is that a scripting language is interpreted more or less sequentially.
      This means that makefiles are not scripting languages, even though their primary use is to control the execution of other executables.
      --
      Those who sacrifice security to condemn liberty deserve to repeat history or something. - Benjamin Santayana
    20. Re:What defines a scripting language? by 0racle · · Score: 1

      How would Perl be in between while Python is not?

      --
      "I use a Mac because I'm just better than you are."
    21. Re:What defines a scripting language? by Brandybuck · · Score: 1

      given that an interpreter manages memory decently, why reinvent the wheel?

      I don't want to dispute your point, as it does make sense. But it suddenly dawned on me that this particular memory management argument is being brought up so much that it's becoming sterile. To take your car analogy one step further, imagine that certain transmission advocates had been continually arguing for two decades that "given that automatic transmissions prevent the grinding of gears, why use a stick shift?"

      Or let's use are slightly more relevant analogy. Imagine that for two decades some people had been saying "given that calculators avoid arithmetic mistakes, why bother learning how to do long division?" This is more relevant because I KNOW people who can't do long division because of calculators. If a programmer doesn't know how to do memory managment because they've never had to, how do I know they can't do other forms of resource management?

      --
      Don't blame me, I didn't vote for either of them!
    22. Re:What defines a scripting language? by Homology · · Score: 2, Insightful
      Hobbs refers the interview reader to a whitepaper which defines scripting languages as follows: "There is a category of programming languages which share the properties of being high-level, dynamically typed and open source ..."

      This is cool, the article author just eliminated one very commonly used scripting language by require it to be open source : Visual Basic.

      Many widely used Microsoft applications has a scripting interface via Automation, and guess what, you can use Visual Basic for this! In general this works very well, actually, to well considering the number of scripting viruses. But as a scripting language with a common interface to other applications, it's very good.

    23. Re:What defines a scripting language? by Intron · · Score: 1

      python hasn't changed, but your program has. Its no longer a script. A good definition might be what you send to an end-user. If you send them source code, its a scripting language. If you send them binary, its not.

      --
      Intron: the portion of DNA which expresses nothing useful.
    24. Re:What defines a scripting language? by Smallpond · · Score: 1

      Nope. C isn't a scripting language. Any language where the first 50 lines of your code are used to invoke obscure rituals cannot, by definition, be a scripting language. perl starts with the #! line, then can get right to: print "Hello, World\n" on the second line.

    25. Re:What defines a scripting language? by teoryn · · Score: 1

      The operating system isn't acting as a intepreter, it's being invoked by the program.

    26. Re:What defines a scripting language? by binford2k · · Score: 1

      #include

      int main () {
      printf("Hello World\n");
      }

      What's that about 50 lines again?

  4. You dont use a sledge hammer to open your penuts by FidelCatsro · · Score: 5, Insightful

    Scripting languages will always have a place , Its a simple case of the right tool for the job.
    As a sysadmin most of my Programming is done in either ruby(im difrent) , shell(bash or ksh) or perl. Using C for most of the things i have to automate is as i said "Taking a sledge hammer to a penut" , It would be total overkill and waste my time and the systems and it would be more error prone .If i do have a larger project that requires a bit more power then i can prototype it in perl or shell then easily transcribe it to C .
    Scripting will always be an important part of my work , and with the increasing power and decresing price of computer equipment over the last few years , it has become viable to program many many things in languages such as python , things which would not so long ago, would have requierd the power of C/++.
    Scripting is in a fine state , and will continue to fill its end of the market , just as compiled languages will always have their place

    --
    The only things certain in war are Propaganda and Death. You can never be sure which is which though
  5. Another cool article about Tcl by DavidNWelton · · Score: 5, Informative

    This article:

    http://www.devsource.com/article2/0,1759,1778148,0 0.asp

    talks about some of the cool stuff that Tcl does. My favorite thing about the language is that it hits a real sweet spot with its level of abstraction. Python has an event loop now, in Twisted, but Tcl's had the same thing for ages, and it's very easy to use.

    1. Re:Another cool article about Tcl by the_womble · · Score: 1, Funny
      Look, TCL sucks because:
      1. Richard Stallman says its not a proper programming language
      2. It has a "peculiar syntax" (Stallman again) that makes it too easy to use
      3. It was not invented by GNU and , worse, it is not GPL (it has a BSD like license)
      4. It is not designed for huge applications therefore you should not use it at all
      5. The TCL community is not l33t enough and even help newbies sometimes
      6. Its too easy to get things like text munging and simple GUIs done. What the point if you get everything done in five minutes
      7. Did I mention Richard Stallman thinks it sucks?
    2. Re:Another cool article about Tcl by jbolden · · Score: 0, Redundant

      What exactly is the point of bring up an argument from 12 years ago while a very different topic is being discussed with people who mainly don't remember the original issues? The average /.er was in diapers during TECO vs. Lisp. What was it you wanted to achieve here? If you wanted to bring this up again I think you should have provided context.

      Here is an example of one of Stallman's critiques of TCL. Not sure if it is still valid or not but it isn't some nonsense issues

      Tcl also has some serious design flaws (not unlike most languages, I suppose). For example, it inherits C's arithmetic semantics, leading to behavior like:

      1234567890 * 1234567890 = 304084036 (Linux PC)
      1234567890 * 1234567890 = 1524157875019052100 (DEC Alpha)
      1234567890.0 * 1234567890.0 = 1.52527e+18 (Linux PC)
      1234567890.0 * 1234567890.0 = 1.52416e+18 (DEC Alpha)

      The argument in favor of correct mathematics is not simply a
      beauty-contest argument, but purely in keeping with Tcl's claim to be a "Very High Level Language" (as per its appearance in the recent USENIX VHLL Symposium). If you want to abstract away the machine from the end user, it's wise to not propagate its internal word size to users trying
      to build user interfaces for scientific applications!

    3. Re:Another cool article about Tcl by Spoing · · Score: 1
      1. 6. Its too easy to get things like text munging and simple GUIs done. What the point if you get everything done in five minutes

      Easy to start. Hard to debug and maintain. I'm forced to use and repair a PBH's idea of an ideal app daily...and I don't have time to get rid of it by re-doing it in Java or Python. I estimate that about 1/4 of my day is shot because of this monster.

      The reason why the PBH dictated TCL? He's a TCL wiz! The initial developer wasn't; he was a manager. The specialists maintaining it till I got my hands on it weren't either; they mainly deal with Java. Personally, I have no bias...though the app is not trivial and it needs to be expanded just to handle the new work. (Templates would work...though everything is currently hard coded.)

      I lump TCL in with Perl; the original developer can understand it, though if they do a 1/2 ass job, it's a real pain to deal with later. With Python, even bad ideas seem to be easier to deal with (and replace).

      --
      A firewall can not protect you from yourself. Turn off what you do not need. Do not use the firewall to do your work.
    4. Re:Another cool article about Tcl by Berfert · · Score: 1

      Oddly, I find Tcl to be one of the most easily maintained languages. There's very, very few special cases in the language. Yes, it's possible to write hard to understand code in Tcl, but that's true about every language... and you have to go out of your way (much more so than most languages) in Tcl to write ugly/hard to understand code.

  6. Developer productivity vs. CPU productivity by G4from128k · · Score: 5, Insightful

    For projects below a certain complexity level, I've always found scripting languages to be more productive for the programmer (very fast edit-run-debug cycles) even if they are less efficient for the CPU. And with the advent of JIT compilers, the efficiency of scripting is much improved.

    Given the low-cost of fast CPUs and high-cost of programmers, I'd rather waste CPU cycles than waste developer labor.

    --
    Two wrongs don't make a right, but three lefts do.
    1. Re:Developer productivity vs. CPU productivity by superpulpsicle · · Score: 1

      Less efficient is the keyword! There should be a BASH, KSH or Perl++ or something can optimize to the CPU. It's lame getting new hardware only to find out your script runs at the same speed as your old hardware.

    2. Re:Developer productivity vs. CPU productivity by Scott7477 · · Score: 1

      The interviewees in the article make this exact point.

      --
      "Lack of technical competence coupled with the arrogance of power, as usual, leads to no good end."
    3. Re:Developer productivity vs. CPU productivity by rjshields · · Score: 1
      ...or something can optimize to the CPU.
      One of the characteristics of a scripting language is that it is not compiled. Unless it is just-in-time compiled, there is no way to optimize it to the CPU!
      --
      In this world nothing is certain but death, taxes and flawed car analogies.
  7. Experience of a newbie... by CarlinWithers · · Score: 3, Informative
    When it comes to programming I know very little. My background is mostly in electronics and as a computer service tech. But I'd have to say I love scripting languages.

    I have a final project in my computer engineering diploma in which we are trying to monitor and control a few security devices over the web. The focus is about split equally between design of a PCB w/ microcontroller and getting the code written. Since my only formal training was in C, and at first I considered using C for the majority of the programming. However after some research I stumbled upon scripting languages.

    The result is that instead of a cumbersome 1000 line C program which would be a huge time sink, I have several small C programs connected with script. I'm using a combination of Bash script, PERL, and Java. I had to learn the basics of each but in the end that was faster and easy to debug. The time I saved went into more hardware hacking and making sure that the electronics portion worked better. In the end it made for a project that was much more fun.

    1. Re:Experience of a newbie... by FidelCatsro · · Score: 2, Insightful

      I must say that this is the correct way to think about it , If it works and it works well then why switch to C for the job.
      "Right tool for the job" is an important motif for efficent workmanship

      --
      The only things certain in war are Propaganda and Death. You can never be sure which is which though
  8. Mod parent up by Anonymous Coward · · Score: 0

    Incase anyone missed the joke, its a parody and a very funny one

    Mike Roca--

  9. Re:You dont use a sledge hammer to open your penut by Bastian · · Score: 2, Informative

    I don't think it's necessarily a question of project size, though, so much as the nature of a project. I have worked on some very large tools for which a scripting language is a much better choice. As far as I am concerned, C is best used when you're working with very large and rapidly changing data sets (C structs will probably always be lighter weight than objects) or you need to crunch a lot of numbers really fast.

    I think the way of the future is static languages like C for critical stuff, and dynamic languages like Ruby, Io, or some functional language for most of the program. . . much the way that programs used to be written in C with some inline assembler for the performance-critical stuff.

  10. Single file interpreter by Tersevs · · Score: 1

    I wish i could find a good scripting language like python and perl where the interpreter (and standard libraries) are distributed as a single executable file. CGIpython comes very close, but unfortunately it doesnt work in interactive mode (at least not the windows version). Oh well....

    1. Re:Single file interpreter by PornMaster · · Score: 1

      Couldn't you do this with the PHP cgi executable?

    2. Re:Single file interpreter by Anonymous Coward · · Score: 0

      Ruby has RubyScript2Exe which does what it says on the tin.

    3. Re:Single file interpreter by CableModemSniper · · Score: 1
      --
      Why not fork?
    4. Re:Single file interpreter by Anonymous Coward · · Score: 0

      Rebol is a pretty good scripted language which comes in a single and very small executable.Its cross platform and includes a scriptable gui too :)
      Only drawback is that its not free software.

    5. Re:Single file interpreter by Anonymous Coward · · Score: 0

      What about wxLua? I don't think it has much of a library included, but you've got a gui toolkit (wxwidgets) and a scripting language. There are one-file binaries for linux and windows (and off course: the source).

    6. Re:Single file interpreter by Berfert · · Score: 1

      Tcl has Starkits and Starpacks. A Starkit is a package of all the code for a particular program, but still requires the Tcl executable to run it. A Starpack is the Tcl executable + a Starkit in one executable file.

  11. Re:You dont use a sledge hammer to open your penut by FidelCatsro · · Score: 1

    I agree totaly, me just rushing my posts there , I really should of used better wording.This is exactly when i use C ,Interpreted languages will never compete on data crunching tasks(though the line is blurring)-

    --
    The only things certain in war are Propaganda and Death. You can never be sure which is which though
  12. Centum by Umbral+Blot · · Score: 1

    Those basterds ignored us again!! (no I didn't seriously expect to be noticed).

    1. Re:Centum by Anonymous Coward · · Score: 1, Insightful

      You notice that all popular scripting languages are cross platform? Maybe, just maybe, that's why nobody wants to look at yours.

    2. Re:Centum by Umbral+Blot · · Score: 1
      You notice that all popular scripting languages are cross platform? Maybe, just maybe, that's why nobody wants to look at yours.

      Yeah like VB that is waaay cross platform. Besides all projects start on one platform. If you care why dont you stop bitching and pitch in and help us port it.
    3. Re:Centum by Alan+Shutko · · Score: 1

      Well, we already have Common Lisp on multiple platforms. Unlike Centum, CL is intended to be fast. It doesn't make you throw all the real logic in DLLs to be fast.

      And fix the rendering of the homepage in Firefox while you're at it.

    4. Re:Centum by Reverend528 · · Score: 1

      I think it's pretty absurd to be comparing VB to something like perl or python. Even fans of dynamic languages readily admit that VB is pretty useless.

      Languages only succeed when they are closely tied to hacker-friendly platforms.

  13. Humor Impaired by Saeed+al-Sahaf · · Score: 0, Offtopic

    "Flamebait"? As I said here, Slashdoters (or maybe just those with "mod" points) are humor impaired.

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    1. Re:Humor Impaired by Anonymous Coward · · Score: 0

      Nice of the mods to help you make your point by modding you down into oblivion. You weren't kidding.

  14. MANLY scripting language? by Saeed+al-Sahaf · · Score: 2, Funny
    So for example BASH programming is "scripting" since most of what you do is items that would normally be done at the command line.

    Yes, but BASH is a manly scripting language, where as...

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
  15. Lost. But than I'm stupid. by Saeed+al-Sahaf · · Score: 1

    Instead of a single 1000 line C program, you have a basket of C programs and a basket of programs in different "scripting" languages... And this is better than a single C program?

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    1. Re:Lost. But than I'm stupid. by Knara · · Score: 2, Informative

      It's entirely possible that a small number of individual problems is easier to maintain than one large one that does the same thing. In this case, it might be easier to do the coordination between the C programs in $SCRIPTING_LANG than it would be in C, if for no other reason than it might be easier to write and maintain the coordination script in $SCRIPTING_LANG than C. If the C programs do sufficiently small and simple tasks, but the coordination is easier to code in $SCRIPTING_LANG there definitely could be benefits to doing it that way.

    2. Re:Lost. But than I'm stupid. by p3d0 · · Score: 1

      Yes. Consider having multiple programs like UNIX's "cat", "sort", "uniq", "sed", and "awk" tied together with shell scripts, instead of one generalized reporting program that tries to do everything for everyone.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    3. Re:Lost. But than I'm stupid. by harikiri · · Score: 2, Informative
      Perhaps in this instance it's overkill, but the practice of breaking up a program into separate components increases security and maintainability.

      Dan Bernstein is a proponent of this approach, as can be seen by looking at the approach taken in his programs such as Qmail.

      --
      Man watching 6 MSCE's around a sun box, looks alot like the opening scene's of 2001:space odyssey...
    4. Re:Lost. But than I'm stupid. by gnu-user · · Score: 1
      Instead of a single 1000 line C program, you have a basket of C programs and a basket of programs in different "scripting" languages... And this is better than a single C program?


      For what the original poster outlined, I'm certain that's the case.

      The core idea is "modular programming". There are a whole raft of advantages. And a large body thinking to support it.

      UN*X is built on this idea. Typical development cycle (see "the unix programming environment)...
      1) mock it up in shell
      2) redo it
      3) Use C to speed up the slow parts if needed.
      4) write a library if it's used enough.

  16. Code Insight by Anonymous Coward · · Score: 0, Offtopic

    One important advantage of statically typed language is the ability to do code insight... I mean the little pull down menu which pops up as soon as you hit the dot character after a variable name, displaying a list of available methods. This saves you about 80% of the time spent on browsing documentation. As a side effect, it prevents typing errors.

    Also, JBuilder for example supports incremental compiling (i.e. compiling while you type), which immediately detects practically all syntactic errors during input. This means you end up nearly always with a syntactically correct program before you even think of compiling... the problem with scripting languages is that syntax errors (e.g. illegal method calls) only crop up at runtime.

    1. Re:Code Insight by Anonymous Coward · · Score: 1, Interesting

      This is not hard a characteristic of dynamic vs. static typing. There are languages such as Common Lisp where one can _optionally_ declare types, and methods specialise on class, not type, anyway, so even without any type declarations, an OO program in CL allows such hinting.

    2. Re:Code Insight by Waffle+Iron · · Score: 1
      Of course any advantages that a staticly typed language provides in the way of helping editor gizmos are totally nullified by the huge increase in complexity of the APIs you have to deal with due to the static typing itself.

      Just compare the Java libraries to the (often richer) Python libraries. Most Python API docs fit one or a couple of brief pages. Java gives you a thick a jungle of frames and trees to navigate for every stupid little call you have to make.

  17. I hate dynamic languages by Anm · · Score: 4, Interesting
    I've said it before, and I'll say it again.. I hate dynamically typed languages. Just to clarify, this isn't about interpretted versus compiled languages. In fact I love high-level interrupted languages, with syntactic sugar to make my life easier and the ability to edit code during execution. But dynamically typed languages have a serious problem.

    Lets say you have to added a feature to the following function:

    updateCustomerAccount( customer, newInfo )

    Looks nice, with very descriptive function name and parameters. But it isn't. Is customer a string name, a an accountId, or a data structure? Does it return anything (success or failure code)? And a little more debatable, does it throw any errors.

    The usual cases are:
    • You wrote it. Great for when you've just been working on it, but not so great if you're coming back to it after a while or are juggling multiple similar projects.
    • Read the docs. Unfortunately, docs and code regularly get out of sync unless every single member of your team is very tedious to such details. This is especially true of internal APIs. Besides, if you now require such tedious attention to detail at every check in (as opposed to public release where your API docs better be correct), haven't you lost most of the supposed benefits of the script/high level language?
    • Ask the author. Brings programmer out of the code, and not very useful when its more than just down the hall. For distributed development like OSS, email is a slow solution.
    • Use the source. Again, brings the programmer out of their current objective, and this can often be tedious and error prone. That said, there is always a case where this is necessary/useful/insightful.

    But even if you can always rely on one of these solutions, you're missing out on the beauty of statically typed languages: IDEs. By formally typing objects in the language grammar, you have not just documented your code to your peers, but to the machine itself. And allowing the machine to reason about your code means it can help you write it. It keeps you in the code, with instant access to API, documentation, and refactoring. Now you have mentally stepped beyond the code into the problem space.

    Anyone who has written Java in a solid IDE like Eclipse can atest to this. I've had I've had people look over my shoulder in amazement as "the computer writes [my] code" for me. Every function appropriate to the context (and their documentation) usually within 6 keystrokes, without memorization.

    Even the best Python IDEs (strongly typed, but still dynamically typed) pale in comparison to this experience.

    When will the scripting world learn what they're missing?

    Anm

    (For the record, my prefered langauge is Java, but my current work has me doing C, C++, Python, and Perl as necessary. While I haven't worked in it, I assume C# is in the same boat as Java: statically typed, runtime reflexective, dynamically loadable, useful exceptions/stack traces, and large library including the source compiler itself.)
    1. Re:I hate dynamic languages by wwahammy · · Score: 1

      I agree with your attitude on dynamic typing. I have just started learning c# and while learning to type everything took me a while, I've found it to just be easier than PHP/Perl and the like because the IDE can suggest the methods, properties and events possible to a given object.

      I love PHP and Perl still and I think for smaller projects it can be easier but its hard to go back now that I've seen the advantages of C#.

    2. Re:I hate dynamic languages by Bastian · · Score: 3, Interesting

      I agree that this is a serious problem with many dynamically typed languages, but, if I may use the cliche, don't throw the baby out with the bathwater. There are two good solutions to that problem that I can see.

      The first is commenting. (If you can't keep your comments in sync with your code, you have a much bigger problem that you should work out before you even start to argue language paradigms.)

      As for the second, there is nothing in the definition of a dynamically typed language that says you can't include types for function parameters. Personally, I would love to see a dynamcially typed language whose syntax allows for it. In the end, it would just be so much syntactic sugar - a dynamically typed language would just convert the value you pass to the function if it doesn't match the type. However, it would force a higher minimum for readability in code, and it would provide a mechanism for having a -Wall style compiler option for giving warnings about type mismatches. (And before anybody complains, yes, there would be a generic type for functions and data structures that you really do want to be able to handle everything.)

      Really, I think the whole reason why this hasn't happened in any popular scripting languages is becuase the popular scripting languages are designed for very small projects, where you really don't get that much benefit from such a feature. Plus, in my experience, programs written in dynamically typed languages do tend to be better commented. It's a lot harder to escape when you're dealing with a class of languages that tends to be rather on the terse side of things.

    3. Re:I hate dynamic languages by chris_mahan · · Score: 5, Insightful

      >Lets say you have to added a feature to the following function:
      >
      > updateCustomerAccount( customer, newInfo )
      >
      >Looks nice, with very descriptive function name and parameters. But it isn't. Is customer a string name, a an accountId, or a data structure? Does it return anything (success or failure code)? And a little more debatable, does it throw any errors.

      Ah. is customer an object? is the new info an object?

      is it smart-merging "newInfo" to "customer"?

      I can come up with a bunch of things that might affect how one uses this function that would not be infomationalized by the addition of types:

      is it accessing an outside system, such as a database?

      is it asynch?

      Does it assume security of the user? In the Customer update log, what is the name of the person who entered the newInfo?

      Is the newInfo an xml document with inbedded base64 pdf? (i've seen in, in mortgage systems)

      Does it notify a third-party in case of failure, logging to the logger, and returning a "pending verification" semi-error code?

      Does it allow for customer to be empty, and if so, does it create a new customer?

      Does it allow either to be empty, thereby creating a new customer with blank, or default information?

      if the newInfo contains a dataset with as-yet unknown fields, is the system desinged to automatically add the fields as xml tags in the customer xml storage?

      Is the previous information in the customer file store elsewhere? as in a change log?

      All functions need a solid API. Since you're going to have an API, you might as well put the type handling in it.

      If a programmer can't be bothered to keep the API docs updated, he is not staying on my team.

      To some questions, the answer is Python.

      --

      "Piter, too, is dead."

    4. Re:I hate dynamic languages by Anm · · Score: 1
      ...don't throw the baby out with the bathwater.

      When a feature because so predominant that it not only qualifies as a key point in the defintion of the class, but becomes
      • the
      key feature that names the class, it takes a fundamental distinction. I've tried to make myself as clear as possible given the situation. I'd jump at Python if it was staticly typed and had an eclipse editor plugin. That said, my ideal language does not exist yet and I can't offer counter examples to clarify further (although I'm trying as I update my runtime interpreter/shell for Java 5).

      If you can't keep your comments in sync with your code, you have a much bigger problem...

      Agreed. But it happens. People, including coders, are lazy. I don't think I've ever seen a project moderate sized project that didn't have a little cruft in the docs.

      I would love to see a dynamcially typed language whose syntax allows for it. In the end, it would just be so much syntactic sugar...

      First, the problem isn't limited to function parameters. It's just the example I used. I think the issues are equally present in typing class/struct members and collection values.

      Secondly... you want to make programmers go through the effort of naming their types, but you're not going to enforce them? So despite the extra effort, the system may still allow different types, thus the typing only describes the intent? And you are still left with the possibility of strange runtime errors and possibly misspellings that type checking would catch.

      If you do enforce it, then you have effectively created a static language with intelligent casting/autoboxing. This is the direction C# and Java are already progressing.

      I think its possible to close the gap between these languages and the style of programming found in dynamically typed languages. Say I type this in Eclipse:
      <tt>var.newField = "whatever"</tt>
      but eclipse doesn't yet know about newField and passively underlines it in red (as it does now). When I go back to correct the "error", eclipse gives me a handful of one click instance corrections. What if these included the ability to add the field to var's type, or derive a new type from var's type that includes the new field. These type of in place corrections (i.e., don't make me go edit the other file manually) give me the speed a dynamic language coders without loosing the safety of my static typing.

      Anm
    5. Re:I hate dynamic languages by Anonymous Coward · · Score: 0

      Must learn to preview... especially when tagging my comments.

    6. Re:I hate dynamic languages by cratermoon · · Score: 4, Interesting
      • Use the source. Again, brings the programmer out of their current objective, and this can often be tedious and error prone. That said, there is always a case where this is necessary/useful/insightful.

      If reading source code takes you out of your current objective, you have a write-only view of programming, and that's a problem. Take a look at http://www.spinellis.gr/codereading/

    7. Re:I hate dynamic languages by Bastian · · Score: 2, Interesting

      First, the problem isn't limited to function parameters. It's just the example I used. I think the issues are equally present in typing class/struct members and collection values.

      I'll follow your new example. Why don't we allow for casting suggestions on struct or class members as well? We can take this as far as we want. I it's just documentation sugar and a debugging aid.

      Secondly... you want to make programmers go through the effort of naming their types, but you're not going to enforce them? So despite the extra effort, the system may still allow different types, thus the typing only describes the intent?

      I've already explained this. . . it wouldn't be strictly enforced, but you could have the compiler do checking for you and issue warnings. It's really not that much different from the warnings that you get with, say, C, where you can cram anything you want into anything else, and the compiler will figure out some way to munge the data so it compiles cleanly. As for calling it extra effort, let me suggest that a) it isn't any more effort than goes into figuring out what types data should be in a static language, and b) even if it's ignored, forcing programmers to put some modicum of explanation in with their code is a Good Thing. Call me insane, but I've always been of the opinion that minimizing bug count is generally more important than patronizing slothful programmers.

      And you are still left with the possibility of strange runtime errors. . .
      Please be more specific. Every language I have ever written code in, from FORTH to LISP to C to Java, has given me problems with strange runtime errors.
      . . .and possibly misspellings that type checking would catch.
      Not all dynamically typed languages let you get away with not delcaring your variables. I agree, variable declarations are a Good Thing.

      These type of in place corrections (i.e., don't make me go edit the other file manually) give me the speed a dynamic language coders without loosing the safety of my static typing.

      I fail to see why this is a feature that is only possible for an IDE that works with statically-typed languages. Data type never came up in that example, though you did refer to a class as a type. I'd only be willing to let you get away with that if your answer were using a language like Smalltalk where class and type are pretty much the same thing. =D

    8. Re:I hate dynamic languages by p3d0 · · Score: 4, Interesting
      If the information you're missing by omitting type annotations matters to you, then don't use a dynamic language. However, dynamic languages are good for prototypes, and for simple systems. They scale downward further than statically-typed languages. I use them for fun hobby programming, but (for the reasons you mentioned) I don't use them much for professional work.

      I'll give you a pathological example. Consider the Hello World program written in bash (a dynamic language) and Java (a static one). Java looks like this:

      public class Hello {
      public static void main(String[] args){ System.out.println("Hello, world"); }
      }
      Bash looks like this:
      echo Hello, world
      This isn't really a fair comparison per se, but hopefully it illustrates my point regarding the complexity of the problem versus the effort required to code the solution. On the one extreme, you have the "static" languages designed for coding entire "systems programming products" (to borrow a term from Fred Brooks). Of these, the good ones (eg. Eiffel, with its superb multiple inheritance facilities) scale up well to large systems, so the asymptotic slope of the complexity-effort curve is small. However, that curve doesn't cross the origin; that is, as the problem becomes trivially simple, the code required to express the solution reaches some fixed minimum size. In the case of Java, for instance, every program must declare a class with one public static void method taking an array of strings as an argument. That's why nobody uses Java as a command shell.

      On the other extreme, you have shell languages. They do indeed intersect the origin of the complexity-effort curve: that is, it is possible to write a two-character program that does something very simple, such as "cd" or "fg" in bash. If you allow aliases, or UNIX commands like "w", you can write meaningful one-character programs. (This is impossible in Java, no matter what definitions or libraries you presuppose.) However, the slope of the complexity-effort curve is high, and after a program gets larger than a few hundred lines of code, bash becomes almost unusably awkward.

      In between, you have "dynamic" languages like Python. Its curve doesn't hit the origin, and its asymptote's slope is higher than Java's, but there is a sizeable range of programs for which a Python solution requires less effort (at least for me) than bash or Java.

      So, as many others have said, it pays to have a number of tools in your toolchest.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    9. Re:I hate dynamic languages by lachlan76 · · Score: 1

      If reading source code takes you out of your current objective, you have a write-only view of programming, and that's a problem

      Or it could be that you're reading code which isn't in your program flow. Which means you need to hold more in memory.

    10. Re:I hate dynamic languages by Anonymous Coward · · Score: 0
      I'll give you a pathological example. Consider the Hello World program written in bash (a dynamic language) and Java (a static one). Java looks like this: [four complex lines]. Bash looks like this: [one simple line].

      This isn't really a fair comparison per se, but hopefully it illustrates my point regarding the complexity of the problem versus the effort required to code the solution.


      Nope, sorry. If I can find a statically-typed, compiled language that looks as simple as bash, then your example becomes completely meaningless.

      Ooh, what about this:
      print_endline "Hello, world"
      That's the complete hello world example in OCaml, and I really don't think it takes any more effort to code than the bash example.

      So in fact you've omitted a whole class of languages from your analysis: the modern statically-typed languages which are almost as flexible and quick to code in as Perl or Python, while also being just as robust and scalable as Java or C++.
    11. Re:I hate dynamic languages by Anonymous Coward · · Score: 0

      > . . .and possibly misspellings that type checking would catch.

      Not all dynamically typed languages let you get away with not delcaring your variables. I agree, variable declarations are a Good Thing.


      Declaring variables and catching misspellings are orthogonal. Compiled statically-typed languages like ML and Haskell do not require variables to be declared or given explicit types, but they do detect type mismatches and misspellings at compile-time. The result? Nearly all the convenience of dynamic typing, absolutely all the safety of static typing. It's a good combination.

    12. Re:I hate dynamic languages by Anonymous Coward · · Score: 0

      I can come up with a bunch of things that might affect how one uses this function that would not be infomationalized by the addition of types.

      So you're saying that because type-checking cannot solve every problem, it isn't worth having?

      Type checking can and does prevent a large class of bugs. To say that it is worthless because it does not prevent many other kinds of bugs is like saying we should stop manufacturing antibiotics because they can't heal broken bones.

      To some questions, the answer is Python.

      Yes. And I note that Guido is planning to add type annotations to Python. I don't think he'd even be considering that if they weren't pretty useful, right?

    13. Re:I hate dynamic languages by aled · · Score: 1

      In the case of Java, for instance, every program must declare a class with one public static void method taking an array of strings as an argument. That's why nobody uses Java as a command shell.

      What's the problem with that?.

      If you allow aliases, or UNIX commands like "w", you can write meaningful one-character programs. (This is impossible in Java, no matter what definitions or libraries you presuppose.)

      Wrong. Aliases has nothing to do with a language. You can alias w=java -jar myapp.jar or whatever command line you want, or write a shell script to do the same, which is the usual way to start a Java program.

      --

      "I think this line is mostly filler"
    14. Re:I hate dynamic languages by Anonymous Coward · · Score: 1, Interesting

      Common Lisp is dynamically typed, but with optionally enforceable type annotations and static-style type inferencing in good compilers.

    15. Re:I hate dynamic languages by chris_mahan · · Score: 1

      Some people are pushing typing as a way to self-document the program. My whole point is that you need the doc and the api to stay current, and that once that is in place, having or not having type is not a big deal.

      I'll agree with you though that it makes things easier sometimes.

      --

      "Piter, too, is dead."

    16. Re:I hate dynamic languages by Anm · · Score: 1

      Standard documentation only fills half the void. It still doesn't document your system in a machine readable way, thus limiting how the tools can help you be more productive.

      So I would say having the typing is a big deal.

      Anm

    17. Re:I hate dynamic languages by daveaitel · · Score: 1

      Honestly, go get a better IDE. WingIDE makes Python programming a lot better. Those of us using Python are very happy for everyone else to be using C#. It makes us seem like demigods of productivity.

      Dynamic typing is awesome. Introspection is awesome. Being able to read your friends' programs without having to run them through "indent" is awesome.

      -dave

    18. Re:I hate dynamic languages by Pedersen · · Score: 2, Interesting

      In the case of Java, for instance, every program must declare a class with one public static void method taking an array of strings as an argument. That's why nobody uses Java as a command shell.


      What's the problem with that?.


      The problem with that is for extremely simple programs. And by extremely simple, I'm talking about stuff that barely even qualifies as a program, but would be tiresome to type over and over again. Consider, for example, the case of the classic "Hello, World" program, that the GP gave.


      In sh, it's one line, literally. There's no command line parameters, nothing. Just print something out. In Java, you must have three lines in a file, and then you must compile that three line program. All for something meant to display something on the screen that the user is not meant to change.


      So, what's the problem with all of that? Sometimes, you really do want to have just a short script, simple, doing the same few commands regularly. Java (or other compiled languages) add a layer of overhead which is completely not necessary for such items.


      If you allow aliases, or UNIX commands like "w", you can write meaningful one-character programs. (This is impossible in Java, no matter what definitions or libraries you presuppose.)


      Wrong. Aliases has nothing to do with a language. You can alias w=java -jar myapp.jar or whatever command line you want, or write a shell script to do the same, which is the usual way to start a Java program.


      Actually, you've missed the point he was trying to make: It is possible to write shell scripts which do something genuinely useful with only a very few characters. This is, unfortunately, not possible with a full compiled language, such as java, or c, or c++, etc.

      --

      GPL made simple: What was my stuff is now our stuff. If you improve our stuff, please keep it our stuff.
    19. Re:I hate dynamic languages by platos_beard · · Score: 2, Interesting

      Not too long ago I would have been in complete agreement with you, but recently I've been dabbling extensively (I know that's probably an oxymoron) in Python and I'm not so sure any more. Take the code:

      bar = map( lambda x: x[1], foo )

      Maybe it's possible to do that with static typing, but if so it would add so much grief in making sure all the type related stuff fits together as to be barely worth doing. And it is worth doing.

      So I'm moving toward the conclusion that dynamic typing in and of itself is a plus. Not just for prototypes, but for real power and conciseness.

      --
      What's a sig?
    20. Re:I hate dynamic languages by p3d0 · · Score: 1
      So in fact you've omitted a whole class of languages from your analysis: the modern statically-typed languages which are almost as flexible and quick to code in as Perl or Python, while also being just as robust and scalable as Java or C++.
      Agreed. There's nothing fundamental about my analysis. I see no reason a language couldn't beat bash, Python, Java, Eiffel, and C++ across the board. I'm sorry I didn't make that clear in my original post.
      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    21. Re:I hate dynamic languages by p3d0 · · Score: 1
      That's why nobody uses Java as a command shell.
      What's the problem with that?
      No problem. I was just trying to explain why people might want to use a scripting language for some tasks.
      Wrong. Aliases has nothing to do with a language. You can alias w=java -jar myapp.jar or whatever command line you want, or write a shell script to do the same, which is the usual way to start a Java program.
      My point was that you can't possibly write a meaningful one-character Java program. Your example doesn't change that fact.

      A file containing the single character "w" can't possibly be a valid Java program, but it can be a valid bash program.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    22. Re:I hate dynamic languages by Anm · · Score: 1
      Your example has little to do with typing, and a lot to do with closures (function references), and the lambdas that implements them inline. While there is no technical basis, for some reason staticly typed languages rarely get get these great features.

      I'll be the first to admit that even the best statically typed languages have much to learn from the best dynamic languages like Python. Java is barely beginning to learn the value of integrating the most commonly used data structures into the language, hence the arrival of a new for statement that implicitly understands all collection classes and arrays. It's not quite the level of Python's lists and tuples. Some might argue Java's collections library give control that can lead to performance, but I would say don't dismiss shortcuts for the most common use cases.

      Back to the example. Let me use a slight variant so my explainantions of the typing is a little clearer.
      bar = map( lambda x: x.y, foo )
      In your example, assuming all the variables are typed (in my code the types are capitalized type):
      lambda x: x.y
      is typed as the following function/closure:
      X->Y
      And assuming map(..) was defined with generics as:
      <T1,T2> T2[] map( T1->T2, T1[] )
      your compiler (and your IDE!) can know to match T1 to X and T2 to Y.

      Anm
    23. Re:I hate dynamic languages by AnxiousMoFo · · Score: 1
      I try to put all that in the comments, like this Perl example:
      # updateCustomerAccount( CUSTOMER, NEWINFO )
      # CUSTOMER: a Foo::Customer object representing
      # the customer whose account is updated.
      # NEWINFO: a Foo::CustomerInfo object
      # containing the data to merge
      #
      # Updates a customer account for CUSTOMER using
      # the info NEWINFO. Returns the
      # Foo::CustomerAccount object, or undef if
      # a failure occurs.

      sub updateCustomerAccount {
      my $customer = shift;
      my $newInfo = shift;

      (snip...)
      }
      Ideally, I'd like the ability to have a function prototype containing the variable names and expected types, but putting it in the comments is good enough (assuming I, or the person who wrote the code, actually puts this in the comments).
    24. Re:I hate dynamic languages by Anm · · Score: 1

      You miss the point. What is good enough for you other people, isn't good enough your tools.

    25. Re:I hate dynamic languages by bonniot · · Score: 1
      You can do something about as concise in Nice, a statically-typed Java-like language:
      let bar = foo.map(int[] x => x[1]);
    26. Re:I hate dynamic languages by Berfert · · Score: 1

      You forgot one option... look at the automated test suite. Automated tests are living documentation. If they pass, they're accurate.

    27. Re:I hate dynamic languages by Anm · · Score: 1

      Excellent point.

    28. Re:I hate dynamic languages by Anm · · Score: 1
      Actually.. I screwed up slightly. The lambda argument does need to be typed. So maybe:
      bars = map( lambda x: x.y, foos )
      needs to become:
      bars = map( lambda Foo x: x.y, foos )
      still pretty minor change to support typing.
    29. Re:I hate dynamic languages by icepick72 · · Score: 1
      The first is commenting. (If you can't keep your comments in sync with your code, you have a much bigger problem that you should work out before you even start to argue language paradigms.)

      I totally agree. My comment blocks in JavaScript are huge compared to my comment blocks in statically-typed languages.

    30. Re:I hate dynamic languages by platypus · · Score: 1

      While your example might not be right, I completely agree with you and can only encourage you to proceed looking into python.
      I've read and worked on relativly big projects in python like zope, and I have come to the conclusion that the arguments for static typing, while valid, might focus on a too small subset of the task of getting a solid program done.
      What I mean is, yes, static typing gives you some guiding, but on the other hand, it seems to have the effect that the developers might "not see the wood for the trees". In fact, I've very seldom seen things go wrong for lack of type checking in python, but I've seen java programmers fiddling around trying to pass the right types to methods, and then find out that the application still didn't do what it should because something else went wrong.
      In a language like python, OTOH, it seems that because you are not forced to spend your time thinking about these syntactical issues, you are concentrating more on thinking about the code from a functional POV, which seems to lead to getting the typing right anyway.

    31. Re:I hate dynamic languages by sjames · · Score: 1

      If you try to write C or Java programs in Python (or other dynamic language) you will have those problems. If you use the language 'The Right Way', it will be much less of a problem.

      For example, why not have updateCustomerAccount throw an exception if you give it something it can't promote to the right type? Admittedly, type checking isn't useless by any means, it's just not fundamentally necessary for writing and testing. Perhaps it could be added to a dynamic language in the form of a type tag that is ignored at runtime, but can be checked by a lint like utility.

      I have yet to meet an IDE that allows me to be as productive as vi with etags (perhaps combined with screen).

  18. Something Thomas said I don't understand... by Money+for+Nothin' · · Score: 1
    From TFA:

    DevSource: Where do you see scripting languages going? Where will scripting be in five years? Do you see it being replaced by compiled languages?

    Thomas: I see a definite trend among the leaders in the industry away from compiled languages and towards dynamic ones. A lot of Java developers, for example, are experimenting with a Ruby web framework called Rails.

    The distinction isn't really compiled languages vs. interpreted languages. All languages are at some point interpreted (given the complexity of today's processor architectures). The issue is really one of language style.

    (emphasis mine)

    His point about all languages being interpreted at some point doesn't make sense to me, even with the parenthetical note about processor architecture. What about CPU architecture these days makes a language interpreted? Would this include ASM then (which is really just a human-readable version of machine code)?

    I thought compiled languages compile once to, you know, machine code prior to execution, whereas interpreted languages compile code on-the-fly for every program execution? Yet Thomas is suggesting that if I write "hello world" in C, the machine code compiled from that will in reality be interpreted by the CPU?

    My CS profs didn't cover this! :-) I'm confused...
    1. Re:Something Thomas said I don't understand... by Anonymous Coward · · Score: 1, Informative

      Your CS professor only discussed simple RISC processor where the control signals are hard-wired to be generated directly from the machine instructions. However many modern processors use microcode to translate the machine instructions to actual control signals. This level of translation is what Thomas is talking about.

    2. Re:Something Thomas said I don't understand... by adri · · Score: 3, Informative

      I think he's referring to the idea of 'microcode'. If you look at older 8 bit CPUs (eg z80, 6809, 6510, etc) - there's a decent link between the bits in the instruction and what the instructions do. Microcode based CPUs, even the 8086/8088, are a little different: each instruction triggers a series of instructions which in turn make the CPU logic do something (latch register X onto databus, add to accumulator, etc..). So, when you execute an instruction on a microcode CPU you're triggering off a series of actions for the CPU to perform. You could replace the instruction set the CPU runs by changing the microcode.

    3. Re:Something Thomas said I don't understand... by Anonymous Coward · · Score: 0

      I would suggest that Mr. Thomas is merely confused, didn't really have an answer to the question that was posed, and at an attempt at obfuscation decided to assert something that is obviously false and back it up with evidence that is obviously irrelevant.

      In short, you can relax. There is still a distinction between compiler and interpreted languages, just as your Professors have proslytized.

    4. Re:Something Thomas said I don't understand... by Hast · · Score: 2, Informative

      To clarify this post a bit.

      You feed a modern processor (assuming x86 compatible) x86 assembly, but internally it executes it's own format of operations. During the fetch/decode stage the x86 operations are "translated" into the internal micro-ops format.

      As such one x86 op may correspond to many internal micro-ops. This is done for several reasons, one of the more fundamental being that x86 asm is now a horrible mess that is not suitable to feed into an extremely optimised processor core.

    5. Re:Something Thomas said I don't understand... by Anonymous Coward · · Score: 0

      I'm not a compiler-writer, or CPU guru, but....

      If you take a language like Perl (a scripting language), or Java (a "compiled") language, they get parsed and turned into bytecode.

      Bytecode then is run by the VM (JVM, perl, Parrot etc), which then executes more simple procedures, which will have been written in C, or assembler, and compiled down to processor opcodes, which are just steams of bytes (which can look remarkably like bytecode).

      A VM can make runtime optimisations of the bytecode, but CPUs dont tend to do that.

      Java Bytecode

      v = 1 + 1

      iconst_1
      iconst_1
      iadd
      istore_1

      68K
      moveq #1, d0
      moveq #1, d1
      add.w d0,d1
      move.w d1, _v

      In any case, the CPU takes the opcodes for the "move", "add" commands, then runs the microcode inside the CPU to actually do those operations, so really the cpu opcodes are just bytecode, but for a particular CPU, not for a particular language.

      who writes microcode? some clever guys working for intel, motorola.. you'll never see it...

    6. Re:Something Thomas said I don't understand... by Brandybuck · · Score: 1

      This level of translation is what Thomas is talking about.

      But this such a low level, and has been going on for so long, that's it's completely pointless to the topic of programming languages.

      --
      Don't blame me, I didn't vote for either of them!
    7. Re:Something Thomas said I don't understand... by nagora · · Score: 1
      one of the more fundamental being that x86 asm is now a horrible mess that is not suitable to feed into an extremely optimised processor core.

      On a similar note, x86 programming model was always a horrible mess that is not suitable to feed into a programmer or, for that matter, a compiler. It really is junk, but it was junk on the day IBM decided to use it. Motorola had much better chips on the market at the time.

      This is why x86 runs so hot and slow: the instruction set, and especially the register set, is so restrictive that a lot of work has to be done for things which are and were trivial on other architectures.

      TWW

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
  19. AllInOneRuby by Anonymous Coward · · Score: 2, Informative

    Ruby has RubyScript2Exe to collect a script and all dependencies includint the Ruby interpreter into a single Windows .exe file.

    AllInOneRuby uses the same technique to package the Ruby interpreter and core and standard libraries into a single .exe.

    I'm not sure if Perl and Python have something similar.

    1. Re:AllInOneRuby by Anonymous Coward · · Score: 0

      Activestate has perlapp, but that's windows only and commercial. It does, however, have the ability to create activex controls as well as executables. This is a nice way to get some perl functionality into your VB/C++/etc. app.

  20. Re:You dont use a sledge hammer to open your penut by harikiri · · Score: 1

    I agree with the right tool for the job sentiment. I'm familiar with Bash, Python, Tcl and Ruby. I initially looked at doing something with Ruby, but the RSS module tutorial was somewhat confusing. I ended up with the beautifully simple feedparser module for Python, and got the job done very quickly.

    If I'd been somewhat biased, I could've spent a lot of time banging my head trying to figure out how to use the Ruby version, but instead, in this instance, went to something that I found simpler and quicker to get into.

    --
    Man watching 6 MSCE's around a sun box, looks alot like the opening scene's of 2001:space odyssey...
  21. Re:You dont use a sledge hammer to open your penut by Anonymous Coward · · Score: 0

    I really should of used better wording.

    "should have used".

  22. Re:You dont use a sledge hammer to open your penut by FidelCatsro · · Score: 1

    yes that was the joke

    --
    The only things certain in war are Propaganda and Death. You can never be sure which is which though
  23. Re:You dont use a sledge hammer to open your penut by gnu-user · · Score: 1

    This is more of a nit pick, but I can think of a few interpreted languages geared at serious crunching.

    APL -- serious number crunching is the only reason people use it.

    PIK (Ok, it's a whole environtment, not just an interpreter) -- Lots of record crunching gets done by PIK systems.

  24. The ideal language (processing methodology) by garyebickford · · Score: 5, Insightful

    IMHO, all languages should be 'scripted' as well as 'compiled'. The same language syntax can be both. Why not use our advanced computational tools to do the grunt work of optimizing functionality? We've automated every other engineering discipline, but can't seem to do that for our own. (I know I'm overstating the argument, handwaving and idealizing - it's a dirty job, but somebody's gotta do it.)

    What I'd like to see: As I enter code in the language, the system does syntax checking and builds the necessary data structures, prompting and possible asking questions about ambiguities and any necessary library functions either not found or not called correctly. In fact, this process might as well be graphical in nature - NeXTstep's Interface Builder perhaps came closest to this in my experience. The code should be runnable immediately, in an interpreted environment - a la Perl/Python/PHP etc.

    Thus language processing system would act as an intelligent assistant, looking over the system as I design and build it and making suggestions. It might even make performance predictions based on its analysis of the code-so-far.

    Once the functionality is complete, I can pass the system to an even smarter optimizing compiler function, which does the necessary things to make it efficient, small, fast, etc. In the process the compiler may ask more questions about how to resolve various issues that didn't come up earlier. Since the functionality is already defined, the compilation has a mostly-known target for functionality. This process can take as long as necessary, perhaps while I go home for dinner; using more heuristics, AI, whatever, to further improve and clean up the system for the defined functionality.

    Except for the AI features, this combined capability is actually old. Back in the Long Ago, Harris computers ran the Vulcan OS, which had a n interactive FORTRAN system. It did line-by-line compiling, doing syntax checking on each line and even running the code. Once your program was complete and ran, the interactive compiler could output correctly-formatted FORTRAN that could be compiled using the standard FORTRAN compiler.

    --
    It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
    1. Re:The ideal language (processing methodology) by Anonymous Coward · · Score: 0

      IMHO, all languages should be 'scripted' as well as 'compiled'.

      Lisp, ocaml...

    2. Re:The ideal language (processing methodology) by GnuVince · · Score: 1
      What I'd like to see: As I enter code in the language, the system does syntax checking and builds the necessary data structures, prompting and possible asking questions about ambiguities and any necessary library functions either not found or not called correctly. In fact, this process might as well be graphical in nature - NeXTstep's Interface Builder perhaps came closest to this in my experience. The code should be runnable immediately, in an interpreted environment - a la Perl/Python/PHP etc.
      This is exactly what a Smalltalk system does. Methods are compiled when they are saved, you are made aware of any synactical errors, as well as undeclared variables, unknown messages. And when that method is saved, it is immediatly usable by any part of the system. So you can have an application that calls the #foobar method, but it's not implemented. You leave the application running, you implement #foobar, you save it, you go back to the application, you click the button (or do whatever action to call #foobar) and it will work. Bam! Just like that.

      And people (especially some people in the .NET and Java worlds) think that Smalltalk is old and outdated and has been superceeded by their technology. Think again!

  25. Re:You dont use a sledge hammer to open your penut by abigor · · Score: 1

    As an off-topic aside, I'd like to learn APL just for the hell of it...any pointers to good sites with tutorials, or good books?

  26. Re:You dont use a sledge hammer to open your penut by smithmc · · Score: 1

    C structs will probably always be lighter weight than objects

    In C++, if a class has no virtual functions, there's no reason it can't have exactly the same memory footprint as a C POD struct. Member function calls should similarly incur no additional overhead vs. a C function call. That's the underlying philosophy behind C++ with regard to C - you only incur penalties for things (like virtual function indirection, exceptions, etc.) if you actually use them in your code.

    --
    Downmodding is the refuge of the weak. Don't downmod, make a better argument!
  27. LUA!!! by Anonymous Coward · · Score: 0

    www.lua.org

    It is designed to be linked into other programs. It has specific features for dealing with C/C++. It's also fun to use. The definitive book about Lua is avaiable on line. What's not to like?

  28. Re:You dont use a sledge hammer to open your penut by Beek · · Score: 1

    I would suggest learning J instead. It's essentially APL, but replaces all of APL's special characters with ASCII characters.

  29. Re: Perl - Is it a scripting language or not? by some+guy+I+know · · Score: 1
    How would Perl be in between while Python is not?
    I wrote that without really thinking too much.
    Modern Perl is probably not a scripting language, but I'm not familiar enough with it to say so for sure.
    However, the last time that I gave Perl more than a cursory look (in the last millenium), it was using UNIX commands (executables) to implement many of its operators.
    For example, I think that it used expr to do RE matching, mv to rename files, etc.
    Perl hid the use of (many of) these commands from the user.
    That's how I came up with the "in between" comment: It used many system commands, but it wasn't (very) obvious to the casual user.
    Modern Perl (version 4? version 5?) probably doesn't use executables any more than any other language (although I don't know that for sure), so I guess that I wouldn't consider it to be a scripting language at all.

    How's that for decisive commentary?
    --
    Those who sacrifice security to condemn liberty deserve to repeat history or something. - Benjamin Santayana
  30. The Ideal Thought. by Anonymous Coward · · Score: 0

    Smalltalk, Forth, Haskell...

  31. What's dynamic got to do with it? by Fahrenheit+450 · · Score: 1
    Take the code:

    bar = map( lambda x: x[1], foo )

    Maybe it's possible to do that with static typing, but if so it would add so much grief in making sure all the type related stuff fits together as to be barely worth doing. And it is worth doing.


    I'm not sure why you think static typing implies grief for this kind of code. Now I'm not sure, as I've only typed about 10 lines of Python in my life, but it looks like you're mapping a list of arrays to a list of the second elements of those arrays. Here's the equivalent code in OCaml:
    let bar = List.map (fun x -> x.(1)) foo
    Being a bit more general, we can write:
    let snds lst = List.map (fun x -> x.(1)) lst
    To which OCaml assigns the type:
    val snds : 'a array list -> 'a list = <fun>
    That is, firsts takes a list of arrays of some unknown type 'a, and maps it into a list of elements of type 'a. No grief, plenty of static typing... Issues like this have nothing to do with static v. dynamic typing.
    --
    -30-
  32. Re:You dont use a sledge hammer to open your penut by abigor · · Score: 1

    Wonderful, thanks very much.

  33. i take exception with this by portscan · · Score: 2, Interesting
    When do you use a hand saw, compared to using a power saw? Different carpenters will have different answers. But having both at your command makes you a better craftsperson.
    perhaps it makes you a more capable craftsperson, but just having the tools does not really help. better? maybe, but not necessarily good. it's knowing when to use one over the other that really makes you good.

    that being said, i love perl for quick stuff, i/o and text processing, and lots of other things. php is great for web and i am definitely interested in looking into python...
  34. Greenspun's 11th Law by Latent+Heat · · Score: 1
    If Greenspun's 10th Law is that every large program contains within it a custom implementation of Common Lisp, done badly, I propose that Greenpun's 11th Law should be that every dynamic language that strives to have general application will converge to the feature set of Common Lisp.

    Lisp started out like a dynamic language -- interpreted, no data typing, everything is a list -- but it evolved to having a compiler, having arrays as well as lists, and way to specify data type or for the compiler to make a data type inference from the context. When it acquired those features, people could make the statement that "Lisp is as fast as C", an arguable point now but not even arguable back in the early days.

    The parent post speaks to reading and understanding code with and without static data types, and I suppose data type along with (the horror, the horror) Hungarian notation have their pros and cons with regard to reading and maintaining code. But there is also a use for static data types in getting efficiency.

    A dynamic data type means that data needs tags on it to determine the type and the meaning of operations performed on the data, and testing the tags means slower execution. Doesn't matter too much on how these tests are implemented -- test and branch, function pointers in a virtual method table -- you still have some form of tags and some form of tests. People will say "what about Moore's Law" and I will say "yes, what about it?" Moore's Law talks about growth in gates apart from speed, but the gates made available by Moore's Law have been used effectively to speed up programs based on static data types. Not only do static-data programs keep getting executed faster, the speedup of static-typed over dynamic-typed programs also keeps increasing. Yes, dynamic-typed programs execute faster on new hardware, but not anywhere near the speedup afforded to static-typed programs, and the gap keeps getting wider. It does not matter that a Python program is 100 times slower than a C program -- we are told to wait X years until hardware gets 100 times faster -- 100 times faster for a C program, but maybe only 10 times faster for a Python program, and we still have a factor of 10 shortfall.

    Why is this? The current generation of processors utilize various forms of pipeline parallism, which benefits from tests and branches being sparse rather than at every instruction. With static typing, not only do we lose the overhead of the tests, the absence of the tests means that we can keep our pipelines full.

    A static data type, whether spelled out with a type declaration or "discovered" by the compiler is a big efficiency win. An array type (basically a static list) is also a big help for efficiency, especially with the lists making up waveform samples for audio or bitmap images for raster displays.

    All data does not have to be static-types, but if you have the provision for static scalar and array types along with sections of code that operates on those types with arithmetic ops, assignments, and indexed loops, you can translate those operations into fast-running code. You can even have array bounds checking of the looping statements are such that the bounds checks can be done on the first and last index values without having to do tests on every index in between. Things like Numeric or NumArray in Python don't count because not only are the implemented as C extension modules, you have to write your algorithms that do looping on those structures as C extension modules as well or give up on efficiency.

    I can write a C extension module, you say. Back in the day of Fortran or even Turbo Pascal, one could write inline assembly language for speed-critical parts, but when optimizing compilers came along we gladly said goodbye to such tweaking and patching.

    Once a dynamic language gets a way of specifying static-typed scalars and arrays, there is nothing standing in the way of optimization to achieve performance in the ballpark of C for things like audio, images, and looped numerical algorithms, all without C-language extensions, and at that point one will have duplicated what distinguished Common Lisp and other Lisp dialects of that generation from first-generation Lisp.

  35. Squeak and OpenCroquet... by garyebickford · · Score: 1

    Sometime I'll take another look at Squeak, which seems to be the anointed successor to Smalltalk. I have a friend who's been a total fanatic about Smalltalk for many years - it has affected his career in interesting ways. A few months ago he got me interested in its descendant Squeak, because of Alan Croquet 3D system written in Squeak. So far, I've just bounced off when I've tried to do anything with it. I've been doing procedural programming for a long time. I think it was Dykstra who said (approximately), "Anyone who is proficient in FORTRAN can quickly learn to write FORTRAN in any language." I may try again soonish, although it's not

    This note speaks to my interest - IMHO the next, and most interesting, phase of UI design will be in the use of 3D to create not just usable but "amenable" user interfaces.

    For me, that will have to wait until I can get a better machine, preferably one I can use with polarized 3D glasses!! :O) I managed to get Croquet running on my system, but it was so slow (I'm running at 650 MHz) that it was unusable, and I diskliked the little buttons around the edge. Tthey seemed counterintuitive to me, but of course I grew up in a different UI paradign so who am I to say.

    One problem I didn't have time to figure out at the time was that Croquet's OpenGL driver setup was hardwired into the code, and didn't accept my OpenGL setup (I'm running DRI). But that's another story.

    --
    It's easier to be a result of the past, but more fun to be a cause of the future! http://www.spacefinancegroup.com/
  36. One language to bind them . . . by Latent+Heat · · Score: 1
    I don't see the issue as being modular programming vs Big Ball of Mud. And there is no reason any particular shell script cannot be entirely written in C -- it is all the same Unix utilities and libraries that are function calls in C.

    Why don't we write the whole thing in C? Well, the shell allows us to write quickly and hack around while the C approach has an edit-compile-link-test loop. Why don't we write the whole thing in shell or Perl or whatever? Because we need to optimize the slow parts.

    So a given application has high-level parts that benefit from the flexibility of dynamic data types, access to a library of functions, running a line at a time to see what happens. It also has low-level parts to express looping algorithms in an efficient manner.

    The big question is not whether you separate your application into high and low level parts; it is whether the high and level level parts are all written in the same language or in two languages.

    The one-language approach has the advantage of having to be skilled in only one language and of easier piecing together of the high and low level parts. The one-language approach as the disadvantage that unless your OS is set up for that one language, there will always be something, some OS call or feature that will require interfacing to a C-style function.

    The two-language approach has the advantage of a high-level language tailored for the high level, a low-level language tailored for the low level. The two-language approach can have the problem of impedance mismatch between the two languages, requiring a lot of adaptor plumbing, especially at the low-level language end.

    The adapter plumbing in Unix consists of function calls to C-style plumbing along with pipes, accomplished with some more function calls. The adapter plumbing in Windows is COM, which is straightforward enough until you get into the full complexity of the barely-documented raft of interfaces required to implement an ActiveX control along with the ham-handed Microsoft approach to C++, where they throw classes, macros, templates, and machine-generated code at the problem, all at once. Python with its dictionary-dispatch of object methods is somewhere in the middle.

    I think that the people doing a given dynamic language need to make a choice. If they are committed to the two-language approach, they need to work on having a streamlined approach to low-level extensions. There is a tendency to wall off the low level extensions into libraries and tell people "here are the (numeric, graphics, audio) libraries) -- they do everything you need and you don't need to write your own extensions, but if you need to write your own extensions, here are the C header files, and good luck." Well, the library-coded extensions cover a lot of cases, but sooner or later you are going to need to write extensions, and writing C extensions is often harder than writing straight C programs on account of the impedance mismatch of object models and data types between the high and low levels.

    If you are going to the "One language to rule them all" approach, that language is going to have to be efficient on the low level in the manner of Common Lisp or related high-level one-language approaches.