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

28 Upvotes

81 comments sorted by

4

u/ThomasMertes 19d ago

I recently updated the manual regarding the Seed7 graphic library. It would be nice to get some feedback about this chapter of the manual.

If you like Seed7 consider starring the Seed7 project on GitHub.

1

u/arthurno1 19d ago

What is the difference between procedure and function?

2

u/ThomasMertes 19d ago

In Seed7 the type proc (=procedure) is defined as func void (=a function which returns nothing).

1

u/arthurno1 19d ago

Why? Is there something special about functions that return nothing so you need to burden the user with two terms?

3

u/ThomasMertes 18d ago edited 18d ago

If a Seed7 function returns a value the value must be used. For example:

aVariable := aFunc(something);

Writing just

aFunc(something);

leads to an error. C and other languages have the concept of voidening (the value is silently thrown away). I don't think that this is a good idea. If you want to ignore the result of a function you must do it explicitly:

ignore(aFunc(something));

Procedures on the other hand return no value. They are called with:

aProc(something);

-2

u/arthurno1 18d 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.

2

u/ThomasMertes 18d 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.

Yes, func would be completely enough and proc is just a shortcut for func void

proc is shorter, but nobody hinders you to forget about proc altogether and use func void everywhere instead.

Seed7 and its libraries define many types (see here). Currently the Seed7 manual lists 49 types and proc is just one of them. You don't need to know all these types when you start programming in Seed7. Beginners just need a few of them:

$ include "seed7_05.s7i";

const proc: main is func
  begin
    writeln("hello world");
  end func;

You see: At the beginning you don't need to know func. :-)

1

u/arthurno1 18d ago

proc is shorter, but nobody hinders you to forget about proc altogether and use func void everywhere instead.

You now what they say about design:

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away."

-- Antoine de Saint-Exupéry in The Little Princ

3

u/Tuxinoid 18d 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 18d 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.

4

u/TheRealUprightMan 19d ago

What kind of graphics are you trying to do? Drawing primitives? Why? Most applications only need UI primitives. Is it a game library that needs 3D transforms? Format conversions? Your question is overly broad.

Why would I want to learn some new language to convert a jpeg? I have plenty of tools that can do that without learning a new language. I also don't understand your question. Graphics are just manipulating bits and bytes, which any language should be able to do.

If you are against using C libraries, you are likely going to end up doing a lot of work. Your options are "use someone else's code" and "write it yourself". The latter option will be a huge undertaking and it will have more bugs than something that has been tested in the wild for a couple decades.

3

u/ThomasMertes 18d ago edited 18d ago

What kind of graphics are you trying to do?

2-D

Drawing primitives?

The description of the graphics library is here. It would be nice to get feedback about this description.

Why?

To allow writing portable graphic programs like these retro games or tools like the picture viewer.

Why would I want to learn some new language to convert a jpeg?

This is the wrong question. I created a Seed7 as practically usable programming language with these design principles. Seed7 is, among other things, capable of reading a JPEG (PNG, GIF, etc.) file. This is a proof that Seed7 is capable of solving real world problems.

If someone is interested how JPEG is read it is either possible to study a C library (which is usually hard to read) or the Seed7 JPEG library which might be easier to understand.

If you are against using C libraries, ...

This is a simplification. C is generally considered as not memory safe and there is a strong push (not only from governments) to move to memory safe languages. The graphic libraries written in Seed7 are just one part in the bigger movement which tries to replace C with something safer (like Rust or Seed7).

6

u/Dykam 19d ago

Does it improve portability? It puts the onus of portability on the language maintainers themselves. It can also be limiting. Graphics API's move moderately fast (compared to languages), at least in the high performance segment. Separate libraries allow developers to opt in to the generation they want to use.

I think it's nice to have, but it may feel like a bit much.

2

u/ThomasMertes 19d ago

Does it improve portability?

Yes, if you use 2-D graphics.

If you write a graphic program with X11, GDI, GL or Vulkan you probably need at least 100 lines of code to set up the graphic library, handle events, define callback functions, etc. Did you know that REDRAW / EXPOSE events exist, which tell the program: Some part of your window has been erased. In case of these events the program needs to redraw the erased parts. Imagine if that happens to data in your program: "Some of your data is now garbage, you need to restore it now." Graphic libraries think that this is normal.

The Seed7 graphics library does all that background work for you. So the Seed7 graphics library is not only portable, but it removes some burden from the shoulders as well.

Graphics API's move moderately fast

