Re: Just curious: who is using Pike for what?

Chris Angelico <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAPTjJmo7y2yHcXZ5gWjFK5C9ZrV4Yn=Oj8vV-FUWFsK7VaywxQ@mail.gmail.com>
On Mon, Dec 12, 2016 at 9:24 PM, Arie van Wingerden <[email protected]> wrote:
> Since I ask you, I'll tell a bit about why I came here ...
> Well, I am a retired (Systems) Programmar (IBM mainframes) and always have
> enjoyed programming. A long time ago I wrote Cobol and RPGII. Later I used
> Assembler for some bits but mostly Rexx for most other things. Rexx was
> amazing, because it was so very well integrated in the OS.

Hey, that's cool! I'm a REXX guy too, although not on big iron - I
spent most of the 90s writing code on OS/2. GUI code in VX-REXX,
scripting code in straight REXX. Also wrote myself a MUD in C++, with
room code implemented in REXX.

> Later on I started digging into languages, weighing the pros and cons and
> today I still do!
> What I like to have in a PL is:
> - readability
> - power
> - good integration with OS (read: a lot of great modules)
> - possibility to develop fast (no long compilation cycles etc.)
> - approachable GUI programming (not the C way)

For readability, Python wins, hands down. It's the language I would
recommend as anyone's first. Python also wins a combination of
integration and fast development (C is better for OS integration, but
it's so much worse for fast development), with Pike a little way
behind. Pike and Python tie for power; some things are better
expressed in one and some in the other. GUI programming, though, I
absolutely choose Pike. It is hands down my favourite language for
that. Kinda weird since it's primarily a back-end language! So, now to
answer your original questions.

> Would you please tell me what kind of work you do with Pike (and if possible
> what type of company you work for) and if Pike is the only language you are
> using?

It's definitely not the only language I use, but it's my favourite. I
also use Python and JavaScript (and earn my bread and cheese by
teaching them), along with C (primarily to implement the above
languages), shell scripting, and a smattering of other languages on an
as-needed basis (eg Scheme only because Lilypond uses it, otherwise I
wouldn't bother).

1) GUI programming, as mentioned. I have a MUD client, a Twitch bot,
and (as yet unreleased) a mail client, all full-size apps with proper
GUIs.
2) Back end servers. I run a MUD (Minstrel Hall) written entirely in
Pike. It's what the language was originally built for, and it's easily
the best language I know for the job.
3) Text/data manipulation. Vies with Python for top spot at this; I
love sscanf's expressiveness, but Python has marginally better Unicode
support (eg upper/lower case that acknowledge the Unicode tables).
4) Simple, dependable scripting. Also vies with Python, but that's
because Python scripts are easier to distribute. (I can hand someone a
.py file and expect that Python will be either already installed, or
easily obtained. I can't be so certain with Pike.) My shed is full of
quick Pike scripts.

> Maybe also a bit on the pros (and maybe cons) of Pike?

Easy syntax for doing some operations across entire arrays. You can
look up and call methods on arrays of objects, you can use "automap"
syntax to quickly manipulate arrays of strings, and so on. Gets fairly
expressive:

rm(oldfiles[*]);
parts = replace(parts[*], "&", "&amp;");
return "Regions are: " + capitalize(sort(indices(timezones))[*])*", " + ....;

The last one multiplies an array of strings by a joiner string,
producing a single joined string. Very convenient. (And yes, you can
divide a string by a string to split it.)

Easy GUI management, and easy code reloading. However, put the two
together and you end up with something a bit messy and verbose, so I
put together a framework that makes it cleaner. But hey, even if you
have to build your own framework, you're still way better than most
languages offer you! Where else can you have a simple menu option that
downloads the latest code and applies it *immediately*, without
disconnecting you from the server or anything?

Heavily optimized. In a lot of cases, your code is compiled to machine
code, so it executes fairly fast. For a high level language, Pike
performs very well (I generally estimate that a Pike script will
outperform an equivalent Python script about 3:1). Obviously it's hard
to compete with C or Fortran for raw speed, but Pike is just so much
easier to use that I don't mind.

Downsides:

It's not well known. People don't know how to use it, so you need very
detailed installation instructions. Getting Pike set up on a Mac, for
instance, ain't pretty. (I *think* that installing Xquartz followed by
'brew install pike' will get everything, but I've had reports of
failures. So it's probably OSX version dependent.)

There are dark corners in the code. I've done work with GTK2 and some
other areas, and come across sections of code and documentation that
desperately need work. In terms of documentation, you've seen some of
it yourself. I guess that means Pike is... very open to contributions?
:)

Being a "niche" language, it lacks some of the features that other
languages can implement, as they have larger development teams. Python
and JavaScript both have generators now, which is awesome; but they
take a lot of dev time. Also on my wish list would be array
comprehensions, again paralleling Python's - there are times when
automap gets unwieldy, and it'd be awesome to have a better syntax for
those. But again, dev time. Someone's gotta write it, debug it, test
it, document it.

All in all, it's a language I love, and my GitHub reflects that. Not
the only one I love, and there are good reasons for choosing other
languages, but it's well worth having in the toolbox.

ChrisA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.