Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Pike Programming Language (liu.se)
63 points by classichasclass on July 7, 2019 | hide | past | favorite | 33 comments


I remember learning about Pike nearly twenty years ago. It made some decisions that seemed odd then but which seem rather modern in retrospect. First of all, it was a scripting language that had typed arguments. And second of all it allowed multiple types as arguments and returns -- for example you could define a function int|float sq(int|float x) {return x*x;} that would do the right thing for ints and floats but still error out on strings.


coming from C pike felt rather natural, and i felt pike was ahead of its time when people elsewhere argued about typing and python, ruby and javascript (typescript) started adding optional types. pike had them all along.

pike attracted me because it was the first language i came across that allowed me to recompile classes at runtime.

i also love its deceptively simple class model. each file of code IS a class. there is no need to declare the class inside (as java has you do), but you open the file and put functions inside. done.

elsewhere you inherit the class by referring to the filename: "inherit foo.pike".

pike was the start of my career as a software developer and i am still using pike for all my websites to this day. the difference now is that i write the frontend in javascript and the backend is a BAAS platform with a REST API in pike.


I remember using the Roxen webserver somewhere in the 90s when we had a workmate who was very fond of it. Roxen is probably the single reason for the existence of Pike – or the other way round.


If I remember correctly, one of the selling points of the Roxen/Pike combination back then was its ability to dynamically render headings as images without much effort.

"Weird flex", as the kids say these days, but times were weird and HTML limited.

Pike itself always struck me as rather boring. Quite C-like compared to the other P-languages, but nothing really powerful. Still probably better than pre-7 PHP…

(Anyone knows what happened or didn't happen to Icon? Looked more interesting back then, but vanished into the haze.)


Icon is still available, but not actively developed: https://www2.cs.arizona.edu/icon/

Unicon is an object-oriented descendant that’s more active: http://unicon.org/

I often wonder why Icon (or Unicon) isn’t more widely known or used these days. They’re very easy to understand and I was amazed how quickly I could write interesting code. There are excellent tutorial books available to help get started: https://www2.cs.arizona.edu/icon/books.htm


pike is based on LPC which was designed for MUDs. LPMUDs where the first games to have builtin ftp and then webservers written in LPC. pike is a rewrite of LPC to free it from the non-commercial license that LPC had at the time.


Now that's a name i haven't heard in a long time. Pike too for that matter. Quite interesting to see that Pike still an active project.


Very interesting. I had no idea Roxen was even a thing. Never heard it mentioned once in the past 20 years of being a linux janitor! Kinda like AOLServer/Navi levels of obscurity.


Heh. My first production app was built in Roxen RXML, with a little Pike here and there where RXML’s sluggishness couldn’t be tolerated. By the third version, it was almost entirely Pike.


you wouldn't believe what people were capable of writing with RXML. i worked with one company where they wrote a whole ERP system almost all in RXML. it was amazing.


having heard of AOLServer, i'd say, that's about right. i discovered it in 1994 when i decided that the ncsa/cern servers were to simplistic. apache wasn't a thing yet. and the first alternative i found was a server written in common lisp. i was put off by the fact that i had to write lisp code to just serve static html files, so i kept searching, and found spinner (the predecessor for roxen) next. it came with an extensive webinterface for server administration and was just a blast to work with.


I thought this had something to do with Rob Pike. Like maybe he was forking Go or had a new idea for a language.


I thought Go was at least 1/3 Pike.


I never used Pike, but some of my earliest programming was done in LPC, the MUD programming language that is the origin of Pike. I knew basically nothing about anything then but was still able to do some fun things.


LPMUDs were my first introduction too. when i discovered the webserver (spinner as it was called then) and saw the code i was like: "hey i know this language!". felt at home instantly.


oh it's neat to see this, as I recall i first discovered pike way back as a teenager via DreamSNES, an snes emulator that you can burn to a cd with roms and play on a dreamcast, for lack of a better description. anyway, the wizard for getting it set up, including doing all the writing to the cd, was written in pike if memory serves correctly.


quite likely. a bunch of the core pike developers had been working on SNES stuff. i didn't have a dreamcast so i didn't pay more attention to that.


I used it with Roxen (later Caudium) to build a remote file manager, and it was really nice.

Unfortunately, it was also quite slow.


I don’t know if this would be useful to my projects, but the documentation is impressive. Well done!


Opera used (still uses?) this as well for back-end stuff.


the opera mini servers and their browser development tool chain was all written in pike.


Pike was a horrible programming language driven by nepotism


Stopped reading after reading main() returning doesn't end the (interactive) program and you have to manually hookup a signal, otherwise the program will continue running indefinitely. Seems error prone and very counterintuitive to me.


I've stopped reading the above comment after "Stopped reading after".

I've never read anything insightful and not knee-jerky coming after those words...


Do you read your own comments? (Asking for a logician friend...)


Yes, as a meta-comment they belong to a different class (see Russel and co).


That's very typical of programs using a GUI platform. One way or another you have to kick off an event handler, whether it's TKinter or Qt or in this case, GTK. The event handler runs independent of your code and has to be told when to quit. I have to agree that

    GTK.Alert("Hello world!")
    -> signal_connect("destroy", lambda(){ exit(0); });
does seem to be less than intuitive and not a pretty thing to drop into a hello-world tutorial!


Yes, registering events in a GUI is common, but for a "Hello world!" to shutdown? Never seen it needed for something that simple.


The cli hello world exits with the main return value.


You’re missing out on a lot if you decide to stop reading things for reasons you find counterintuitive.


and it's also false. you missed that you have to explicitly tell pike to continue by returning -1 from main or calling the backend event loop explicitly.

any other program ends when main is exiting.


where did you read that


Towards the end of [0] which was linked from "I want my greeting in a window from [1]. The link has since been stricken out from when I looked at it several hours ago, so maybe its outdated?

I don't know... I've only done GUI work on Windows, but I've never had to register a signal handler to get my app to exit. Yeah, you might register handlers for events to control how the app shuts down (e.g. to save unsaved docs), but mandatory? I've not seen that before. [0] https://pike.lysator.liu.se/docs/tut/hello/window.md [1] https://pike.lysator.liu.se/docs/tut/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: