[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suggestion: "usertype()" function
- From: Geoff Leyland <geoff_leyland@...>
- Date: Thu, 31 May 2012 08:43:04 +1200
On 31/05/2012, at 7:37 AM, Tim Hill wrote:
> Of course, it's not necessary to add this to the language; after all I just wrote the code in the above example.
Exactly.
> However, I feel that this is a generic feature that needs to always be available for people who are writing addon libraries or packages for Lua.
Some agreement on policy might help for interoperability between modules, but I'm wouldn't count on it being easy to get any agreement.
> Thoughts anyone?
Sometimes I'm not smart enough to avoid dealing with inheritance chains. In these cases a type name doesn't tell you all you might want to know about a type. So if type B is a type A then and a is an instance of A and b is an instance of B then:
typename(a) == "A"
typename(b) == "B"
typeinfo(a).A == true
typeinfo(a).B == nil
typeinfo(b).A == true
typeinfo(b).B == true