Results 1 to 6 of 6

Thread: all those keywords...

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

    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.
    I think there are missing some Forum-sections as beta-testing and support

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    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
    Rep Power
    159
    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
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,529
    Rep Power
    170
    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....
    I think there are missing some Forum-sections as beta-testing and support

  5. #5
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    159
    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
    Join Date
    Oct 2012
    Location
    Germany
    Age
    54
    Posts
    1,529
    Rep Power
    170
    Quote Originally Posted by Michael Clease View Post
    ...
    Function dwLunch(byref roach as long) as DWORD
    ...
    
    wouldn't that be "lRoach" then ?
    I think there are missing some Forum-sections as beta-testing and support

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

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
  •