r/ProgrammingLanguages • u/Mean-Decision-3502 DQ • Jul 16 '26
New Languages: Standardizing API, Examples ?
Hi, some of you are developing new general-purpose programming languages here. When the language is ready, you have to develop standard APIs, like file-io, json-handling etc. Users, and you would have benefit, when the APIs would be same/similar across multiple different languages.
Standardizing some Examples would allow the users to compare languages more easily.
What do you think?
11
Upvotes
View all comments
Show parent comment
2
u/Inconstant_Moo 🧿 Pipefish Jul 16 '26
I guess the greatest difference can be seen in the input operations of the various libraries. These are IO operations, specifically input operations, all of which would work happily together if you imported them into the same namespace because of overloading:
File("<filename>")andRandom(1::7)andClock()are struct constructors, so it dispatches on them.Pipefish doesn't mandate the
get ... from, that's just a useful convention, but it does require that all input should be done in the form "move this information into this variable" (the variables in these examples beingtext,d_6_rollandtime). This makes the imperative part of Pipefish as imperative as BASIC.Then you can put all sorts of things in the payload of Random, if you put a float you get a random value between 0 and the float, if you put the name of an enum type you get a random element of the enum, if you put a list you get a random element of the list.
So now look at what we do with SQL.
You will notice that not only is the API for my standard
sqllibrary much nicer than the Go library it wraps, but also that the hand-rolledhtmlFormatlibrary embeds its HTML using the same syntax and semantics as thesqllibrary does for SQL, the whole--and|...|thing.This is all very lovely in my opinion, this is the sort of thing Pipefish is for. But it's not like Go.
When it comes to pure functions, OTOH,
strings.split("fee fie fo fum", " ")in Pipefish means just the same asstrings.Split("fee fie fo fum", " ")in Go, and indeed just wraps around it.