Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: strange bug: missing close parens

  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170

    Type_Exists-issue?

    i have some strange bug...


    Edit: seems I found a reason, Type_Exists does not return true for standard types?

    old content moved to thinBasic support-area .


    I use this for something else now:

    assume
    uses "console"
    
    Type t_Type
      abcd As Function
      efgh As Function
    End Type
    
    Function t_Type.abcd() As String
    End Function
    
    Function t_Type.efgh() As Long
    End Function
    
    Dim foo As t_Type
    
    PrintL "Test 1 " & $CRLF
     ' no printout to await but surprise...
    
    If foo.abcd() = "String" Then PrintL "foo.abcd returns string"
    If foo.abcd() = "Long"   Then PrintL "foo.abcd returns long"
    If foo.efgh() = "String" Then PrintL "foo.efgh returns string"
    If foo.efgh() = "Long"   Then PrintL "foo.efgh returns long"
    
    PrintL $CRLF & "Test 2 " & $CRLF
    
    Select Case foo.abcd()
      Case "String"
        PrintL "foo.abcd contains string"
      Case "Long"
        PrintL "foo.abcd contains long"
    End Select
    
    Select Case foo.efgh()
      Case "String"
        PrintL "foo.efgh contains string"
      Case "Long"
        PrintL "foo.efgh contains long"
    End Select
    
    WaitKey
    

    what's going on here?
    Last edited by ReneMiner; 11-10-2014 at 18:17.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I will have a look ...
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I think the logical testing is not aware of the possibility to have TYPE Functions as initial parameters and understand if it is a string or numeric logical test comparison.
    So the logical test will always result to true.

    Thanks for finding it. I will work on it asap.

    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    just to hold the thought, chatbox is sometimes unreliable...

    Were it an idea to have type-functions that return string (or udts) the function-names mandatory need to end with $ ?
    I think there are missing some Forum-sections as beta-testing and support

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Quote Originally Posted by ReneMiner View Post
    just to hold the thought, chatbox is sometimes unreliable...
    Confirm. Will try to think something different.

    Quote Originally Posted by ReneMiner View Post
    Were it an idea to have type-functions that return string (or udts) the function-names mandatory need to end with $ ?
    Thanks for trying to help but that is not the problem.
    I know what kind of data a function method does.

    My problem is how to return that data when it is a string and the expression is numeric.
    "IF [String] = [String] THEN ..." is in reality a logical test that should return a numerical value while inside there are strings.
    I perfectly know how to solve it but it is actually inside a very complex part of thinBasic Core engine. I need a little more time to solve it.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    i'm certain you'll find a way but it's probably a matter of insufficient time to do it ...
    but what have you done with Type_Exists - didn't that work before? I thought so but i'm not sure any more...
    I think there are missing some Forum-sections as beta-testing and support

  7. #7
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I think I've solved this problem but ... found another weird one.
    When a TYPE function is used into a
    SELECT CASE udt.function()
    ...
    
    it is executed twice.

    This because SELECT CASE need to know what kind of data it is examining (numeric or string) making an ahead evaluation and the function used to do that is also executing the function.
    I need to separate the two phases.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  8. #8
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,527
    Rep Power
    170
    sounds if everything were under control - i don't want to post loads of examples but i think

    If- conditions are somewhat similar to While/Until i guess

    What about Iif/Iif$ ? shall i try out?
    I think there are missing some Forum-sections as beta-testing and support

  9. #9
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    I should have fixed these problems.
    In few hours I will post an updated thinCore.dll
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10
    Here a thinCore.dll

    Hope it works fine for the above 2 problems:
    • IF with TYPE Functions
    • SELECT CASE ... using TYPE Functions


    If OK, I will publish 1.9.14 and start working on next requests.
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Page 1 of 2 12 LastLast

Similar Threads

  1. Murdoch: News of the World to close down
    By Charles Pegge in forum Shout Box Area
    Replies: 3
    Last Post: 08-07-2011, 02:28
  2. close one dialog from another one and back
    By Lionheart008 in forum UI (User Interface)
    Replies: 0
    Last Post: 12-03-2010, 21:17
  3. Another new feature very close to be released
    By ErosOlmi in forum thinBasic General
    Replies: 0
    Last Post: 14-09-2006, 22:18

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •