[HN Gopher] Pluto, a Modern Lua Dialect
___________________________________________________________________
Pluto, a Modern Lua Dialect
Author : todsacerdoti
Score : 56 points
Date : 2023-12-27 17:25 UTC (5 hours ago)
(HTM) web link (pluto-lang.org)
(TXT) w3m dump (pluto-lang.org)
| kwertyoowiyop wrote:
| The landing page ought to show some examples of the differences
| between Lua and Pluto.
| cglong wrote:
| Agreed, and even browsing the docs, it's hard for someone not
| intimately familiar with Lua to discern the differences.
| jadodev wrote:
| Direct link to all the new features: https://pluto-
| lang.org/docs/category/new-features
| trynumber9 wrote:
| I genuinely think adding "classes, class inheritance" to Lua is a
| downgrade. There are many different systems, which you'll still
| encounter when using other Lua libraries anyway. Why add another?
|
| Requiring C++17 to build is also a downgrade.
|
| The lambda shorthand looks fine. Typing might be useful. But it
| says that's WIP so I'll have to try it out more than the
| examples. Default arguments, named arguments, the added general
| operators and safe navigation operators are generally useful and
| positive changes.
| whalesalad wrote:
| Interesting that it contains a PHP-based build system
| https://pluto-lang.org/docs/Getting%20Started#php-scripts
| mdaniel wrote:
| "Interesting" is not the word I would use for that
|
| Where does `$file` come from in `for_each_obj` <https://github.
| com/PlutoLang/Pluto/blob/0.8.0/scripts/compil...> ... from
| `scandir` of "src" of course:
| https://github.com/PlutoLang/Pluto/blob/0.8.0/scripts/common...
|
| Here's hoping you didn't want to alter the intermediate output
| directory away from "int" or change the CPPFLAGS for your own
| setup
|
| I'm certainly no php ninja, but I'd put good money that a
| similarly homegrown bash build system would be about an equal
| number of lines of code but 1/10000th the WTF and not require
| an apt-get install before trying to contribute to the project
| srhtftw wrote:
| Just tried it online1 to see how it deals with a long standing
| problem2 I have with Lua and I'm pleased to see actual
| improvement in the form of a warning:
| script.pluto:1: warning: function was hinted to return string
| but actually returns nil [type-mismatch] 1 | function
| foo(x: number): string |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ here
|
| Unfortunately the underlying table was corrupted when the code
| ran and only 1 foo
|
| was generated in the output. I would have preferred it to have
| refused to run at all (will need to look in the docs to see if
| there's a way to get that behavior with configuration). The
| purist in me wants more but the practical side of me appreciates
| that this is definitely an improvement over current Lua.
|
| 1: https://pluto-
| lang.org/web/#code=function%20foo(x%3A%20numbe...
|
| 2: https://news.ycombinator.com/item?id=38030778
| djur wrote:
| It looks like you can set any warning to cause an error with a
| pragma:
|
| https://pluto-lang.org/docs/New%20Features/Compiler%20Warnin...
| haberman wrote:
| Ideally a new Lua dialect would be capable of compiling to both
| Lua and LuaJIT. The language is effectively forked, with the
| fastest implementation (LuaJIT) and the official implementation
| (Lua) living in seemingly irreconcilable worlds.
| PsyNyde wrote:
| i don't think this maintains the simplicity that lua offers.
| marwis wrote:
| Needs compiled binary size comparison somewhere on the website
___________________________________________________________________
(page generated 2023-12-27 23:00 UTC)