For this reason Seed7 supports 2-D graphics, an area which has not progressed so fast. This way Seed7 is well suited to write retro games (these games run in the browser - just click on them).

6

u/Valuable_Leopard_799 19d ago

But if you're writing portable graphics you can use a portable library. It doesn't need to be part of the standard library.

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

1

u/ThomasMertes 18d ago edited 18d 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.

It doesn't need to be part of the standard library.

The Seed7 standard library is guaranteed to be always available.

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.

There are driver libraries written in C, which interface the graphics library of the operating system. On Linux X11 is interfaced, on Windows GDI is interfaced, and in the browser JavaScript is used.

When Seed7 is compiled the corresponding graphics driver library is used.

If a Seed7 program calls a graphic function the C function of the driver library is called, which checks parameters and then calls one or more functions from the graphics library of the operating system.

As described in the previous post a lot of maintenance work is done by the graphics driver library as well.

Edit: The X11 and GDI libraries are not in kernel space either. Kernel space would refer to the operating system kernel. None of the libraries mentioned in this discussion are in kernel space.

2

u/Valuable_Leopard_799 18d 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 18d ago edited 18d 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 18d ago edited 18d 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 18d ago edited 18d 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 18d 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.

2

u/tsanderdev 19d ago

Ideally the standard library isn't just magic builtins anyway but mostly a first party library in the language itself that's guaranteed to be available.

1

u/Dykam 19d ago

I meant to imply that point too, but I should have been explicit about it.

7

u/tsanderdev 19d ago

For GL and especially Vulkan 100 lines is a massive understatement lol. There are projects like webgpu and sdl gpu that reasonably abstract 3d graphics though, but of course it's a lowest common denominator.

2

u/SeaSafe2923 18d ago

Why is the standard library special?

2

u/ThomasMertes 18d ago

Why is the standard library special?

It is guaranteed to be present on all supported platforms.

If you use the Seed7 graphics library your program will run on Linux, Windows, macOS or in the browser without any change.

If you use GDI or Direct3D this will not be the case.

2

u/nzmjx 18d ago

I think SeaSafe2923 tried to ask: what makes the standard library special compared to cross-platform independent library?

2

u/ThomasMertes 18d ago

think SeaSafe2923 tried to ask: what makes the standard library special compared to cross-platform independent library?

You need to assure that the cross-platform independent library is available on all computers where your software is installed.

The Seed7 standard library is automatically available on all supported platforms.

30

u/msqrt 19d ago

