lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 20 June 2017 at 10:14, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Mon, Jun 19, 2017 at 10:35 PM, Coda Highland <chighland@gmail.com> wrote:
>> (1) Lua is already strongly typed. It just has a very small list of
>> recognized types, and one of those types is "table".
>
> It could be argued that Python tends to be more strongly-typed, since
> we have the happy habit of passing plain tables with implicit
> (hopefully documented) structure, rather than a _distinct_ type.  So
> API contracts tend to be looser.


quoting somebody else [1]:

" Therefore: I give the following general definitions for strong and
weak typing, at least when used as absolutes:

- Strong typing: A type system that I like and feel comfortable with
- Weak typing: A type system that worries me, or makes me feel uncomfortable
"

not that i agree with that... still the words "strong" and "weak" can
be emotionally charged, so we tend to redefine the "requirements" to
get strong (that is, "better")

my own definition of strong typing implies well defined types (like
Lua) and no transparent transformations.  in that case, Lua is not so
strong as Python, or Pascal.

too strong typing can also be awful; i remember hating Pascal because
i had to use casting functions on most numeric operations.  Lua
doesn't had that problem because it originally had a single numeric
type.  now with the integer subtype i'd say it's _slightly_ less
strong.

and about the string <-> number autocasting, well i don't like that so
much.  although not so strongly as to disable it via LUA_NOCVTS2N.  I
guess that as a configuration language it gets handy


[1]: http://blogs.perl.org/users/ovid/2010/08/what-to-know-before-debating-type-systems.html

-- 
Javier