What is lldb_expr in Swift Playground?

后端 未结 1 919
野性不改
野性不改 2021-01-19 07:33

I was trying to demonstrate basic inheritance to someone and how the super initializer is always called by default when overriding an init:

class Animal{
            


        
相关标签:
1条回答
  • 2021-01-19 07:53

    I am not 100% about this but to me this seems sane and logical.

    Your Animal class is empty so the compiler needs a way to express / print the class / it's values. So what it does is print __lldb_expr_380.Animal because the compiler doesn't know what else to make of it. If you add a property, for example legs, the result becomes this: {{legs 2} feet 4}.

    So, in my understanding whenever you have this empty superclass the compiler will get 'confused' and the error that happens is that it will just print out __llb_expr_:some_number:.ClassName instead of something like {}.

    Reference: http://discuss.codewithchris.com/t/episode-7-classes-error---lldb-expr-/150

    0 讨论(0)
提交回复
热议问题