Atualização do Harbour 3.4 de hoje
fonte: xhb-diff.txt
### STRONG TYPED VARIABLES ###
====================================
Harbour and xHarbour allow to declare type of variables using syntax similar
to Visual Object which was adopted also by FlagShip and some other xBase
compatible languages (i.e. FlagShip):
LOCAL var AS STRING
Anyhow so far in both compilers it is only source code decoration and it's
simply ignored during compilation. The syntax is similar but not the same.
In VO:
LOCAL var1, var2 AS LOGICAL
means that var1 and var2 are character variables and are initialized to .F.
at runtime. In Harbour and xHarbour 'AS <type>' has to be repeated after
each variable so in above code only var2 is strongly typed but not var1.
To declare both variables as logical ones it should be changed to:
LOCAL var1 AS STRING, var2 AS STRING
Such syntax is also not compatible with syntax of typed object variables
(see TYPED OBJECT VARIABLES below) where
VAR v1, v2 AS LOGICAL
declares both variables as logical ones.
This can strongly confuse users so in the future adding fully functional
support for strong typed variables probably it will be changed to syntax
compatible with other xBase compatible languages.
Now please remember that neither Harbour nor xHarbour make type validation
during compilation and at runtime and typed variables are not implicitly
initialized to empty value of given type.
►Harbour 3.x | Minigui xx-x | HwGui◄ Pense nas possibilidades abstraia as dificuldades. Não corrigir nossas falhas é o mesmo que cometer novos erros. A imaginação é mais importante que o conhecimento. (Albert Einstein)
/* HB_CLS_NOAUTOINIT which disable the (VO like) AutoInit for Logical, Numeric, */
/* Date and Timestamp when not specifically initiated */
/* These two are disabled by default */
/* So Each class _inherit_ of HBObject by default and */
/* Each logical, numeric, date and timestamp typed variable is initiated to */
/* .F., 0, CToD( "" ) and t"00:00" by default */
►Harbour 3.x | Minigui xx-x | HwGui◄ Pense nas possibilidades abstraia as dificuldades. Não corrigir nossas falhas é o mesmo que cometer novos erros. A imaginação é mais importante que o conhecimento. (Albert Einstein)
Essa parte preferi não usar, é perigoso.
Por enquanto, caso vá usar a variável e o conteúdo não seja o que foi especificado, gera erro de run-time.
Só vai ser interessante quando houver uma IDE que faça a checagem durante a edição.
Ou o compilador teria que ser expandido pra analisar todos os fontes juntos, o que pode tornar o processo muito demorado.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2) "The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell" https://github.com/JoseQuintas/
This can strongly confuse users so in the future adding fully functional
support for strong typed variables probably it will be changed to syntax
compatible with other xBase compatible languages.
Pelo o que entendi estão pensando em deixar funcional no futuro.
►Harbour 3.x | Minigui xx-x | HwGui◄ Pense nas possibilidades abstraia as dificuldades. Não corrigir nossas falhas é o mesmo que cometer novos erros. A imaginação é mais importante que o conhecimento. (Albert Einstein)
No VB6, de 20 anos atrás.
Mas a IDE, ou o ambiente, precisaria da sintaxe de todas as funções do projeto, não dá pra fazer isso com um simples compilador individual de fontes.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2) "The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell" https://github.com/JoseQuintas/