Skip to content(if available)orjump to list(if available)

Pike – a dynamic programming language with a syntax similar to Java and C

runjake

Lots of people questioning what Pike brings to the table. Be aware that Pike has been around for over 31 years[1]. It's kind of dead now and a lot of people have moved over to Lua[2] (which is over 32 years old!).

So long ago, that it took me a minute to recall having programmed a lot of CGI code with it, back in the Roxen web server[3] days.

1. https://en.wikipedia.org/wiki/Pike_(programming_language)#Hi...

2. https://en.wikipedia.org/wiki/Lua

3. https://en.wikipedia.org/wiki/Roxen_(web_server)

ofrzeta

Brings back some memories of the webserver Roxen that had a GUI, if I remember correctly. It still seems to be semi-alive, although the download page looks broken.

https://en.wikipedia.org/wiki/Roxen_(web_server)

EDIT: Github repo https://github.com/pikelang/Roxen

atorodius

what does pike look like

https://pike.lysator.liu.se/docs/tut/introduction/first_glan...

(saving you some clicks...)

2mlWQbCK

From what I remember of working with Pike, the best part was probably the included image module. Maybe I will install Pike again just to see if I still like it.

https://pike.lysator.liu.se/docs/man/chapter_13.html

2mlWQbCK

Turns out there is no Pike package for FreeBSD, no port, and the Pike git repository has a FreeBSD subdirectory last updated 22 years ago.

But ./configure && gmake && gmake install seemed to work, or at least it runs and nothing weird has happened so far.

Zambyte

Thanks. It took me 5 clicks before finding any code (this page).

fifilura

More information in this earlier comment, linked from the wikipedia article

https://news.ycombinator.com/item?id=31453477

https://en.wikipedia.org/wiki/Pike_(programming_language)

Alifatisk

It claims to be one of the fastest “scripting” languages, where can I see the numbers? Does it perform close to DaScript?

Also, is it only an interpreted language or can I compile it too if I want?

Is it like Ruby in the sense that I have to share the whole runtime with the ruby script or can I somehow share a standalone cross-platform executable?

I’ll be honest, the design decision at first hand sight did not look that exciting

string name = Stdio.stdin->gets();

nine_k

The proper sales pitch would be: "A fast dynamic scripting language with a sane module system, hot reloading, and easy C interop". The fact that the syntax is similar to C should be mentioned without the pomp somewhere in the chapter about syntax; this is nothing to be excited about, but understandable, given the intended audience.

knowitnone

"string name = Stdio.stdin->gets();"

It did say it was like C so the design decision you don't like is C

Alifatisk

I don't think it goes both ways in this case. I wasn't a fan of their inspiration from C, it doesn't mean I don't like C.

I'm fine with C. Keep the focus on Pike.

null

[deleted]

airstrike

What's the itch this language is trying to scratch? For which use cases is it best suited?

cess11

Have you ever built games in LPC? It's kind of like that, but more cleanly general purpose. First class modules, hot updates, simple and familiar to those who know some algolians, things like that.

pansa2

Pike is described as a "dynamic" language, so I was expecting purely dynamic typing, yet the language uses Java/C-style variable declarations with explicit types.

It seems that these are (unsound) type hints, years before TypeScript made them cool:

> "If your program tries to put one type of value in a variable which was designed to hold another type of value, Pike may detect this" [emphasis mine]

https://pike.lysator.liu.se/docs/tut/fundamentals/index.md#t...

2mlWQbCK

Not sure what they are referring to, but it may be that you can declare things as having one of several types (e.g. int|string|void) or even that something can be any type at all (i.e. turn off static type-checking for that thing)? I do not think the type-checker will ever randomly decide to just not check a type given that you have provided types for it to check, but it was a long time ago since I had to read or write any Pike code.

pansa2

Looks like there’s a `mixed` type, variables of which can hold values of any type. But at least that’s something you can `grep` for.

A more subtle issue with type hints (as in TypeScript/Python, not sure if this applies to Pike) is that there are ways to work around the type system. You can get, for example, a variable of type `int` that actually holds a `list`:

https://news.ycombinator.com/item?id=43508152

metalliqaz

I can turn off static type checking for a thing in C by using `void*`

speed_spread

Groovy has that too and it's quite the anti-feature. Pretend static typing is worse than useless, it's the MAC-10 of footguns.

ch4s3

> it's the MAC-10 of footguns

At least it might be shooting Nulls.

cmrdporcupine

Sounds like Julia, too.

Also you'd think having the type signature would help with performance, but in some cases it can cause the VM to enforce a runtime type check where it wouldn't have before, imposing worse performance.

drbig

I remember coming across Pike about two decades ago (or more), as a young amateur developer... I couldn't understand why anyone would choose Pike.

And today I still can't.

Legacy projects?

pipeline_peak

It always seemed like a MUD language project that tried to recycle its efforts by taking on Python, Ruby, etc.

There’s literally no reason to use this language unless you want to make MUD games or are just purely curious about the project.

xorcist

That's a bit anachronistic. Pike was released in 1994, the same year as Perl 5.0 and Python 1.0. Ruby did not exist yet!

Being an offshoot of an existing MUD language it was quite usable even a young language, comparably good performance and a compelling C embedding. History could very well have been different. The 90s was a really good decade for dynamic languages.

cmrdporcupine

I mean let's be fair: back then MUD nerds were using LambdaMOO's "moo" language and LPmud's "LPC" before things like Python were mainstream or serious, Perl pre-5.0 was terrifying and limited, and Ruby wasn't even on the radar.

So when we went to go do "serious" work we kinda missed them.

Your options in 1991, 92, 93 were earlier perls, shell + awk/sed, or maybe tcl or a lisp/scheme if you were lucky.

The languages inside those MUDs actually were ahead of their time, and their programming model -- in the case of MOO [and its offshoots CoolMUD and ColdMUD] at least -- was more similar to advanced systems like Smalltalk or Self which were hot interesting topics at the time.

Being "confined" to being "game" languages made them not get taken seriously (unlike "JavaScript" which arrived with all sorts of weird warts but had Netscape's brand on it), so the LPC people tried to make it into a "serious" language in the form of Pike, and it's not half bad?

By the late 90s, obviously things had changed. If somebody in a successful "serious" company had adopted Pike/LPC it could easily have had an alternative history where they became commonly used instead of perl5 or php on the early web. (It took Python a decade to get serious headspace there.)

(Gratuitous plug for my LambdaMOO defibrilation: http://github.com/rdaum/moor)

chuckadams

LambdaMOO was ahead of its time in many ways: lists are immutable, but there was a handy splice operator. Verbs could have aliases and wildcards or both, allowing for some interesting namespace-like behavior. Would have been nice if they could have completely decoupled the built in parser before development died off, but it should be a pretty simple task nowadays, and some places like E_MOO managed to soft-code some pretty decent parsers regardless.

tomjakubowski

If you ever wrote LPC on an LPMUD back in the day, you were writing proto-Pike :)

null

[deleted]

sigzero

I am old. I remember when it came out.

null

[deleted]