This is targeting a Python subset, not Python itself.
For example, something as simple as this will not compile, because lists cannot mix types in Codon (https://docs.exaloop.io/codon/language/collections#strong-ty...):
l = [1, 's']
It's confusing to call this a "Python compiler" when the constraints it imposes pretty fundamentally change the nature of the language.type Json = None | bool | float | str | dict[str, Json] | list[Json]
you might have similar situations for configs e.g. float | str for time in seconds or a human readable time string like "30s" etc.
given how fundamental such things are I'm not sure if there will be any larger projects (especially wrt. web servers and similar) which are compatible with this
also many commonly used features for libraries/classes etc. are not very likely to work (but idk. for sure, they just are very dynamic in nature)
so IMHO this seems to be more like a python-like language you can use for idk. some since computations and similar then a general purpose faster python
Whether that's a feature is hard to say. Your language stopped you thinking in those terms, and stopped your colleagues from doing so. Did it force clarity of thought or awkward contortions in the implementation? Tends to depend on the domain.
> Dictionaries: Codon's dictionary type does not preserve insertion order, unlike Python's as of 3.6.
That's a gratuitous break. Nothing about preserving insertion order interferes with compilation, AOT or otherwise. The authors of Codon broke dict ordering because they felt like it, not because they had to.
At least Mojo merely claims to be Python-like. Unlike Codon, it doesn't claim to be Python then note in the fine print that it doesn't uphold Python contractual language semantics.
Obviously they didn’t do that. There are trade-offs when preserving dictionary ordering.
> high-performance Python implementation
then no this aren't trade-offs but breaking the standard without it truly being necessary
most important this will break code in a subtle and potentially very surprising way
they could just claim they are python like and then no one would hold them for not keeping to the standard
but if you are misleading about your product people will find offense even if it isn't intentionally
They may be in the current implementations, but removing an implementation constraint can only increase the solution space, so it cannot make the best implementation slower.
As a trivial example, the current implementation that guarantees iteration happens in insertion order also is a valid implementation for a spec that does not require that guarantee.
If lang is not compatible with any of python versions, then the lang isn’t python.
False advertising is not nice. (even if the fineprint clarifies)
They don't even mention the changes to `list`.
> Integers: Codon's int is a 64-bit signed integer, whereas Python's (after version 3) can be arbitrarily large. However Codon does support larger integers via Int[N] where N is the bit width.
> Strings: Codon currently uses ASCII strings unlike Python's unicode strings.
> Dictionaries: Codon's dictionary type does not preserve insertion order, unlike Python's as of 3.6.
> Tuples: Since tuples compile down to structs, tuple lengths must be known at compile time, meaning you can't convert an arbitrarily-sized list to a tuple, for instance.
https://docs.exaloop.io/codon/general/differences
Pretty sure this means the following doesn't work either:
config = { "name": "John Doe", "age": 32 }
Note: It looks like you can get around this via Python interop, but that further supports the point that this isn't really Python.wtf this is a supper big issue making this basically unusable for anything handling text (and potentially even just fixed indents, if you aren't limited to EU+US having non us-ascii idents in code or text is common, i.e. while EU companies most times code in english this is much less likely in Asia, especially China and Japan.
it isn't even really a performance benefit compared to utf-8 as utf-8 only using us-ascii letters _is_ us-ascii and you don't have to use unicode aware string operations
I can say one thing - Shedskin compiles to C++, which was very compelling to me for integrating into existing C++ products. Actually another thing too, Shedskin is Open Source under GPLv3. (Like GCC.)
I hope it is released under a truly open-source license in the future; this seems like a promising technology. I'm also wondering how it would match C++ performance if it is still garbage collected.
The Business Source License (BSL) 1.1 is a software license created by MariaDB Corporation. It's designed as a middle ground between fully open-source licenses and traditional proprietary software licenses. It's kind of neat because it's a parameteric license, in that you can change some parameters while leaving the text of the license unchanged.
For codon, the "Change Date" is 2028-03-01 and the "Change License" is "Apache License, Version 2.0", meaning that the license will change to Apache2 in March of 2028. Until then, I guess you need to make a deal with Exaloop to use codon in production.
[1] https://github.com/exaloop/codon?tab=License-1-ov-file#readm...
Any relation? Any comparisons?
Funny I can't find the license for graalvm python in their docs [2]. That could be a differentiator.
- [1] GraalVM Python on HN https://news.ycombinator.com/item?id=41570708
- [2] GraalVM Python site https://www.graalvm.org/python/
- [3] HN Dec 2022 https://news.ycombinator.com/item?id=33908576
https://ep2024.europython.eu/session/spy-static-python-lang-...
https://ep2024.europython.eu/session/how-to-build-a-python-t...
(The talks were fantastic but they have yet to upload the recordings to YouTube.)
It’s not surprising that you can make a static compiler that makes tiny little programs written in a dynamic language into fast executables.
The hard part is making that scale to >=10,000 LoC programs. I dunno which static reasoning approaches codon uses, but all the ones I’m familiar with fall apart when you try to scale to large code.
That’s why JS benchmarking focused on larger and larger programs over time. Even the small programs that JS JIT writers use tend to have a lot of subtle idioms that break static reasoning, to model what happens in larger programs.
If you want to get in the business of making dynamic languages fast then the best advice I can give you is don’t use any of the benchmarks that these folks cite for your perf tuning. If you really do have to start with small programs then something like Richards or deltablue are ok, but you’ll want to diversify to larger programs if you really want to keep it real.
(Source: I was a combatant in the JS perf wars for a decade as a webkitten.)
> Strings: Codon currently uses ASCII strings unlike Python's unicode strings.
That seems really odd to me. Who would use a framework nowadays that doesn't support unicode?
From a quick glance this seems to genuinely translate into native execution.
[1] https://cython.readthedocs.io/en/stable/src/tutorial/embeddi...
They note the following [0]:
> The GPU module is under active development. APIs and semantics might change between Codon releases.
The thing is, based on the current syntax and semantics I see, it’ll almost certainly need to change to support non-NVIDIA devices, so I think it might be a better idea to just go with WebGPU compute pipelines sooner rather than later.
Just my two pennies…
[0]: https://docs.exaloop.io/codon/advanced/gpu
[1]: https://www.w3.org/TR/webgpu
[2]: https://wgpu.rs
WebGPU while stating compute is within their design I would imagine is focused on presentation/rendering and probably not on large demanding workloads.