Earlier quoted context omitted.
For bignums, have you tried this? https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/#limath luajit does have integers (try 5ull+6), bit operations via the bit library (absorbed from lua5.2)
How does imath compare to gmp?
Teal – A statically-typed dialect of Lua
171–176 of 176 posts
Re: Teal – A statically-typed dialect of Lua
#172Earlier quoted context omitted.
I do think you're better off using ruby, but if you insist. Lots of default functionality missing so you MUST have these packages: inspect, luaposix, lrexlib-pcre, lrexlib-posix, lpeg, luastd/stdlib, luasocket, luahttp, luasec, luacheck, penlight * luajit is unnecessary in almost all cases, you don't need the speed. * use lsp or luacheck whenever you write something, entr -c luacheck file on everything. * patterns ar…
Ruby has a startup time and is slow. (Although compiled Crystal might be an idea...) I am specifically looking for a language that: 1) is a scripting language (don't have to worry about compiling it) 2) starts up fast (so if I use it in a loop or a sequence of pipes, it won't necessarily be the bottleneck) 3) runs fast 4) is easy to work with and is either ridiculously simple or well-designed (Bash has so many footgu…
I do like awk and it definitely should be used more, but I stopped using it because of modules. gawk added it, but its strange having a script end in .awk and then its actually .gawk, and not working with mawk and so on.
So to me, modules are paramount, Lua focuses on embeddability and being an extension language means that writing to _G is fine. But as a system language you should never write to _G. this means that you may find a module for lua, but in reality its not lua, its a module for a program, usually a game.
Frankly, I think lua should not even be offered in your package manager and instead some sort of wrapper that works on POSIX systems should be used, batteries included and sane defaults as well. No more installing luaposix for basic functionality (if bash has it, this should as well). I and you are disparaging bash and claim lua is fast, but at the end of the day, bash has many builtins like test,cd,setenv while lua does not.
Also can D be used as a scripting language? I'm genuinely amazed and would give it a try.
> Why not use it if it's there, it's faster, and you don't need features beyond 5.1?
Sure, but I doubt anybody will need the performance unless of course you do.
FWIW there is a killer feature that I consider essential that everybody needs and that is . I no longer have to worry about closing files, and I could probably use it for something else.
> They're almost regex, they're faster than regex, and for 90% of use cases, you don't need full regex
You may not need full regex (PCRE) but you usually need EREs specifically {} and | are used a whole lot.
> Isn't a table basically just a JavaScript object, where metatables are the prototype object? Sort of, at least...
I'd say JS is a weird language as well.
Mind you, I'm not disparaging lua, I do use it, but these are the foot guns. (Bundling is also a mess)
Re: Teal – A statically-typed dialect of Lua
#173Earlier quoted context omitted.
C is indeed simple.
The C standard has about 700 pages.
Many of the corners of C understanding come with inherently abstruse backgrounds: say, accessing fenced memory with an aliased value in-scope, or in getting the particulars of expected memory-layout right for a given ABI. None of this actually impacts most daily development.
Hell, the impact of using zero-terminated strings is far greater of an issue than poor-specification of the language is. You have to deal with this problem; POSIX decided to bake it in to its core. Pointer mismanagement is a generally difficult problem, but C decided to actively cook-in hard-to-manage-strings.
Re: Teal – A statically-typed dialect of Lua
#174I've been diving into Lua (a little late to this party, but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash, especially with LLM assistance!) and it's really something of an eye-opener. LuaJITted Lua code runs at 80% (on average, sometimes faster!) of the compiled C version of the same algorithm , typically. Lua is embedded in a surprisingly massive numbe…
IMO this is the perfect use case for Perl. I mean, it's why Perl was invented, but to this day it remains incredibly good at doing this specific task. It's incredibly easy to write and can be very easy to read, and it's much more robust than bash. But best of all - and the reason I think Perl still has a place in the modern world - it's available on practically every computer on Earth. And it will all work. It's so backwards-compatible that 25 year old scripts will run just fine. It's so portable that nothing even comes close. Also, it's shockingly fast. Faster than you would think. Regex is really powerful and it's been the template for so many regex implementations, but definitely be careful of runaway time complexity.
Anyway, Lua is great too. Really nice for embedding into applications ala VBA. Great for config.
Re: Teal – A statically-typed dialect of Lua
#175I've been diving into Lua (a little late to this party, but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash, especially with LLM assistance!) and it's really something of an eye-opener. LuaJITted Lua code runs at 80% (on average, sometimes faster!) of the compiled C version of the same algorithm , typically. Lua is embedded in a surprisingly massive numbe…
> but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash IMO this is the perfect use case for Perl. I mean, it's why Perl was invented, but to this day it remains incredibly good at doing this specific task. It's incredibly easy to write and can be very easy to read, and it's much more robust than bash. But best of all - and the reason I think Perl still has…
Re: Teal – A statically-typed dialect of Lua
#176Earlier quoted context omitted.
> but turns out it's a perfect language to rewrite some commandline scripts I had that were getting unwieldy in Bash IMO this is the perfect use case for Perl. I mean, it's why Perl was invented, but to this day it remains incredibly good at doing this specific task. It's incredibly easy to write and can be very easy to read, and it's much more robust than bash. But best of all - and the reason I think Perl still has…
Good point about Perl. Why don't I consider Perl? I don't know.