Re:Py2cr: A Python3 to Crystal Translator
by sitapati on Sunday December 26, 2021 @09:52PM
(#29698594)
Epic! But... why?
[ Parent
| on HN ]
Crystal is supposed to be fast, and type safe, with an easy syntax. This might help people try it, because they still can fall back on python, and get hooked.
Re:Py2cr: A Python3 to Crystal Translator
by KarlKemp on Monday December 27, 2021 @05:48AM
(#29701339)
It is insanely fast. Some text munging python script once told me it would take 14 hours. I ported it to Crystal in 40 minutes, and it completed ten minutes later.
I've only looked at it, but that is a good story to convert Python programmers.
Re:Py2cr: A Python3 to Crystal Translator
by KarlKemp on Monday December 27, 2021 @08:08AM
(#29702179)
To be fair, there are lots of tricks to get stuff moving faster in Python, usually by invoking some module that delegates to native code. This was, IIRC, doing everything in the most straightforward way. But I did port the source code essentially line-by-line and this was within the first week of using Crystal. Any grave (i. e. measurable in O-notation) errors would have just carried over, and no sophistication was involved in my Crystal code.
Re:Py2cr: A Python3 to Crystal Translator
by ziotom78 on Monday December 27, 2021 @02:12AM
(#29700232)
As other have suggested, this could be a great way to port some of Python's huge ecosystem to Crystal.
Re:Py2cr: A Python3 to Crystal Translator
by nanobowers on Monday December 27, 2021 @03:35PM
(#29706501)
Yeah, that's the thought - reduce the friction for converting Python to Crystal. I wouldn't expect many non-trivial programs to work out of the box, but if this tool reduces the time needed to port something, it's served its purpose.