Should one use forward declarations instead of includes wherever possible?

The forward-declaration method is almost always better. (I can’t think of a situation where including a file where you can use a forward declaration is better, but I’m not gonna say it’s always better just in case). There are no downsides to forward-declaring classes, but I can think of some downsides for including headers unnecessarily: … Read more

receiver type *** for instance message is a forward declaration

That basically means that you need to import the .h file containing the declaration of States. However, there is a lot of other stuff wrong with your code. You’re -init’ing an object without +alloc‘ing it. That won’t work You’re declaring an object as a non-pointer type, that won’t work either You’re not calling [super init] … Read more

How do I forward-declare a function to avoid `NameError`s for functions defined later?

Wrap the invocation into a function of its own so that foo() def foo(): print “Hi!” will break, but def bar(): foo() def foo(): print “Hi!” bar() will work properly. The general rule in Python is that a function should be defined before its usage, which does not necessarily mean it needs to be higher … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)