[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: implicit conversions in Lua -- what is idiomatic?
- From: Josh Haberman <jhaberman@...>
- Date: Mon, 6 Jan 2014 14:42:17 -0800
Great; this is my preferred approach. I'll have to write my own
type/range-checking functions since the stock ones like
luaL_checkinteger() do implicit conversion/truncation, but I am more
comfortable with this approach overall.
On Mon, Jan 6, 2014 at 2:31 PM, Robert Virding <rvirding@gmail.com> wrote:
> Implicit conversions are idiomatic Lua but in this case I think it safer to
> be strict about the types. You will get more errors but you will get less
> strange behaviour when people give the wrong type and it still works but the
> result is "funny". IMAO it is better to be strict with types, especially in
> big applications where it can be difficult to otherwise trace type errors.
>
> Robert
>
>
> On 6 January 2014 23:07, Hisham <h@hisham.hm> wrote:
>>
>> On 6 January 2014 16:49, Josh Haberman <jhaberman@gmail.com> wrote:
>> > Yes, my library "upb" is a larger effort of which bindings to Lua are
>> > just a part. I have schema classes and an optimized decoder written in
>> > C+DynASM that can be easily bound to any language runtime. And I have
>> > plans to extend this to other data formats like JSON and even to bind
>> > it to my dormant Gazelle library (http://www.gazelle-parser.org/) for
>> > LPeg/Bison-like text parsing.
>> >
>> > The vision is:
>> >
>> > {C, C++, Lua, Ruby, Python, JavaScript, etc.} x
>> > {Protocol Buffers, JSON, Thrift, Avro, Regexes, Text Parsing} x
>> > Highly optimized C+JIT encoders/decoders
>>
>> Speaking of that, does anyone know about Thrift
>> implementations/bindings for Lua? I've been asked about that recently
>> and couldn't find any.
>>
>> -- Hisham
>>
>