Results 1 to 6 of 6

Thread: all those keywords...

  1. #1
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    51
    Posts
    1,436
    Blog Entries
    2
    Rep Power
    158

    all those keywords...

    something that annoys probably not me only, is the situation if creating some new udt and finding names for the udt-elements - and 99% of those i would like to use are occupied by some thinBasic-keyword already

    Can't we write those udt-element-names optional in quotes to avoid this?

    They always have a dot in front in all other cases - so not very likely to get interpreted as keyword then (except from thinAir)

    Type t_example
      "Name" As String 
      "User"  As Long
    End Type
    
    dim my as t_example
    my.Name = "René"
    With my
       .User = 123
    End With
    
    PS- there's some new keyword "Version" - because of that - and something else - Petr's TBASS-3d-Sound-unit does not work any more
    and there's some other reason - somethings wrong with TBASS i fear- i don't get sound
    Last edited by ReneMiner; 28-01-2015 at 19:00.
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    OS: Windows 11 Enterprise x64 Build 22065 (21H2 pre-release)
    (says the systeminfo. anything else says it were Windows 10 - more or less insider - a lot of the system settings do not function - i could imagine it will not send feedback to microsoft since it always says i need a new app to open that feedback-hub-link. But hey: thinbasic runs well )

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,089
    Blog Entries
    5
    Rep Power
    726
    Hi Rene,

    in my opinion, this is very important issue. I think we need to be able to name the UDT elements with any name, even when same as already defined keywords.
    Not with quotes, but simply by default, out of the box, as it is in other languages.

    ThinBASIC parser has the ability to know it is inside TYPE / END TYPE scope, so it should be possible.

    Otherwise, we easily fall in completlely anti-future proof problems, like the one Rene describes.

    The same should apply for parameter names of functions!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Blog Entries
    1
    Rep Power
    157
    I find prefix the datatype in front of the variable name stops keyword clash but also gives me reminders of the datatype being used.

    Type t_example
       sName  As String
       lUser  As Long
    End Type
    
    
    dim my as t_example
    my.sName = "René"
    With my
      .lUser = 123
    EndWith
    
    Last edited by Michael Clease; 29-01-2015 at 10:52.
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  4. #4
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    51
    Posts
    1,436
    Blog Entries
    2
    Rep Power
    158
    for variables that makes sense, but what if it's a type-function?
    All prefix them using "f" + the returned vartype? How will the code read then....
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    OS: Windows 11 Enterprise x64 Build 22065 (21H2 pre-release)
    (says the systeminfo. anything else says it were Windows 10 - more or less insider - a lot of the system settings do not function - i could imagine it will not send feedback to microsoft since it always says i need a new app to open that feedback-hub-link. But hey: thinbasic runs well )

  5. #5
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Blog Entries
    1
    Rep Power
    157
    Type tMytype
      sfred  as string
      dwLunch  as function
    end type
    
    Function dwLunch(byref lRoach as long) as DWORD
    
    DIM  lizardpeople as tMytype
    
    Last edited by Michael Clease; 29-01-2015 at 18:32.
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  6. #6
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    51
    Posts
    1,436
    Blog Entries
    2
    Rep Power
    158
    Quote Originally Posted by Michael Clease View Post
    ...
    Function dwLunch(byref roach as long) as DWORD
    ...
    
    wouldn't that be "lRoach" then ?
    running thinBasic in HP Pavillon Desktop 590 a0xxx 8GB Ram AMD A6-9225 Radeon R4 5Compute Cores 2C+3G @2.6GHz

    OS: Windows 11 Enterprise x64 Build 22065 (21H2 pre-release)
    (says the systeminfo. anything else says it were Windows 10 - more or less insider - a lot of the system settings do not function - i could imagine it will not send feedback to microsoft since it always says i need a new app to open that feedback-hub-link. But hey: thinbasic runs well )

Similar Threads

  1. Creating thinBasic keywords lists
    By ErosOlmi in forum Tips and Tricks
    Replies: 13
    Last Post: 29-12-2012, 03:45
  2. Usage of (some) OS Keywords
    By Michael Clease in forum Samples for help file
    Replies: 1
    Last Post: 30-05-2007, 11:59
  3. Usage of the MAX$ MIN$ Keywords
    By Michael Clease in forum Samples for help file
    Replies: 4
    Last Post: 28-05-2007, 12:34
  4. Usage of the LEFT$ MID$ RIGHT$ Keywords
    By Michael Clease in forum Samples for help file
    Replies: 1
    Last Post: 28-05-2007, 11:45

Posting Permissions

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