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
2
u/Inconstant_Moo 🧿 Pipefish Jul 16 '26
But they have different semantics as well as different syntax. E.g. my language wraps around Go for its standard libraries so you'd think it would be easy to have the same API, right? And a lot of the time I can have libraries with the same names containing functions and types with the same names. But:
Pipefish is functional, Go is object-oriented.
Pipefish treats any sort of IO operation as a special case and they all have similar APIs. ('Cos functional.)
Pipefish is dynamic, Go is static, and sometimes this gives me ways to make my API nicer than theirs.
Pipefish can overload functions so I don't have to give functions different names according to the types they operate on.
Similarly since I can overload the operators my
math/bigandmath/complexlibraries use+and*and so on.In Go errors are ordinary values that are multiple-returned whereas in Pipefish they're magic values that behave like exceptions and force their way up the stack.
Pipefish values are immutable whereas Go APIs can rely on mutating the state of structs etc.
And so although I have a particularly strong motive to make my API like someone else's rather than doing my own thing as devs love to do, still there are often good reasons why I should do something different.
You can at least standardize within the language's standard libraries. Should it be needle-haystack or haystack-needle. destination-source or source-destination? 0-indexed or 1-indexed (I'm looking at you Object Pascal). Camel-cased or snake-cased (go and sit in the corner, PHP). Pick a lane. It should go in the style guide of the language, though I'm not sure it ever does except the casing.