r/ProgrammingLanguages • • Oct 29 '26

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

2

u/Valuable_Leopard_799 29d ago

But if you're writing portable graphics you can use a portable library.

In this case you need to ensure that this portable library is installed when you move your program to a new computer.

The stdlib has the same issue, either you are compiling it in which solves it for both, or you depend on something being installed on the target machine. By portable library I meant something in Seed7.

The Seed7 standard library is guaranteed to be always available.

That is of course a very good point, but it's a trade-off.

Why couldn't this Seed7 graphics library be in userspace and expose the exact same functionality?

The Seed7 graphics library is not in kernel space...

And a userspace Seed7 library wouldn't have to be either. I'm used from my languages to having portability libraries where you get a subset of all the possible features but the library is able to target, any of a number of backends based on your needs. The backends being the C libraries for one example, but it could be anything else.

The choice is of course up to any ecosystem to make, it just seems that one of the stated pros of having it in the standard library was "portability", which wouldn't necessarily be the case, unless I'm missing something big.

1

u/ThomasMertes 29d ago edited 29d ago

And a userspace Seed7 library wouldn't have to be either.

I am not sure I understand your term "userspace library" correctly as all the libraries we are talking about here are in userspace (and not in operating system kernel space).

Can it be that you use "userspace library" for libraries written in Seed7 as opposed to libraries written in C. Is this your definition of "userspace library"?

Many languages provide libraries which are operating system dependent. For example an X11 library which is just available under Linux and a win32 library which is just available under Windows. Based on these lower level libraries a higher level library could provide a portable graphics API. Maybe you would use the term "userspace library" for this higher level library.

By design Seed7 has no operating system dependent libraries. There is neither an X11 library nor a win32 library. This guarantees that it is impossible to write Seed7 programs, which run just under Linux or just under Windows. This is the precondition for the claim that it is impossible to write non-portable programs in Seed7. Every Seed7 program is automatically capable of running on all supported platforms.

This design forces that system dependent parts of the runtime library are not available to Seed7 programs. This is the reason driver libraries (written in C) exist. The Job of these driver libraries is: Abstract everything that is operating system dependent away.

0

u/arthurno1 29d ago edited 29d ago

I am not sure I understand your term "userspace library" correctly.

If you don't understand the difference between "userspace code" and "userspace library" and system calls and system libraries, you shouldn't be in the business of desining "systems programming languages" and software libraries at all.

Neither win32 nor X11 are systems library, they are both user-space libraries.

Just to give you a taste of your own rhetorics, which you so happily used in another thread. I suggest lookup what those terms mean. Since you have LLM:ed your entire "programming language" and "libraries", you can perhaps ask LLM to give you the answer. I am sure it will be unfortunately more knowledgable than you.

1

u/ThomasMertes 29d ago edited 29d ago

The general purpose language Seed7 is based on my Diploma thesis and my PhD thesis and has been released in 2005 long before LLMs were a thing.

1

u/arthurno1 29d ago

Very cool; how did you get a PhD if don't understand difference between user-space and kernel-space? Both x11 and win32 are user-space libraries. They are "system dependent", but they are user-space.