alehander92 / Airtight

a python-like language with hindley-milner-like type system, which is compiled to c
MIT License
244 stars 9 forks source link

Can this be a better Cython? #1

Open honnibal opened 9 years ago

honnibal commented 9 years ago

I find this very interesting.

My main project, the spaCy NLP pipeline, is written in Cython. Cython's great and terrible — it's a messy language, but it allows a lot.

I've often thought what a cleaned-up version could look like, if it didn't have to maintain compatibility, and could just be its own language.

So: have you thought about generating Python extension modules with this? Really it shouldn't be so hard, I'd think.

alehander92 commented 9 years ago

What do you mean by that, generating Python extension modules from Hermetic code, or supporting some standard kind of C extension modules, that can be used from Hermetic?

frol commented 9 years ago

@alehander42 I am interested to hear about both described situations. And also what about performance? Does it improve (I hope so)?

There is also Nuitka project, that compiles Python 2/3 into shared libraries or executables via LLVM, but it bundles libpython, which is good from compatibility point of view (it compiles any valid Python 2/3 code without any problem), but performance is still limited by CPython implementation. My extra question would be: how compatible hermetic with Python 3 (it seems that it should work fine if I use static typing everywhere, but I would like to double-check)?

Carreau commented 9 years ago

What do you mean by that, generating Python extension modules from Hermetic code, or supporting some standard kind of C extension modules, that can be used from Hermetic?

I think it means generating a .so that export its function through a Python API, a bit like CFFI, so it's easy to port only part of a project to this.

datnamer commented 7 years ago

@honnibal perhaps you would be interested in the discussion here: https://github.com/python/mypy/issues/1862

zanellia commented 6 years ago

This project looks very interesting! Where can I find more info about which features are/are planned to be implemented?

alehander92 commented 6 years ago

Hey, thank you for the interest.

This project remains only a proof of concept. Attaching different type systems to a small language core(e.g. subset of Python) is very interesting, but if there are usecases for that, I'd rather implement it again in a better way making it easy to add custom type systems.

What is your usecase for it ? (Or is it just general interest?) If you want something closer to Python but with a powerful type system, you have to try Nim : it also has great metaprogramming and it's very fast. (And it's already used for some science libraries)

If you're interested in Python language experiments, I was more focused on pseudo-python which I'll probably continue develop in one way or another one day

zanellia commented 6 years ago

Just general interest, I would say. I would definitely use a high-level language from which I could generate standalone C/C++ code.

Nim looks like a great option, especially given the fact that it can generate completely standalone C code (unlike Cython-like projects). Thanks for the tip.

I was indeed having a look at pseudo-python and pseudo too. Are you still planning to implement support for C++ and support for multi-file projects?

alehander92 commented 6 years ago

Probably, when I hit a period with some more free time. However even then pseudo-python would be limited without a system to specify dependency interfaces (which would be neeeded to use native libraries with it).

Nim is excellent at interoperating with C/C++ code, so it's just way more real world ready (however depending on the usecase pseudo can still be useful with some more work)