Slashdot Mirror


Thoughts On The Pike Programming Language?

bilboyablan asks: "Ive stumbled upon the Roxen Web server , mostly implemented in the Pike programming language. I got curious about Roxen, but even more about Pike, and it seems to me like a quite solid scripting OO language, with a C-like syntax, and with a quite good documentation (user manual) to boot. So it seems intriguing to me why Pike hasnt gotten a wider acceptance. So, if some of you fellow Slashdotters have had any experience with Pike (outside of Roxen), could you maybe drop a few lines on it? "

18 of 235 comments (clear)

  1. Pike with Gtk bindings by moibus · · Score: 4

    Pike has Gtk bindings too and my (limited) experience with them has been good. Seems like a pretty cool language. There's a good Pike resource site at http://www.pike-community.org/.

    --
    -moibus http://moibus.jfm.net/
  2. Haiku by 575 · · Score: 3

    Hark, one more language
    A powerful new system
    Named after a fish

    1. Re:Haiku by webrunner · · Score: 3

      this is a bad haiku
      about pike because it doesnt follow the haiku syntax
      at all.

      ----
      Oh my god, Bear is driving! How can this be?

      --
      ADVENTURERS! - ANTIHERO FOR HIRE - CARDMASTER CONFLICT
  3. Pike by roman_mir · · Score: 4

    When C was introduced it quickly won the hearts of computer programmers as a high level language that still feels like a low level one (close to Assembler memory management.) It was not like Fortran, Ada or Basic, it allowed something that was never there before C. We have C++ that can do all that C does, we have Python and Perl that can do somethings in more convenient ways, there is Java and VB etc.
    How easy is it to introduce a new language that will catch up with the masses? Java and Python are good examples of such languages. Java allowed many programmers do what C++ does in the sence of OO but easier to learn, Python has the power of Perl plus it allows use of other language libraries. These are clearly improvements (no I am not saying Java is better than C++, I am saying there was (is) a market for this language for those who want some (not all) power of C++ and they want it fast and easy to learn).

    Maybe in order for a language to become widely accepted it must present something new from marketing point of view not only from functional point of view.
    Still it is not impossible that pike will find its own audience. How many of you use ML, Prolog, Lisp or Scheme in your everyday life? But these languages have their own purpose, their own market niche, mainly AI R&D.
    If Pike has something new to offer, it'll be used.

  4. Are you blind? by ZxCv · · Score: 3

    There is a Win32 binary download right there on the Pike download page. Granted, the install process wasn't your typical windows GUI install, but was nonetheless painless and simple. Good thing you checked it out before you said something.

    --

    Perl - $Just @when->$you ${thought} s/yn/tax/ &couldn\'t %get $worse;
  5. A good example of Pike in action by IronGorilla · · Score: 4

    The world's largest amateur fantasy and sci fi art/writing site is powered by it. Every page is automatically generated by pike whenever one of the thousands of artists on board update their page. The URL is http://elfwood.lysator.liu.se and yes, I'm a member (though my gallery shall remain anonymous as my intention here is not to plug myself though I will say I joined when there was less than 100 people involved) and a voulentier staff member on the webpage.

    I'm not sure, but I THINK that Roxen and Pike were created at the Lysator computer club at Linkopeg university in Sweeden, who as you can see in the above link, are hosting Elfwood. The URL for the Lysator computer club is http://www.lysator.liu.se Of course, there's a high probability of me being wrong about that being where Roxen and pike came from.. but I seem to remember that's what someone told me.

  6. Re:Yeah, but what does it have to offer? by moibus · · Score: 3
    How will you know until you investigate? It used to be that only M$ was "bankable" in terms of OSes. I'd hate to think what would have happened if noone just went and played with new stuff. Seems to me that an OO C-like scripting language with Gtk and lots of other bindings and modules is pretty interesting at least on the surface.

    Python offers alot of OO features but has a limitation I can't deal with: it considers indentation as syntax. Pike might make a better language for OO scripting than Python given its syntax.

    The point is that it's worth looking at and that innovation and new ideas, even if they turn out to be lame, shouldn't be swept under the carpet because "we've already got one of those." I would much rather see a discussion of the actual features of the language than questions like "what's the point?"

    (BTW I have no interest in Pike other than it looks pretty interesting and appears to already have alot of useful features)

    --
    -moibus http://moibus.jfm.net/
  7. Re:Scriptlanguages are bad by roman_mir · · Score: 5

    well that is a strange statement. Most script languages are hard to use for those who do not know how to use them.
    Here is another one: Unix IS user-friendly, it just chooses its friends very carefully.

    Why are scripting languages hard to use? I use sh, csh, ksh, awk, sed, Perl, Python, jsp, asp and even Dos batch files in primitive basic. What is so hard about 'em?

    Translated languages under Unix/Linux have the same precedence level as compiled binaries (under DOS bat files are secondary). Translated languages don't even have to be compiled! It is true that I have not seing a good IDE for awk or csh but it does not mean the language is bad.

  8. Re:That's not a haiku. by 575 · · Score: 4

    There once was an impatient poster
    He cried out "That haiku's not kosher!"
    The rest of us pounced
    His poor ego was trounced
    Maybe next time he'll look a bit closer

  9. Lisp is *not* only for AI. by weisserw · · Score: 3

    From "On Lisp" by Paul Graham:

    "Not so long ago, if you asked what Lisp was for, many people would have answered 'for artificial intelligence.' In fact, the association between Lisp and AI is just an accident of history. Lisp was invented by John McCarthy, who also invented the term 'artificial intelligence.' His students and colleagues wrote their programs in Lisp, and so it began to be spoken of as an AI language. This line was taken up and repeated so often during the brief AI boom in the 1980's that it became almost an institution."

    The truth is that Lisp (and its dialects) is an extraordinarily versatile and powerful language. It is suitable for just about anything, including operating system design (people have and are still writing great operating systems in lisp) and application programming (emacs anyone?), especially involving embedded scripting languages. The features which make Lisp unique (first class functions, lexical closures, powerful macros, etc. etc.) also make it able to adapt to practically any problem in computer science and solve it both elegantly and efficiently.

    Perhaps more than any other language, Lisp has taken a bad rap as of late, usually by people who haven't put any effort into learning it, or worse yet, people who have never tried it at all. I challenge those of you who took Lisp for granted as some sort of "AI language" to actually try it for yourself. At first you may find it awkward to adapt to Lisp's style of programming, but eventually you'll come to realize that the reason you felt awkward was because what you were doing before was not a very good method of programming or problem solving in general.

    -W.W.

    --
    "Well it should be obvious to even the most dim-witted individual who holds an advanced degree in hyperbolic topology...
  10. The fortune answers that better than I can... by tilly · · Score: 3

    Trifles make perfection, and perfection is no trifle. -- Michelangelo

    Lambda expressions ain't closures.

    Tom Christiansen recently made the very interesting point that any programmer who has not been exposed to all of the imperative, objective, functional, and logical styles has one or more conceptual blind spots. In his words, "It is like knowing how to boil but not to fry. Programming is not something you master in 5 easy steps."

    Perl smoothly supports building real system in any and all combinations of those programming styles. This is no small feat, even if it wasted on most of the monkeys currently giving Perl a bad name by pumping out glorified print statements...

    Cheers,
    Ben

    --
    My usual seat in the cluetrain is at A HREF="http://pub4.ezboard.com/biwethey.ht
  11. About Pike. by Cedric+Adjih · · Score: 4
    I've just downloaded and played a bit with the language. Basically, if I understood properly:
    • It is in fact quite close to Java.
    • It has garbage collection (or is it reference counting ? I created some circular dependencies and it didn't seem to collect).
    • It has high level types: string, array, mapping, multiset. It has simple syntax for defining constants with those objects, and basic operation on them (like lists, dictionnaries, hashes in Perl or Python).
    • It has OO, looks less hackish than Perl, but just doesn't look as clean as Java. Is class-shared data possible ?
    • The variables have to be declared. It is not statically typed though, and it has a "mixed" type which is a placeholder for any type (something like Delphi's "Variant").
    • It tries hard to be like C. Exactly the same declaration syntax, operators, control flow structures. Worrying point: it also has the preprocessor.
    • It is probably less dynamic than Perl or Python (I couldn't set the method of one object to be another, at runtime).

    Basically it is closer to Java than to scripting languages because of the declarations. It might be simpler to use than Java if, for instance, you used the "mixed" type (can hold any object) everywhere, because you don't need casts ; it still looks heavier than Tcl, Perl or Python.

    1. Re:About Pike. by perhe · · Score: 3
      Pike has both GC and refcounting. The gc is run now and then to remove circular structures (when there is enough garbage to collect, basically, using heurestics) or when you call gc() explicitly.

      Class shared data is not possible as such, but you can write, as an example:

      class Shared
      {
      int a;
      int b;
      float c;
      }

      Shared shared = Shared();

      class DaClass
      {
      void use_shared()
      {
      write( "a is "+shared->a+"\n");
      }
      }

      You can access the parent scope in classes (and functions (and funtions in functions etc)

      It is closer to java than C when it comes to declarations and such, IMHO. It also has quite a lot of similarities to lisp. Not the syntax (even if map( array, lambda( int elem ) { return elem+1; } ) does look rather lispish) but the internals and some of the programming structures are closer to lisp than C.

  12. Roxen use at RealNetworks by robla · · Score: 3
    Our entire website is powered by Roxen (and thus Pike). Having been indoctrinated in Perl and Python, I'll have to admit that when I first became a web developer here and took on learning Yet Another Language I was less than amused.

    However, I have to say that I'm impressed with the eye toward performance in Pike (most of the Roxen webserver itself is written in Pike), and the responsiveness of the maintainers when it comes to supporting the product.

  13. Re:Yeah, but what does it have to offer? by davidhedbor · · Score: 4
    To mention a few things:
    • C-like syntax. Not a very important point, but when it comes to learning the language it's much easier than say Perl if you come from a C/C++ background. It's basically a highly evolved LPC (of LPMUD fame).
    • A very powerful Image package. Can load tons of formats natively including Photoshop (psd) and Gimp (xcf). Used by Roxen to do all kinds of graphics generation on-the-fly.
    • Powerful datatypes - mappings, multisets, shared strings. Nothing unique, but Pike's are very scalable. Also string handling is rather powerful.
    • Integrated bignum support. Pike 7 can handle arbritrary size integers without any special effort from the programmers point of view.
    • Very good and easy to use socket handling. Not strange since the main app written in Pike is a webserver.
    • Good object orientation, easy-to-use abstracted database handling, very nice GTK bindings and lots of more things I have forgotten about etc.

    Now to some drawbacks - we all know that everything isn't all good.

    • Shared strings, and datatypes in general, does have a memory overhead. Usually not noticable but if you deal with LOTS of short strings for example, you'll notice it. Nothing really unique to Pike though, but it's worth mentioning.
    • Not very wide spread usage and historically not very well documented. There are no Pike books, but there is a good tutorial now (check out http://docs.roxen.com).
    • Slower than C - can't be avoided. Slower and faster than Java (depending on what you do), sometimes slower than perl. Unfortunately I have forgotten the URL to the site that had benchmarks.
    • Less mature than some other languages. Syntax still changes, although backwards compatibility usually isn't major problem.
    • More things I'm sure. I just can't think of anything right now.

    I hope this is helpful.

  14. too many scripting languages by jetson123 · · Score: 4
    Pike, Python, Perl, Tcl, JavaScript, Ruby, etc. are all very similar: dynamically typed, byte code interpreted, procedural/OO languages.

    In addition, there is a plethora of interesting, powerful interpreters for languages that go beyond traditional scripting: EiC (ANSI C interpreter), CINT (C++ interpreter), Hugs/Haskell, CAML-Light, Scheme, Icon, CLisp/CommonLisp, Squeak/Smalltalk-80, etc.

    Next time you feel the urge to invent a new scripting language, think about doing something genuinely new, rather than coming up with a language that is merely an incompatible, incremental improvement of something existing.

    If you can't formulate some new idea that your language implements that isn't easily added to Python or Perl, I'd say, don't bother and work on one of the existing languages instead. Many of the existing languages need more libraries and better foreign function interfaces, and several of the existing languages would benefit from new implementations in C++ and/or Java, etc.

  15. Re:Yeah, but what does it have to offer? by jacobm · · Score: 3

    Sorry, you just triggered my pet-peeve-o-meter. Nothing personal.

    The phrase 'X is the most of all possible Y' is, err, the most annoying of all possible figures of speech. :) How can you possibly say that "whitespace is the silliest of all possible protests against [Python]"? Sure, it's a pretty silly protest, but the silliest possible? That's pretty severe, don't you think? In fact, there are much sillier complaints about Python, I'm sure. In fact, I think I'll take your post as a challenge to think of sillier arguments, and I accept. Here's a list:

    Top Ten Sillier Things than Whitespace to Protest About Python

    10. Using a language called 'Python' might give people a cavalier attitude towards snakes.
    9. Python might not be Y2K compliant.
    8. Object-oriented languages suxXxor. You have to use dots all over the place.
    7. The Python interpreter doesn't automatically call the C preprocessor- you have to do it yourself.
    6. Python is Turing-complete. I hate that!
    5. MSVC has no idea how to compile it- can this possibly be a good language?
    4. Clearly it was a language designed by perverts. 'Hey baby, wanna program my Python?' Sickos.
    3. How could a guy named Guido possibly come up with a good language?
    2. The way the code looks reminds me too much of CLR. Bad memories, man.
    1. By taking a perfectly good language and naming it 'Python,' that's one less language that might become popular that could be called 'Ninja.'

    So whitespace is, at the very most, the eleventh-silliest possible complaint against Python. There may be others- could it be possible that the set of complaints about Python has no silliest element? Further research into that topic is necessary, I think. (As is research into how this post relates in any way to what I think about Pike.)
    --
    -jacob

    --
    -jacob
  16. Re:About Pike. (long) by kinkie · · Score: 5

    Pike is close to java in that they are both follow C syntax somewhat, extending it to OO concepts.

    It is unlike java in that while Java is strongly typed and you have to use typecast, Pike is as strongly-typed as you wish. You can use the mixed type to completely defeat any typechecking, or you can use classes and call them by name to be as strongly-typed as you wish.
    Also notice that pike's concept of "class compatibility" is somewhat different from all other strongly typed OO languages, as it doesn't call into play inheritance. If two classes have similar signatures (names and types of public methods and variables), they are compatible.

    Another novel approach Pike has is to function and operator overloading.
    With C++ (and Java, if I remember correctly), overloading is defined by having different functions take different numbers and types of arguments: i.e.
    void foo (int arg);
    void foo (char* arg);
    They are distinguishable at compile-time because the function signature is extended to its arguments' types, usually via name mangling.

    Pike insteads allows arguments to be of different types. The above example would translate to:
    void foo (int|string arg).
    The programmer can then use runtime type information to discriminate.

    Pike has both refcounting and garbage collection. It is quite uncommon to see the gc in action, as it will kick in when some percentage (I think half) of the object references are deemed garbage (it uses some adaptive algorithm to determine when to run). Or when explicitly invoked.

    About static typing, see above. It can be as strict (or as lax) as the programmer wishes. It is refreshing to have some "mixed tmp" variable in a function and use it for loops etc.

    About control flow structures, it has some more than C (i.e. foreach()).
    The preprocessor if used wisely can be a nice weapon. For instance, you can detect the interpreter's version and use threads when possible. Of course, this also means that it allows people to write messy code. But they'd do it anyways...

    It can be as dynamic as you wish. For instance, setting a method of another object can be done using a "function"-type variable:

    class foo {
    private int foo_bar() {
    werror "foo";
    }
    function bar=_bar;
    }
    class gazonk {
    private int gazonk_bar() {
    werror "gazonk";
    }
    object foo_object=foo();
    void create() { /* constructor */
    foo_object->bar=gazonk_bar;
    }
    }

    I could have also used anonymous functions (lambda) here.
    i.e.
    function foo_bar=lambda() {werror "foo";}

    A nice thing about the language is that it doesn't try to hide details from the user. It is known what is handled by reference (every composite type, classes, objects, functions) and what is by value (basic types). It allows runtime inspection (via the indices, and typeof operators), remote objects, etc.

    Since functions are primary objects, the whole runtime library follows a very consistent callbacks-based approach. This comes very handy when doing asynchronous I/O (one of Pike's strong points) or GTK programming.

    About its "product placement" in terms of heavy-ness. It has some at-large programming helpers (more than TCL), and its syntax is less shell-ish than TCL's. Perl is IMO simpler for very simple tasks, but heavier for more complex ones (especially when need to go further than the string-array-hash types, and references come into play. Pike is much easier in this respect).
    Python, I don't know really.I've never used it. I suspect that Pike and Python play roughly in the same league, neither clearly besting the other. I find Pike very convenient in I/O-related task, X programming (although here TCL/TK is better), and some simple text-manipulation tasks, requiring little text manipulation and a bit of variables-juggling.

    About the runtime environment, Pike offers a two-pass compiler (no forward declarations), a mixed static+dynamic names binding model (intra-object references are static, inter-object they are dynamic), and a nice (but not comparable to CPAN) runtime library, including some nice DB-connectivity options.

    --
    /kinkie