2017-03-28 23:02 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* include/hbcomp.h
  * include/hbcompdf.h
  * include/hberrors.h
  * include/hbexprb.c
  * src/common/expropt1.c
  * src/compiler/hbgenerr.c
  * src/compiler/hbmain.c
    + added new macros HB_ET_MACRO_NOLIST and HB_ET_MACRO_NOPARE
    % use new HB_ET_MACRO_* macros
    + added new compile time error:
         "Code block contains both macro and with object messages ':%s'"
      NOTE: -kd compiler switch allows to compile codeblocks with macros
            and declared symbols / with object messages
    * replaced hb_compErrorCodeblock() with hb_compErrorCodeblockDecl() and
      hb_compErrorCodeblockWith()
    + added new C function hb_compPushMacroVar()
    * code simplification
    ; added few comments

  * utils/hbtest/rt_math.prg
    * extended test code for macro messages and macro <op>=, pre/post ++/--
      operations

  * src/vm/hvm.c
    ! protection against executing hb_threadStateNew() during GC pass
      inside hb_vmRequestReenterExt()

  * src/vm/garbage.c
    ! add volatile attribute to s_bCollecting variable
    * small modification in hb_gcAll() parameter

  * src/rtl/errsys.prg
    ; minor comment cleanup

  * doc/xhb-diff.txt
    * extended a little bit section STRONG TYPED VARIABLES
This commit is contained in:
Przemysław Czerpak
2017-03-28 23:02:28 +02:00
parent 5f1da37fd2
commit 9153285bdf
13 changed files with 215 additions and 113 deletions

View File

@@ -1414,18 +1414,22 @@ 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.
means that var1 and var2 are logical 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
and to make implicit initialication user has to write code like:
LOCAL var1 AS STRING := "foo", var2 AS STRING := "bar"
instead of:
LOCAL var := "foo", var2 := "bar" 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.
compatible with other xBase like 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.