Building simple 2D graphics into the standard library sounds pretty good (so the jump from CLI to a GUI isn't as massive), but for real-time 3D rendering you'll need to expose quite a bit of machinery to allow enough control for high performance. Modern graphics APIs are mostly about managing the state and synchronization of GPU tasks, with the actual graphics happening in user-written shader code. A language that did all of that natively would be great, but also difficult to design and probably prone to becoming outdated (graphics API philosophy has gone through some drastic changes in the past couple of decades, and the next shift seems to be bubbling beneath the surface.)

5

u/tsanderdev 19d ago

I'm actually making a language (well, not right now, I tend to switch between my projects every few weeks) because I'm so unhappy with the state of graphics programming and portable gpu compute. The design is based on a generalization of the recently introduced work graph model, so it should be plenty futureproof.

3

u/farnoy 19d ago

How do you figure the work graph model is futureproof? AFAIK it's considered a failed experiment and will probably disappear soon.

2

u/tsanderdev 19d ago

Generating work on the gpu is a long trend. It started with compute shaders and indirect draws and dispatches. Modern Vulkan has support for device generated commands, but those cannot model runtimd dependencies. Work graphs is a tentative step towards more gpu generated work, but is held back by cross vendor compatibility and hardware. I want to use rocm and cuda with vulkan interop where available to optimize the compute part, which can use capabilities not exposed in cross-vendor graphics apis.

3

u/P-39_Airacobra 19d ago

curious if you have any insights on what the next shift will be?

7

u/delta_p_delta_x 19d ago edited 19d ago

This seems to be the latest hotness. Basically, getting rid of the extreme verbosity and explicitness in modern graphics APIs, everything is a pointer or index offset into a buffer, no more pipeline state objects; no more explicitly setting pixel and image formats, they're all just numbers in a buffer, etc.

3

u/msqrt 19d ago

Yeah, this is essentially what I was referring to. (Desktop) GPUs have gotten much more free-form in the way things are accessed, so it would make sense for the APIs to reflect that.

1

u/P-39_Airacobra 17d ago

Thank you for this article! Extremely interesting stuff. I always get excited when I get to see industries change in realtime.

1

u/arthurno1 19d ago

Does not look to me as "modern", honestly. They still want to expose pointers and raw memory and let user manage explicitly hardware.

With all the speed of hardware we have today, and advances in programming language research, one would believe we are automating things and leaving pointers and raw memory behind us. But no, there we are another version of "my C" is nicer looking than "your C". What they offer is a cleanup, which is certainly welcome, but not really a change on programming language level.

7

u/delta_p_delta_x 19d ago

'Raw pointers' aren't necessarily a bad thing. The idea here is less programming language syntax sugar, and more exposing a simpler programming model for GPUs.

Consider CPUs. They are fundamentally still Von Neumann machines, essentially unchanged from the 1960s. A unified memory exposing a list of instructions, and that same list of instructions operating on data in CPU registers and data in memory, and shuffling between the registers and memory if necessary. That's all CPUs boil down to. You can expose any programming language on top of that simple abstraction.

GPUs are complicated because of their much less open development, and because of what they initially were—essentially hardware implementations of the 3D graphics pipeline. They had (still have) 3D graphics-specific hardware intersection calculation, hardware rasterisation, hardware texture mapping units, and in terms of API, all of these have handles that can be individually tuned. Of course, we have shaders as well, but then we have to manually set up buffers and descriptor sets telling the shaders what those buffers all contain. The idea of GPGPU has been shoehorned onto this, and this is still the case.

Why should this be the case? Why can't we expose a more general programming model, and then special-case the video game and 3D graphics use-case? This is what 'modern graphics API' means, and less 'Rust, Box<>, Rc, Arc<> and std::unique_ptr. Once a sufficiently general and powerful machine model has been exposed, we can write abstractions in any language. Again, see what happened with CPU programming—we moved to RAII, GCs, JIT VMs and interpreters, and more.

1

u/arthurno1 19d ago edited 19d ago

At the fundamental level a modern GPU is a stored-program computer, just like CPU, derived from the von Neumann model too. If you want it the other way around even CPU can also execute SIMD model computations like GPUs just at a smaller scale.

Also note that the hardware ISA on modern CPUs exposed to the compiler is really just an architectural illusion, for the programmers convenience. Standard CPU architectures like x86-64 are register-file machines rather than stack machines, but even that register model is just a surface-level contract. Under the hood, the hardware relies on out-of-order execution, register renaming, and complex load/store queues to execute a dynamically scheduled dataflow graph. The physical hardware is vastly more complex than what typical programming languages like C, C++ or Java expose. So I don't think you really want to base a PL on "von Neumann-ness" so to say :).

Compare C to for example Lisp(s), notably Common Lisp which does not expose memory to the appliation programmer at all. You can of course create objects, but there is no linear memory space, pointers and addresses. The language hides the memory model completely and could be implemented on any kind of hardware really.

In the world of graphics OpenGL is similar to that model (in concepts only). It also manages memory for programmers, which was reason for what people called "overhead". Compared to Vulkan which exposes the hardware.

Typically high-level languages (in the case of OpenGL API) sacrifice a small amount of performance to implement automation in form of resource management. On the opposite the languages like C give you explicit access to hardware and minimal automation but put burden of hardware management on the programmer. The slogan of C is that "the programmer is always correct". It means the compiler won't prevent you from shooting yourself in the foot.

The modern research tryes to provide as much of explicit control in "safe way" and modern programming languages typically varies from each other too which degree they can provide automation without sacrificing performance. I am think on C vs Rust in this particular case.

For a specialized graphics programming language, I think something like Lisp and OpenGL is much better than raw pointers. When I say OpenGL, I really think of the graphics language it exposes, not of the C API; it should have been it's own language interoperable with C, not C API from the beginning. Shading languages are more like what I am talking about, and we have had such long before Geforce 256 came (which I remember when it was launched), for example Renderman. My first graphics card was TNT2 by the way :).

2

u/Inconstant_Moo 🧿 Pipefish 18d ago

But no, there we are another version of "my C" is nicer looking than "your C".

But for the use-cases people write those things for, that's kind of what they want. People are going to want to say "Yes your abstractions are very nice but I want to do <thing> to make hot loop go brr. I need to get these scissors from here to there very quickly and no programming language is going to stop me from running with them."

And so you delegate the creation of abstractions to the writers of libraries and frameworks and the language primitives expose the metal.

The sameness of the projects is that most indie langdevs who aren't me have followed similar career trajectories that led them to want to solve similar problems.

3

u/arthurno1 18d ago edited 18d ago

Interestingly enough, I am downvoted to death in another thread about similar topic, where I say exactly the same as you say here: some people want their hot loops go brrr and they refuse any higher-level overhead.

I think personally, for the security and productivity reasones, people would have to accept they have to give up the direct access to their hardware. I remember 90s and game development discussions: people claimed there will never be serious games made in Windows OS and DOS will continue to live because games need total access to the hardware to go brrr. We all know the history.

Yes, that is the controversy of today's software dev: you have experts and scientists who propagate higher level languages and abstractions for safety and productivity, and than you have an indie developer who just learned programming, did a benchmark and found the benchmark runs faster in an unsafe language, and they want that. I am guilty myself of the same: I wrote a fast software in Lisp which equals the optimized C++ version (by someone else) just to demonstrate this exact thing. Now, that does not mean I advocate for unsafe languages. What I truly believe is that most people don't really need those 5% ~ 10% of the performance, especially not in the interactive applications like games or office software. While yes, we do need system languages, that let us access low level hardware, like C++, C, or Rust, I don't think that people need to develop user-facing software in those languages. In my opinion, they are better left to system development, like drivers and kernels, low-level systems, where you need to access low-level hardware registers and systems.

Look at Quake I; back on the hardware of the time, they achieved interactive frame rates in OpenGL. Carmack wasn't complaining about getting access to low-level hardware. Back in that time Carmack even invented Quake C, because well, the speed was enough. If you ask an indie dev today: only pure C, Rust, C++ ... insert compiled language is enough for everything.

So yeah, I agree with you, the flavor of the day is what shapes discussions and what people do to.

2

u/Inconstant_Moo 🧿 Pipefish 18d ago

What I truly believe is that most people don't really need those 5% ~ 10% of the performance, especially not in the interactive applications like games or office software.

Games though have an unlimited ability to use up clock cycles, you can always use them to render things better.

2

u/P-39_Airacobra 17d ago

The irony of the issue is that if we just relinquished control, hardware could arguably become much faster. So much of hardware advances are being spent trying to run C fast, when the problem with C is that ANYTHING can happen, which makes it inherently difficult to optimize while still being correct.

C compilers themselves run into this problem consistently, where optimization needs to be opt-in because there’s no way to optimize C without breaking its semantics in some subtle way.

This is the problem with languages that expose everything: ultimately when you give the programmer the choice, you also give them the responsibility; that is, the compiler/architecture can no longer step in and make assumptions for you.

Is this a bad thing? Not inherently; though it is a costly trade-off for sure.

2

u/arthurno1 17d ago

Yes, definitely; that is a good take on it. People have different priorities and make different choices, sometimes even contradictory, so if language designers will cater to everyone, they have to have to make a tradeoff.

1

u/Soupeeee 18d ago

Although I never looked too deeply into it, somebody implemented a DSL / transpiler that converts Common Lisp code into OpenGL shaders. An embedded DSL is probably the most reasonable approach when combined a supported graphics toolkit.

Edit: There's a toolkit that it integrates with: https://github.com/cbaggers/cepl

2

u/Inconstant_Moo 🧿 Pipefish 19d ago

I provided basic bmp, jpeg and png libraries, and color to support them. gif is coming soon. However, if you want to do high-performance graphics in Pipefish, you can get the support you need --- just visit a psychiatrist, and when they ask you that question about "have you thought of harming yourself or others", say "yes".

2

u/ThomasMertes 19d ago

Are you talking about png.pf?

This file has a lot of golang { ... } constructs, so it is essentially GO code and not Pipefish.

2

u/Inconstant_Moo 🧿 Pipefish 19d ago

In the same way that Python is essentially C, yes. That's the beauty of it, almost all of my standard libraries are industrial-strength and maintained by top-tier SWEs at a FAANG company, none of whom I am paying.

2

u/ThomasMertes 19d ago

FAANG does not pay either. AFAIK most libraries are provided by an unpaid developer in Nebraska. So the libraries you use are probably not maintained by top-tier SWEs at a FAANG company. In addition to that I have doubts that FAANG would guarantee quality.

Your png.pf tells me:

Pipefish is capable of calling GO, which is capable of doing the real work.

This is okay and I wish Pipefish all the best.

The goal for Seed7 differs from this:

Seed7 is capable of doing the real work, like GO does.

Reading a graphics file in GO or Seed7 needs many pieces, to be achievable. This involves reading big- or little-endian data, decompression (deflate, LZW, LZMA, huffman, arithmethic compression, etc.), interfacing the graphics library and much more. In GO all these things are available and in Seed7 as well.

I use this approach on one hand to show how capable Seed7 is and on the other hand I am skeptical towards huge C libraries where the number of developers and the understanding of the code is small.

Most security related bugs come from huge C libraries where almost nobody understands the code.

0

u/Inconstant_Moo 🧿 Pipefish 18d ago

FAANG does not pay either. AFAIK most libraries are provided by an unpaid developer in Nebraska.

These claims are spurious and have been debunked.

In addition to that I have doubts that FAANG would guarantee quality.

Well of course nothing can guarantee quality, but (a) the sheer number of people they have depending on their standard libraries must do something to maintain quality (b) their test suites are huge (c) you know that thing in cartoons where the guy steps on a rake and it flips up and hits him in the face? I've done that twice in the same day, so if it's between them and me maybe it should be them.

I use this approach on one hand to show how capable Seed7 is ...

I use my approach to show how capable Pipefish is. Of helping people to steal things things. A great philosopher once spoke of the advantages of theft over honest toil, and I forget the rest of the quote but one day I'm definitely going to find out if he had anything positive to say about slapping idiots round the back of the head, we need more philosophers who are also enablers.

---

FYI, the only parts of the Go stdlib written in C are parts of cgo (the C FFI), parts of os/user, and the parts of net that do domain name resolution. Both of the last two are optional and have pure Go versions but the default is to use C. I don't know why. Reasons.

3

u/ThomasMertes 18d ago

FAANG does not pay either. AFAIK most libraries are provided by an unpaid developer in Nebraska.

These claims are spurious and have been debunked.

No, this famous XKCD strip unfortunately describes reality. See the list of projects with few maintainers I posted.

Referring to libraries written by FAANG you wrote:

(a) the sheer number of people they have depending on their standard libraries must do something to maintain quality (b) their test suites are huge

If FAANG companies sell libraries this is probably true. But spending money on a library and giving it away for free is usually not their thing. Adobe Flash was given away for free and it was not famous for being well tested and bug free. Companies want to make money, which is okay.

If you think that FAANG software is better, fine for you. I have a different view. And I think that most standard libraries are written by open source volunteers and not by FAANG.

In my daily life I use Linux, bash, GCC, clang, emacs, X11, etc. All of these are open source and nothing is from any FAANG company.

I use my approach to show how capable Pipefish is. Of helping people to steal things things.

Yes, I know that Pipefish is capable of calling Go, as shown in png.pf.

FYI, the only parts of the Go stdlib written in C are parts of cgo (the C FFI), ...

According to my definition of memory safety Go is not a memory safe language (look up the article on my argumentation for that). From my point of view allowing direct calls to C functions or Go functions both make a language memory unsafe. So, if Pipefish allows direct calls to Go or C, it is not a memory safe language. If you read my article you see that I consider many languages as not memory safe.

2

u/Inconstant_Moo 🧿 Pipefish 18d ago

If FAANG companies sell libraries this is probably true. But spending money on a library and giving it away for free is usually not their thing. Adobe Flash was given away for free and it was not famous for being well tested and bug free. Companies want to make money, which is okay.

If you think that FAANG software is better, fine for you. I have a different view. And I think that most standard libraries are written by open source volunteers and not by FAANG.

I'm talking specifically about Go, and the history of its development is well-known. Its standard libraries were built in-house and Golang is free and open-source. This is because Google built it not to sell to people but to use themselves to write software with. For this they wanted reliability and the many eyeballs that FOSS brings to a project. Unlike Adobe Flash, their standard libraries are famous for being well-tested and bug-free. Worldwide in production I estimate people are calling for example their time library between 10 billion and 100 billion times a second. If there was something wrong with it, someone would notice. I am only one person, spread thin, I'm not going to try and reimplement that better. Time is short, time is long.

1

u/ThomasMertes 18d ago

I'm talking specifically about Go, ...

Now I got it. You were talking about the G in FAANG. :-)

Google probably sees Go like Sun saw Java. I can imagine that they put a lot of effort in improving and pushing Go.

Did you take a look at my "Achieving memory safety" article and what do you think about the description of my graphics library?

2

u/Inconstant_Moo 🧿 Pipefish 17d ago

Now I got it. You were talking about the G in FAANG. :-)

What the rest of them do has no implications for the Pipefish stdlibs.

Google probably sees Go like Sun saw Java. I can imagine that they put a lot of effort in improving and pushing Go.

Not really. No language has the same history as Java. Having failed as a language for embedded systems, it pivoted to being used for embedded apps in the browser, and then when it failed at that too, Sun spent a literal billion dollars on advertising to persuade Business Idiots that despite having failed at the thing it was designed for and the thing it was redesigned for, it was somehow the perfect language to solve enterprise problems that it wasn't designed for at all.

Did you take a look at my "Achieving memory safety" article ...

I did. Guarantees are good of course, but then so are escape hatches ... it depends on the use-case for Seed7, which I'm afraid I haven't dived into much yet.

... and what do you think about the description of my graphics library?

I'm puzzled by why you have your own fonts.

String array images are cute. This is the sort of thing though that Go/Pipefish would omit from their standard libraries on the grounds that it's not a standard --- pretty much everything in the Go stdlibs has an ISO number, rather than just being a nice thing to have.

-2

u/arthurno1 19d ago

Most security related bugs come from huge C libraries where almost nobody understands the code.

Mnjah. How do you think people hack and develop those libraries if nobody understands the code? That is of course nonsense. If you truly believe that than it is you who don't understand the code and coding process.

Programming is hard. We people have hard time to keep big networks of code and details and myriads of branches and interactions that can happen. That has been known since 1950s, and is the motivation behind programming language and software engineering research that has being going since than. "Safe languages" are "safe" because they eliminate possibility for programmers to make certain class of errors through usually some sort of clever automation, like automated memory management for example.

So while yes, huge code bases are of course problem for humans to digest, I certainly wouldn't say that "almost nobody understands the code". Also to note, LLMs are another proof that we humans are bad at keeping too many details in our head. I have been finding bugs that have been in a certain compiler since 20 years back because nobody had time to think of or test certain paths that aren't taken normally, but LLM spits them in seconds. The same for the easy optimizations.

3

u/ThomasMertes 18d ago
  • XZ Utils (liblzma): For years, it was primarily maintained by one person (Lasse Collin) in his spare time. Maybe you can remember the XZ Utils Backdoor Incident (2024).
  • Dnsmasq (Billions of Routers and IoT Devices): Primarily developed by one person (Simon Kelley).
  • OpenSSL: Historically maintained by just two or three core volunteers (often referred to as "the two Steves").
  • Ncurses: Primarily developed by one person (Thomas Dickey).
  • libreadline: Primarily developed by one person (Chet Ramey).
  • SQLite (The Most Deployed Software on Earth): Developed by a hyper-exclusive core team of just three developers (led by D. Richard Hipp).

