Several things at once, without the tangles
A scheduler and threads in the standard library make concurrency simple enough for real services.
Modern programs rarely do just one thing at a time. A web service answers many requests at once; a tool can download several files at the same time. Handling several things at once — concurrency — is something a language has to take seriously.
Several tasks, one tidy model
Norscode has a scheduler and support for threads in the standard library, so that you can set several tasks going and let them run alongside each other. The point is to make the common case simple: start work that can happen independently, and gather the results when they are ready, without the code becoming a tangle.
Why it connects to safety
Concurrency is notorious for bugs that only show up now and then — two tasks meddling with the same thing at the same time. The runtime having a clear model for how tasks run and clean up after themselves makes such bugs less likely than in a world where everything shares everything freely.
Enough for services, not a research project
The goal is not to be the most advanced concurrency system in existence, but to cover what real services need: handle many requests, make several calls at once, and keep the work manageable. For the great majority of programs, that is exactly what is needed.
Concurrency made simple is not concurrency made weak. It is removing what makes it hard, so you are left with what makes it useful.
Why it is hard — and how it is made easier
The classic problem with concurrency is that two tasks meddle with the same thing at the same time: one reads a value while the other changes it, and the result becomes random. Such bugs are notorious because they only show up now and then, and vanish when you try to find them. A clear model for how tasks are started and cleaned up after makes this kind of bug less likely than in a world where everything shares everything freely.
The common case, made easy
The goal of concurrency in Norscode is to make the common case simple: set going work that can happen independently, and retrieve the results when they are ready. A web service that answers many requests at once, or a tool that makes several calls at the same time, is exactly the kind of task it is made for. You are spared from building everything from the ground up with low-level primitives.
Enough, not the most possible
Norscode does not try to be the most advanced concurrency system in existence. It covers what real services need, and keeps the code manageable along the way. For the great majority of programs, that is exactly what is needed — concurrency made simple is not concurrency made weak, but removing what makes it unnecessarily hard.
Related
- Norscode or Python?An honest comparison of two accessible languages — one where Python also comes out well.
- Norscode or Go?Two languages that value simplicity and a single deployable unit — but choose differently on syntax and security.
- Norscode or JavaScript?JavaScript is everywhere. In some areas a young language cannot compete — in others, that is exactly the point.