/g/ - Technology

install openbsd

[Make a Post]
[X]





Nanonymous No.977 [D][U][F][S][L][A][C] >>979 >>2848
File: b59936532d1edd65be2922f0b452ed4e7b1a117fc71d4cafb658d48c7ccff4a7.jpg (dl) (51.80 KiB)

So, is Lua as a standalone language actually worth any shits?

Nanonymous No.978 [D] >>2884

You were able to create this thread and I am able to respond to it. I guess that means yes.


Nanonymous No.979 [D]

>>977
Lua is perfectly capable as a standalone language. The language itself (flow control etc.) doesn't mind whether it's standalone or embeded; and the I/O capabilities are sufficient. Extension libraries are a bit of a mess in certain cases (due to the different version s of Lua 5.1 5.2 5.3 etc.) but generally it's easy to work around those problems.
Also who's that deformed gril you posted, looks like a korean plastic surgery who got a jaw removed

Nanonymous No.984 [D] >>985 >>2743

>dynamic typing
The answer to scripting language needs is simpler types, not this garbage. Especially when scripting languages are used by retards to make big and/or complex programs.

Nanonymous No.985 [D] >>993

>>984
C is a scripting language too, you know.

Nanonymous No.993 [D]

>>985
If it has an AOT compiler without runtime added to the binary, it's okay for me (inb4 crt0).

Nanonymous No.1013 [D] >>1014

isnt that what they use to code in roblox?

Nanonymous No.1014 [D]

>>1013
>roblox
get out zoomer
but yes they do use lua in roblox, and in minetest too. Lua is commonly used for game extensions because of its high speed and coroutine (multitasking) support.

Nanonymous No.2743 [D] >>2840

>>984
>simpler types
what do you propose?

Nanonymous No.2840 [D] >>2848 >>2866

>>2743
List, Array, Hash Table, String, Int and Float (include multiprecision variants) should be enough for a scripting language. The rest can be added via modules.

I also like TCL's or awk's "no visible typing", but it's not ideal for bigger shit.

Anyway, what's the argument for dynamic typing? You'll have to write the types in the function documentation, in almost all cases. Even faggots agree: see stuff like mypy and typescript getting a lot popular once the retards figured dynamic typing was an unecessary hell.

Nanonymous No.2848 [D] >>2854

>>2840

But anon, lua's types are even simpler. They're basically a minimal set: Nil, Boolean, Number, String, Table, Function, StreamIO, Coroutine, and Userdata. It'd be hard to make as good a scripting language while reducing the types any more.

Also, it's occasionally useful to have a function that returns different types of arguments. For example, it's pretty common to return either the value your function was supposed to return, or "false" plus an error message.

>>977

Maybe, if you just need a scripting language to glue things together, or as a command line utility, lua's vm starts up faster than java[script] or python. If you need anything more than that and expect to be doing some big software development, you might look at some of the sister languages like Moonscript, Titan, or Terra.


Nanonymous No.2854 [D]

>>2848
>Also, it's occasionally useful to have a function that returns different types of arguments. For example, it's pretty common to return either the value your function was supposed to return, or "false" plus an error message.
That what multiple value return is for, not dynamic typing; especially since Lua has Nil.
Honestly, I've never seen any use to dynamic typing.

Nanonymous No.2866 [D] >>2882 >>2884

>>2840
>what's the argument for dynamic typing?
Basic static typing, where everything takes a single type as argument and returns a single type, should always be available. But people want more complicated typing. They want a function to optionally take one of six different types as argument, and return a different type depending on the moon cycle. You could add support for this at the language level but you are making your language much more complicated. Especially since, as you say, these things can be encoded in the documentation where they better conveyed.

Have never used it, but from what I read, this is how go works. Static typing 99% of the time, but when people want complex generic functions it turns into dynamic typing.

Nanonymous No.2882 [D]

>>2866
That's a bad idea. Allowing for easier genericity is better than just dumping typing alltogether. Look at how SML does stuff, for example.

Nanonymous No.2884 [D]

>>978
The same thing could be said of PHP . . . I'm certain you don't mean to imply PHP (ie, Perl for web servers) isn't shitty.

>>2866
Writing a code generator is sometimes a decent option to handle languages that lack generics.