Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm the founder at Distelli and I just want to add a quick bit of background around the original python decision (2.6 vs 2.4) as well as the decision to "rewrite in Lua".

1. I started the company as a single founder and wrote the first version of the agent. See this HN post that gave me the encouragement to keep going (thanks HN!) - https://news.ycombinator.com/item?id=6059481.

2. I wrote the original agent in python 2.6. It was great because I could use things like python-requests (which was awesome!). However my first encounter with an enterprise customer showed me that was not feasible because they were running only python 2.4 and would not be upgrading for another 2 years.

3. I had the choice of either not getting the customer or back porting the code to Python 2.4. I chose to back port the code to python 2.4 and get the customer. This was a lot of work but worth it because I was able to then raise a round with a16z. - https://www.distelli.com/blog/distelli-series-a-funding

4. When Brian joined Distelli, he actually worked on the Python code for many months and made many improvements and added many features. When it was time to add the streaming logs feature he built the prototype in Lua just to prove that the idea would work and then we talked extensively to figure the direction we should go in.

5. We decided to move to Lua because Brian was very familiar with it and it was a lightweight language and we could ship a single download with zero dependencies. We also looked at using Go. At the end of the day the decision was Brian's to make and own as the senior engineer on the project. The passage of time has convinced me that was the right decision.

I'm sure we could have stayed with Python with all the suggestions on this page, but we decided to go with Lua. It was a good fit for what we needed and honestly I felt that my original code was not in great shape and would need a lot of work to refactor and a rewrite felt like the right decision at the time. Looking back I still think it was the right decision and I'm very happy with the end result.

edit: grammar



I have been programming Python by day and Lua by night my entire career for the past 7 years, and I find the main difference between the two is, Python has the overwhelming advantage in its package manager providing ease of access to thousands of packages[1], and Lua is faster and lighter by a constant factor. In your case, Python's package system is a disadvantage - you want to have as few dependencies as possible.

I think your company made a good decision. The only reason not to have done it was because your existing code was valuable, but as you've said it wasn't in great shape and required tons of work to refactor and rewriting anyway.

[1] Lua has LuaRocks, but it's just not the same.


I looked at Lua briefly, but the immediate impression I got was that Python gives you more help in avoiding errors. In Lua, you might be bitten by:

* variable name typos (undeclared vars are nil),

* accidentally confusing array-style tables and hash-style tables (or vice versa),

* tables with "holes" (nils) in them,

* multiple assignment with wrong number of vals or vars (mismatch silently ignored),

* variables are global by default.

Have you found this to be the case at all? Is it more difficult to avoid bugs when writing in Lua?


Have you found this to be the case at all? Is it more difficult to avoid bugs when writing in Lua?

Good questions.

- variable name typos (undeclared vars are nil),

There's a linter to catch undeclared variables. https://github.com/mpeterv/luacheck There's also some runtime checking techniques you can use. http://www.lua.org/pil/14.2.html

- accidentally confusing array-style tables and hash-style tables (or vice versa),

I've had that happen about as often as confusing Python dictionaries returned by different types of functions. (Which is - not often enough for me to remember the last time that happened)

- tables with "holes" (nils) in them,

When I'm building a vector and I want holes, I use false to fill the holes.

- multiple assignment with wrong number of vals or vars (mismatch silently ignored),

For me, when I'm thinking about multiple assignment to function returns, it does mean having to read documentation for a library function more carefully than if I was reading the same for another language. If it's as simple as "local a, b, c = 1, 2, 3", then it's no issue.

- variables are global by default.

If I'm using linting, when I can't have global variables implicitly, then it's like C or Java where I must declared all my variables and by default they are local to the scope.

Otherwise it's just like javascript where it's best practice to always declare variables using "var".


Thanks for the feedback! Will have a look at the linter.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: