• Strange behavior in METHOD INLINE clause

    From Enrico Maria Giordano@21:1/5 to All on Wed Jul 10 12:40:19 2024
    Hi,

    I just found a strange behavior in METHOD INLINE clause. This is a sample:

    #include "Hbclass.ch"


    FUNCTION MAIN()

    RETURN NIL


    CLASS Test

    METHOD Test() INLINE 1

    ENDCLASS

    The PPO file shows this for Harbour:

    _HB_MEMBER Test(); oClass:AddInline( "Test", {|Self | ( ( Self ) ), 1 },
    nScope + iif( .F., 8, 0 ) + iif( .F., 256, 0 ) + iif( .F., 2048, 0 ) )

    And this other (longer) for xHarbour:

    _HB_MEMBER Test(); IIF( .F., s_oClass:ModInline( "Test", {|Self | Self,
    1 }, nScope + IIF( .F., 16, 0 ) + IIF( .F., 1024, 0 ), .F. ), s_oClass:AddInline( "Test", {|Self | Self, 1 }, nScope + IIF( .F., 16, 0
    ) + IIF( .F., 1024, 0 ), .F. ) )

    Is it normal?

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Wed Jul 10 13:28:43 2024
    This is something strange too:

    FUNCTION MAIN()

    LOCAL oTest := Test()

    ? AT( "", "Test" )
    ? AT( "", oTest:Test )

    INKEY( 0 )

    RETURN NIL


    #include "Hbclass.ch"


    CLASS Test

    DATA Test INIT "Test"

    ENDCLASS

    The result is:

    1
    0

    Shouldn't be the same value? With Harbour I get:

    0
    0

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Wed Jul 10 13:33:55 2024
    Il 10/07/2024 13:28, Enrico Maria Giordano ha scritto:

    This is something strange too:

    FUNCTION MAIN()

        LOCAL oTest := Test()

        ? AT( "", "Test" )
        ? AT( "", oTest:Test )

        INKEY( 0 )

        RETURN NIL


    #include "Hbclass.ch"


    CLASS Test

        DATA Test INIT "Test"

        ENDCLASS

    The result is:

    1
    0

    Shouldn't be the same value? With Harbour I get:

    0
    0

    I was expecting:

    1
    1

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Thu Jul 11 20:23:47 2024
    Another sample:

    FUNCTION MAIN()

    LOCAL cVar := "Test"
    LOCAL oTest := Test()

    ? AT( "", "Test" )
    ? AT( "", cVar )
    ? AT( "", oTest:Test )

    INKEY( 0 )

    RETURN NIL


    #include "Hbclass.ch"


    CLASS Test

    DATA Test INIT "Test"

    ENDCLASS

    Result:

    1
    0
    0

    Harbour:

    0
    0
    0

    Expected:

    1
    1
    1

    An empty string is contained in any string.

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ron Pinkas@21:1/5 to Enrico Maria Giordano on Thu Jul 18 13:54:28 2024
    Enrico Maria Giordano wrote:

    Another sample:

    FUNCTION MAIN()

    LOCAL cVar := "Test"
    LOCAL oTest := Test()

    ? AT( "", "Test" )
    ? AT( "", cVar )
    ? AT( "", oTest:Test )

    INKEY( 0 )

    RETURN NIL


    #include "Hbclass.ch"


    CLASS Test

    DATA Test INIT "Test"

    ENDCLASS

    Result:

    1
    0
    0

    Harbour:

    0
    0
    0

    Expected:

    1
    1
    1

    An empty string is contained in any string.


    The inconsistency is becaussse when using the CONSTANT values "" and
    "Test" the result is generated in COMPILE TIME by the compiler, and it obviously has a minor bug - comapred to the RTL implementtation.
    The decision to have 0 vs. 1 I suppose iss arbitrary - both makes sense
    it just has to be consistent. :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Thu Jul 18 21:35:51 2024
    Il 18/07/2024 20:54, Ron Pinkas ha scritto:

    The inconsistency is becaussse when using the CONSTANT values "" and
    "Test" the result is generated in COMPILE TIME by the compiler, and it obviously has a minor bug - comapred to the RTL implementtation.
    The decision to have 0 vs. 1 I suppose iss arbitrary - both makes sense
    it just has to be consistent. :)

    Thank you. Can you fix it?

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Enrico Maria Giordano@21:1/5 to All on Wed Jul 31 17:45:48 2024
    Il 31/07/2024 17:21, Ron Pinkas ha scritto:

    Thank you. Can you fix it?

    Enrico, sorry for the delayed reply - I have been very busy the past few montths. I don't know whenn I willl have the time. I will try when I can.

    Take your time, no hurry. Thank you!

    --
    Enrico Maria Giordano

    http://www.emagsoftware.it
    http://www.emagsoftware.it/emgmusic
    http://www.emagsoftware.it/spectrum
    http://www.emagsoftware.it/tbosg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ron Pinkas@21:1/5 to Enrico Maria Giordano on Wed Jul 31 10:21:57 2024
    Enrico Maria Giordano wrote:


    Il 18/07/2024 20:54, Ron Pinkas ha scritto:

    The inconsistency is becaussse when using the CONSTANT values "" and
    "Test" the result is generated in COMPILE TIME by the compiler, and it obviously has a minor bug - comapred to the RTL implementtation.
    The decision to have 0 vs. 1 I suppose iss arbitrary - both makes sense
    it just has to be consistent. :)

    Thank you. Can you fix it?


    Enrico, sorry for the delayed reply - I have been very busy the past few montths. I don't know whenn I willl have the time. I will try when I can.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)