Добрый доктор Айболит спешит избавить вас от обсёров в сишном коде. На этот раз речь не про революционно новый ЯП типа раста, а про критическое осмысление сишки и плюсов. По пунктам:
- TrapC memory management is automatic, cannot memory leak, with pointers lifetime-managed not garbage collected
- TrapC pointers may look the same as in C/C++, but all pointers are diligently compiler-managed and memory safe
- TrapC pointers have Run-Time Type Information (RTTI), with typeof(), nameof() and other details accessible
- TrapC reuses a few code safety features from C++, notably member functions, constructors, destructors and ‘new’
- TrapC adds 2 keywords unique to TrapC: ‘trap’ (error handling) and ‘alias’ (operator, function and data overloading)
- TrapC removes 2 keywords: ‘goto’ and ‘union’, as unsafe and having been widely deprecated from use
- TrapC uses castplates to make C containers typesafe, without the complexity of C++ templates
- TrapC printf() and scanf() are typesafe, overloadable, and have JSON and localization support built in
- TrapC has an integer-based ‘decimal’ fixed-point data type suitable for use in financial transactions
- TrapC is one-way ABI compatible with C, such that TrapC functions may call any C function as-is
- Passing a raw C pointer safely to a TrapC function requires extra steps, because TrapC pointers have hidden RTTI
- TrapC has API-compatible versions of C POSIX and C++ STL standard libraries, to not return raw pointers
- TrapC doesn’t do more than C for thread safety to prevent race conditions, but may in the future
соотв. уайтпейпер, откуда это взято:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3423.pdf
Давление на общество очень выскокое:
The NSA, the FBI, the White House, Five Eyes and other government agencies have declared that the lack of memory safety in C and C++
вот так, не хухры-мухры.
Какова вероятность, что такой диалект сишки добавят в gcc, люди станут портировать опенсорс софт на него, ведущие дистры станут собирать им свои пакеты, и традиционная сишка останется только в самом дремучем легаси и примитивном эмбеде?