On Tue, 14 Oct 2008, [EMAIL PROTECTED] wrote: Hi Toninho,
> I don´t know if this is an feature or a problem. If I have > DATA bDraw AS CODEBLOCK INIT nil INIT clause is unprotected and allow to assign any value with declared type respecting. > bDraw accept NIL without problem, but I can´t set it to nil again. If > I do: > oClass:bDraw = nil > I receive an error. Exactly and it's expected behavior fully Class(y) compatible. > IMHO codeblock types can receive nil to easy checking, like: > if !( oClass:bDraw == nil ) > Eval( oClass:bDraw ) > endif You can say the same about any other types just like I can say that I do not agree with you because I'm happy that I do not have to make such checking in my code because I'm always sure that after valid initialization variable always contains expected type. You can use AS USUAL if you want to assign NIL value or you can use: #translate AS <!type!> => and make from type checking source code decoration just like in xHarbour where there is no type checking at all. We can also intorduce additional declaration which will allow to set NULL. I've just seen Frank message about using <type>? but it will change the PP semantic because ? joins expressions so rules like #translate AS <type> => will not works as expected in some cases and code like: DATA bDraw AS CODEBLOCK? INIT nil will be translated to: DATA bDraw nil so I'd prefer sth different what will keep current PP syntax. Even such minor modification resolved the problem. DATA bDraw AS ?CODEBLOCK INIT nil But we can also use sth what will allow to mix types, f.e.: DATA bDraw AS CODEBLOCK | NIL or we can support additionally: AS {<type> [,<type>]}, f.e.: DATA bDraw AS {CODEBLOCK} DATA bDraw AS {CODEBLOCK,NIL} Think about it but base type checking should not be touched. Otherwise IMO we should remove it at all because it stops to give expected RT protection and we can keep it as source code decoration just like in xHarbour. best regards, Przemek _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour