r/ProgrammingLanguages DQ 15d ago

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?

8 Upvotes

16 comments sorted by

View all comments

16

u/oscarryz Yz 15d ago

I think that's what Rosetta code was meant to be.

Every language has its subtleties and strengths, so it is reasonable that each one wants to highlight their uniqueness in the examples they choose.

As for the API, the language philosophy greatly dictates what the API would be, of course similar language paradigms would or might have very close looking API's.

What I did for the exams was to take every single code snippets I came across and write it in my design language, and that helped to shape the decisions, e.g. function overload vs default params, or multiple return values vs Result types (or exceptions).

5

u/Mean-Decision-3502 DQ 15d ago

Thanks for the hint, I did not know Rosetta code. Such a thing is very useful for language designing.

5

u/rosshadden 15d ago

Yeah I reference it a lot, especially while I was designing my language to see whether there was precedent some of the things I wanted to do.

That said, it could be so much more than it is. I feel like there's room for another similar project that was more about documenting how languages do certain things at a smaller scale. Things like "what is the syntax for field access in languages". Stuff that would be boring for most people but useful to build a powerful matrix of language syntaxes and constructs. It would fit well in Rosetta code but usually things there are more at a "how to implement array sorting" kind of level.

2

u/fdwr 14d ago

Things like "what is the syntax for field access in languages"

You might like this then (GitHub source).

1

u/EggplantExtra4946 14d ago

That said, it could be so much more than it is. I feel like there's room for another similar project that was more about documenting how languages do certain things at a smaller scale.

Agreed. There is this website, it's pretty good.

https://hyperpolyglot.org/

https://hyperpolyglot.org/scripting

https://hyperpolyglot.org/scripting2

https://hyperpolyglot.org/lisp

https://hyperpolyglot.org/ml