4 ms·
> Since Swift is implemented in C++, no doubt that's why it's not a reality in that new language either. The language the compiler is implemented in doesn't ma
by legulere 11y ago
> Since Swift is implemented in C++, no doubt that's why it's not a reality in that new language either.
The language the compiler is implemented in doesn't matter, so I guess you mean that it's not possible because Swift is too heavily influenced by C++? I don't think that this is really the case, it's more influenced by Objective-C
- deleted 11y ago[deleted]
- scott_s 11y agoThe language used to implement the compiler and runtime system for a new language has no impact on what is possible in the new language. If the implementation language does not natively support something you want in the new language, you can just implement that yourself, and it is then available to the new language. For example, C does not natively support garbage collection, but Python certainly does. The most popular Python implementation is implemented in C.
- hellofunk 11y agoThanks for pointing that out. I'm not a language or compiler engineer so my sight wasn't big enough. I tend to think of a new language as a gigantic library sitting on top of another language, and just assumed that if the base language can't handle something like a persistent data structure, then the new language would struggle with that as well.
- kazagistar 11y agoThat is almost never an accurate way to think about it.
- dkersten 11y agoOnly a very small handful of languages are actually implemented like this. Its worth also pointing out that some languages that compile to C, still support features that C does not (for example, Chicken Scheme compiles to C and supports both garbage collection and continuations, neither of which C supports natively).
- masklinn 11y ago> for example, Chicken Scheme compiles to C and supports both garbage collection and continuations, neither of which C supports natively And GHC still allows compiling Haskell (lazy, functional, garbage-collected) via C (eager, procedural, manually managed).
- autoreleasepool 11y ago> I tend to think of a new language as a gigantic library sitting on top of another language That's a bad default assumption
- thinkpad20 11y ago> it is about what is possible in the language based on how it is implemented (which is C++) What is possible to express in a language is determined by its specification, not its implementation. Of course, it's up to the implementor to correctly adhere to the spec, but this is also independent of language choice. It's certainly possible, and has been done, to implement a language with GC, TCO, lazy evaluation, purity, etc etc, in a language like C++ which has none of those things. For example, the nix language, which has all of those things except TCO (which it certainly could have in theory) is implemented in C++.