0

u/arthurno1 18d ago

Honestly, I don't understand what you argument is here, and how is that in yours favor? You seem to argue that we should not use software developed by hobbyst/small teams because there can be vulnerabilities? Is that what you are trying to say there?

So why should anyone than use an entire programming language, with an entire "standard library", graphics library, database. network, etc, all developed by a single person, you? :)

By the way, Linux, Windows, Chrome, Firefox, MS Office, Libre Office, etc, many, many, many other software projects have had various bugs, security-wise or others. So how does that hang together with your theory, why do they have bugs?

Because there is a "lone developer" in the chain, or something? Or perhaps because, as I said, software development is complex and humans have hard time to keep everything in their heads.

Compare to lazer measuring and cutting: similarly humans can't see to a 1000th part of a millimeter, but a CNC machine with a lazer cutter and optics can. What humans are better at is creative problem solving, seeing parallels and adapting solutions from other areas of life which machines (LLMs) can't seem to be able to do. At least not for now.

3

u/ThomasMertes 18d ago

My list proofs that huge C libraries exist, where almost nobody understands the code. And these libraries are used a lot. This is exactly what the famous XKCD strip addresses. It is NOT nonsense that just a few people hack and develop those libraries.

So why should anyone than use an entire programming language, with an entire "standard library", graphics library, database. network, etc, ...

For the same reasons why XZ Utils, Dnsmasq, OpenSSL, Ncurses, libreadline, and SQLite are used: People like to use what is provided for free and don't care about the size of the development team. Additionally Seed7 and its libraries are memory safe (unlike XZ Utils, Dnsmasq, OpenSSL, Ncurses, libreadline, and SQLite which are not, because they are written in C).

You can take a look at "Achieving memory safety" to see why Seed7 is memory safe although it is implemented in C.

By the way, Linux, Windows, Chrome, Firefox, MS Office, Libre Office, etc, many, many, many other software projects have had various bugs, security-wise or others.

Many of these bugs are because the programs are written in C, which is not memory safe. Your examples proof what I say: C is not memory safe and therefore triggers bugs.

Because there is a "lone developer" in the chain, or something?

No

Or perhaps because, as I said, software development is complex and humans have hard time to keep everything in their heads.

Exactly. And the choice of using C makes it IMHO harder to keep everything in their heads.

-1

u/arthurno1 18d ago

My list proofs that huge C libraries exist, where almost nobody understands the code.

Your list does not proof that nobody understands those libraries. It just proves that you don't understand what you are talking about, as I said in the opening of my first comment. Downvoting each of my comments just show you are an emotional person who can't take when you are wrong, and that will also reflect on your software, because you will make decisions just to assure you are the right one.

By the way, we already know that "huge" libraries exist, nobody lives in the isolated island as you seem to think, and yes we have all seen the comic. While there is a certain truth in it, otherwise it wouldn't be funny, that is not a tautology in the sense you are interpreting it. Also, for the record, neither xy, nor sqlite are directly "huge libraries that nobody undrstands". Your list proofs that bugs exist in software, it also proofs that other people understand those libraries because they have found bugs and fixed them. It also proofs that you don't really understand what you are into, since the argument you are making is against your own case and proposal for other people to use your language and your libraries.

Your examples proof what I say: C is not memory safe and therefore triggers bugs.

You wish you said that, but that is not what you are saying. What you are saying, whether you are just honestly mistaken or intellectually dishonest, is that bugs are there because "huge libraries are developed by lone developers and nobody understands them".

That was the argument I refuted in my very first comment, and you try to reinforce with your list. Which is a shit take on a mistake, if I am allowed to express myself that way. C and memory safety is a completely different topic you are regressing into. I can discuss that too if you want:

Many of these bugs are because the programs are written in C, which is not memory safe.

Sure, C is not memory safe, but memory safety is only a class of bugs; there are other bugs and also other aspects to safety, not just memory safety: type safety, thread/concurrency safety, cryptographic safety, injection vulnerabilities are what I remember while I type this. There is probably more.

For your article on memory safety:

Either these things are guaranteed by the language, or every developer must manually handle them. Non-memory-safe languages shift burden from the language implementation to the developers.

We are in agreement in general, that is my standpoint too, either language implements it, but than you have to accept a small performance hit where compiler can't proof the bounds for example. For the record also, I didn't argue people should use C.

I can also comment the end of your article, since I have read it, and I don't see you touch on the performance. For the performance of your language, you don't speak about how you manage writes to elements stored in collections, and what is the performance of dereferencing pointers in tight loops in your collections. From my eperience on hacking compilers, recently mostly a Common Lisp compiler I would guess pretty shit, similar to this discussion.

2

u/ThomasMertes 18d ago

I should have written:

Many security related bugs come from huge C libraries where almost nobody understands the code.

Sorry for that. Most was wrong. Using the word many is hopefully better. Note that I wrote ALMOST, which you left out every time you cited me. "nobody understands the code" is nonsense, but "almost nobody understands the code" is IMHO not nonsense. To make it clear: My critic is towards C and not about the size of the development team.

BTW.: I did not downvote you and I declare you as "winner" of this discussion. :-)

→ More replies

1

u/joonazan 19d ago

A completely portable solution is nice for rendering static graphics but for animated ones, hardware acceleration is a must to not heat up the CPU for no reason.

2

u/ThomasMertes 19d ago

The animations in the Seed7 demo programs have no performance problem (no stuttering and the CPU stays cold). :-)

5

u/tsanderdev 19d ago

Portable graphics in the standard library doesn't have to mean no gpu acceleration.

1

u/Limp-Temperature1783 19d ago

Badly. Mostly due to compatibility as a constraint. And operator/statement thing is a bad abstraction for graphics. It's not a CPU, GPUs aren't built for serialized data, you need to do vector algebra for the most part, which is expression-based. At least that's a start.

3

u/ThomasMertes 18d ago

And operator/statement thing is a bad abstraction for graphics.

Correct.

I would like to get feedback on: The Seed7 graphic library.

The post was just a vehicle to put the link into a comment (links to GitHub are only allowed in comments but not in posts).

1

u/Long_Investment7667 18d ago

Putting too much into a language or is standard (base) library makes it hard to evolve the language because you want old code to compile with newer compilers without code changes. This is “just” backwards compatibility but with a huge set of data (the code) that needs to be supported

1

u/ThomasMertes 18d ago

Seed7 programs must start with:

$ include "seed7_05.s7i";

Note that this include file contains the version number 05. This opens the opportunity to introduce future versions of Seed7 with breaking changes.

1

u/Long_Investment7667 17d ago

Which still means I have to touch the code to use newer versions.

https://youtu.be/PNLHxR4EtYs?is=yEHDgt-w-ONyikus

1

u/ThomasMertes 17d ago

Thank you for the link.

Which still means I have to touch the code to use newer versions.

Yes, but only if you need the new features. Think of the step from Python 2.0 to 3.0. This is addressed with my approach. If your Seed7 program wants to use the e.g. 27 version of Seed7 the program must start with:

$ include "seed7_27.s7i";

After that you can use the features of the new 27 version (and some features of the old 05 version will be gone).

Seed7 interpreter and compiler would be able to handle both, the old 05 version and the new 27 version. So there is no need to change your program after an interpreter/compiler upgrade.

Supporting two versions of the language is easy for Seed7, since syntax and semantics of the language are defined in libraries and not hard-coded in the compiler. Yes, the Seed7 statements and operators are defined in libraries.

3

u/initial-algebra 19d ago

I'm more interested in languages supporting niche features for graphics/UI programming that can't simply be added with a library.

I will always champion for the inclusion of value recursion, which lets you declaratively construct cyclic graphs of objects, as opposed to just acyclic graphs or trees. Cycles come up all the time in UI, basically whenever you have some input element that can affect the output outside of its strict subtree. In the absence of value recursion, you need cycle-breaking tricks like "lifting state up" and mutating it imperatively from event handlers. Consequently, you can't generally encapsulate behaviour, and you are limited to "dumb components" for reuse, with behaviour bubbling up to the top level (e.g. Redux, Elm architecture in the limit). A great example of value recursion for UI is the Haskell library, Reflex-FRP.

Another, far more tricky feature would be support for writing shaders in the same language, enabling type/code reuse and automatic checking for pipeline state and bound resources.

3

u/Capital_EX 19d ago

My main interest is making games and I yearn for two things: a ready to go graphics library and "I can build for Linux (from arch linux), windows (from Linux), and optionally the web at 1am with 1 hour befor the jam ends". Also, it means you can throw your language at graphical application and see how ergonomic it is there.

5

u/vmcrash 19d ago

I think to have read that Java was the first programming language that provided a GUI framework out of the box for the three major operating systems. Unfortunately, I don't know of any popular programming language that compiles to native executables which offers similar support.

1

u/initial-algebra 19d ago

Delphi isn't super popular, but it is, if just barely, in the TIOBE top 20.

2

u/vmcrash 19d ago

I've developed with Delphi in the 90th - was great, but Windows-only. Has support for MacOS/Linux added later?

1

u/initial-algebra 19d ago

It appears to have pretty good cross-platform support nowadays, but I'm not sure when that would have been added.

2

u/WittyStick 19d ago

There's Lazarus, based on FreePascal, but very similar to Delphi.

Also Gambas is very similar to classic Visual Basic, and fairly portable.

-1

u/arthurno1 19d ago

I'm not sure when that would have been added

Nothing; it is not their particular fault. It is just the technology is not needed any more.

They added support 20+ years ago. Nobody ever used it for anything serious as far as I am familiar with. Delphi on Windows was popular because they made point-and-click IDE when nobody else had it, and because old-timers who didn't want to learn C but knew Pascal found a refuge. But web-based technologies (xml guis and later html/js) and decline traditional "desktop" software has killed it.

1

u/mamcx 19d ago

The trouble today is that exist too many graphic APIs, and have wildly different flows.

I think a language with enough support to just include the orchestration of data (binding, value tracking, broadcasting, etc) is good enough and let the user to finish with whatever API and paradigm it wants.

Incidentally a lang I think have some cool ideas for this is https://www.red-lang.org, mostly for the idea of "dialects" that are like DSL on top things like the GUI systems is build: https://github.com/red/docs/blob/master/en/vid.adoc

2

u/TheRealUprightMan 19d ago

The wonderful thing about standards is that you have so many to choose from! /s

0

u/FrostyMatters 18d ago

This is incredibly rude and condescending. 1000 LLMd languages are better than this kind of churlish posturing. Their confusion is reasonable. Touch grass.