Update faq_syntax.md

This commit is contained in:
Shunsuke Shibayama 2023-02-13 00:19:46 +09:00
parent 2dae0f4be9
commit e56ba70c7d

View file

@ -1,19 +1,5 @@
# Erg design's "Why" and Answers
## Erg memory management model
Use ownership in CPython backend + Python memory management model (though circular references in Erg code will not be handled by GC [see details](./syntax/18_ownership.md/#circular-references)
Using ownership + [Perceus](https://www.microsoft.com/en-us/research/uploads/prod/2020/11/perceus-tr-v1.pdf) memory in Erg's own virtual machine (Dyne) Management model, if Erg code uses the Python API then the Erg code uses the tracking garbage collection memory management model
In LLVM, WASM backend uses ownership + [Perceus](https://www.microsoft.com/en-us/research/uploads/prod/2020/11/perceus-tr-v1.pdf) memory management model
Regardless of the backend, the difference in memory management will not need any changes to the code
__Notice__:Erg's motivation for introducing an ownership system is not for "memory management without relying on GC" like Rust.
The aim of Erg's ownership system is ``localization of mutable state''. Erg has a notion of ownership attached to mutable objects.
This is because shared mutable state is prone to bugs and even violates type safety (see [here](./syntax/type/advanced/shared.md#SharedReference)). It's a judgmental decision.
## Why are the braces around type parameters || instead of <> or []?
This is because `<>` and `[]` cause syntax conflicts.
@ -120,4 +106,4 @@ In what cases could it be said that union was wrong? One indicator is "whether t
The Erg designers decided that giving special treatment to side effects would make error messages easier to read.
Erg has a strong type system, but types don't rule everything.
If you do, you'll end up with the same fate that Java tried to rule everything with classes.
If you do, you'll end up with the same fate that Java tried to rule everything with classes.