Proposal: Add a dynamic
and/or void
type
#2076
Labels
leads question
A question for the leads team
long term
Issues expected to take over 90 days to resolve.
Dynamic typing is extremely powerful for data science and machine learning. Since this language will have a competitive performance to C++, it makes sense to me that future ML libraries may be written in Carbon for use in Python or standalone, especially for an embedded model akin to TF lite. Dynamic (or even duck typing, at minimum) is very helpful for rapidly writing generic code, such as for data structures, scientific models, and databases such as OLAP cubes.
C# performs this using the
dynamic
data type, as well as in Rust, allowing for the same type-flexibility as Python without the performance decrease from runtime-interpreted type inference. This is also easily done in C/C++ using thevoid*
type pointer:C++ also has the
variant
type which is similar, D hasjsvar
to enable JS-like dynamic typing, and Golang'sinterface
type is nearly flexible enough almost to make it useable, falling just short.In Carbon, this could look something like:
This would be great for working with embedded systems and interop with C/C++, and it's something I use on a near-daily basis, personally.
The text was updated successfully, but these errors were encountered: