Página 1 de 1

Atualização do Harbour 3.4 fork

Enviado: 20 Set 2016 16:48
por asimoes
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.

Atualização do Harbour 3.4 fork

Enviado: 20 Set 2016 16:54
por asimoes
Comentários na hbclass.ch

/* 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 */

Atualização do Harbour 3.4 fork

Enviado: 21 Set 2016 16:38
por Itamar M. Lins Jr.
Ola!
Detalhe! Foi feito primeiro na 3.2 por Przemyslaw Czerpak e automaticamente a 3.4 e atualizada.

Saudações,
Itamar M. Lins Jr.

Atualização do Harbour 3.4 fork

Enviado: 21 Set 2016 17:16
por JoséQuintas
Estranhei, porque isso parece coisa antiga.

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.

Atualização do Harbour 3.4 fork

Enviado: 21 Set 2016 19:29
por asimoes
O que é interessante no texto acima é esta parte:

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.

Atualização do Harbour 3.4 fork

Enviado: 21 Set 2016 19:54
por JoséQuintas
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.
teste.png