r/ProgrammingLanguages • • 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

81 comments sorted by

View all comments

Show parent comment

3

u/Tuxinoid 28d ago

C did not make a difference between functions and procedures because the original design of C was something better than assembler - and K&R did not care very much about strong typing and such things.

Other languages did make that distinction - and it is for a reason: to prevent errors. A programmer who feels "burdened" by the distinction between procedure and function should rather look into something else than programming ...

1

u/arthurno1 28d ago

C did not make a difference between functions and procedures because the original design of C was something better than assembler - and K&R did not care very much about strong typing and such things.

That is a massive oversimplification dude and historical inaccuracy.

The K&R very much cared of typing. C did not omit the distinction simply because it was "better assembler" or out of apathy for typing. C evolved from BCPL and B, which were typeless languages. Early C did not even have a void type; everything defaulted to returning an int. This was a pragmatic design choice aimed at simplifying the language grammar and the compiler for 1970s hardware, specifically for systems programming. They still though gave you types and had type checking, that was one of the big improvements of C compared to what it was replacing B and BCPL.

Other languages did make that distinction - and it is for a reason: to prevent errors.

Older languages like Pascal enforced a strict keyword distinction (procedure vs. function) to clarify intent and prevent assigning empty results to variables, but modern compiler theory has made this obsolete. Today's strictly typed languages (Rust, Go, Swift, Kotlin, Java) unify them under a single concept (functions/methods). They prevent errors using return types like void, Unit, or () which proves that a robust type system does not need this vocabulary distinction at all. In other words, less is more still holds.

A programmer who feels "burdened" by the distinction between procedure and function should rather look into something else than programming ...

This is just ignorant and stupid gatekeeping, that actually does not deserve the answer since it borders to trolling. By asserting that developers who dislike this distinction shouldn't program ignores the entire development of modern language design, which you so believe you are supporting. The industry has almost universally abandoned the procedure/function split because unified abstractions are cleaner. Relying on type signatures rather than distinct keywords is the standard for safe, modern software engineering.