Thoughts On The Pike Programming Language?
Posted by
Cliff
on Sat Jun 03, 2000 03:26 PM
from the what-do-you-think? dept.
from the what-do-you-think? dept.
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?
"
This discussion has been archived.
No new comments can be posted.
Thoughts on the Pike Programming Language?
|
Log In/Create an Account
| Top
| 235 comments
(Spill at 50!) | Index Only
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.

Pike with Gtk bindings (Score:4)
Haiku (Score:3)
A powerful new system
Named after a fish
Pike (Score:4)
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.
Are you blind? (Score:3)
A good example of Pike in action (Score:4)
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 [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.
Re:Yeah, but what does it have to offer? (Score:3)
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)
Re:Scriptlanguages are bad (Score:5)
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.
Re:Haiku (Score:3)
about pike because it doesnt follow the haiku syntax
at all.
----
Oh my god, Bear is driving! How can this be?
Re:That's not a haiku. (Score:4)
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
Lisp is *not* only for AI. (Score:3)
"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.
The fortune answers that better than I can... (Score:3)
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
About Pike. (Score:4)
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.
Re:About Pike. (Score:3)
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.
Roxen use at RealNetworks (Score:3)
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.
Re:Yeah, but what does it have to offer? (Score:4)
Now to some drawbacks - we all know that everything isn't all good.
I hope this is helpful.
too many scripting languages (Score:4)
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.
Re:Yeah, but what does it have to offer? (Score:3)
The phrase 'X is the most of all possible Y' is, err, the most annoying of all possible figures of speech.
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
Re:About Pike. (long) (Score:5)
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() {
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.