r/ProgrammingLanguages • u/ThomasMertes • 29d ago
How programming languages approach graphics
Many general-purpose languages delegate graphics to third-party libraries (like SDL, Raylib, or OpenGL). Seed7 integrates portable 2-D graphics right into its standard library. This IMHO improves portability. I also thought about introducing operators / statements to do graphics, but until now I don't use operators or statements to do graphics.
29
Upvotes
View all comments
Show parent comment
-2
u/arthurno1 28d ago
Yes but I asked you why do you have two terms, both "proc" and "func", not why you declare a return value. You have introduced an extra cognitive burden on your users, when "func", would be completely enough. Do you have "method" too? :)
There is a fine line between classifiying and sorting exact everything, and doing it where it matters. Every "branch" you introduce is an extra cognitive load on the programmer. The art is to create a language that does not burden people where it does not matter. A programming language is typically invented for humans, to make their job of writing computer programs easier, not harder. In your particular case "func" would do in both case, since you have type information.
As an illustration, C never had "function" or "procedure" keyword, because it is not needed. A compiler can deduce on it's own whether you are declaring a variable or a type. Considering they designed the language to be compiled in 1.5 pass back in 70s when computers were quite slow, that can't be too much to ask. The biggest lesson of C is their philosophy that "use looks like declaration"; i.e there is no separate syntax to declare things compared to when you use those types and functions. The reason was of course to make it easier for the programmers to learn and use the language. C has lots of other problems of course, but they did that thing right I think. To the degree that was possible to do, of course.