Announcement

Collapse
No announcement yet.

Plea for mercy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Plea for mercy

    Hello,

    Oh how I wish I could use reserved words. If there could be only
    one wish, I would have to ask that I be allowed to use reserved
    words... Oh mighty PowerBasic show me your mercy!


    Type
    Size
    Label
    Name
    etc...



    ------------------
    Cheers

  • #2
    Mark --

    My programs are full of Reserved Words! I use them all the time!

    Oh... I bet you mean that you want to use Reserved Words as variable and SUB/FUNCTION names.

    Pretty clearly, Reserved Words that correspond to PB functions can't be used as function names, or the compiler would never be able to figure out which function to use. And the same thing is true for variable names. How could the compiler possibly figure out what you mean by something like...

    Code:
    lResult& = ERR
    Is that the native ERR function, or a variable called ERR, or a user-defined function called ERR?

    Code:
    PRINT CHR$(1)
    Is that the CHR$ function, or an array called CHR$()?

    The same thing is true for PB statements. What does this mean?...

    Code:
    EXIT
    Should the program EXIT from a structure, or is that a call to a SUB called EXIT? (Remember that PB does not require the use of the word CALL.)

    So clearly not all Reserved Words could be used as variable and proc names. No way.

    And personally, I'd rather have a rule like "never" than a rule like "sometimes you can and sometimes you can't".

    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    "Not my circus, not my monkeys."

    Comment


    • #3
      I think I know where you are coming from.

      I would love to be able to use the reserved word 'NAME' in
      my code. like
      Code:
      TYPE employee
          name as string * 20
          age as integer
      END TYPE
      Why did they choose to call the function NAME when RENAME would
      have been a more appropriate choice anyway.

      The fact though is, it is done. It would require an inordinate
      amount of work to roll that back and not only would it affect
      PB's workload but imagine the amount of developed applications
      that are sitting in the source code libraries of a good few
      programmers that would not recompile without extra work.

      Would it be possible though at some stage in the future to provide
      function and operator overloading as in other languages. (I know,
      you must hate me cropping up from time to time and harping on
      about OOP. but it really is the way forward. Don't be behind the
      competition with this one. With such a good compiler you should
      be breaking new ground not playing catch-up.)

      Regards,
      Trevor Lane

      ------------------

      Comment


      • #4
        The NAME statement goes back to the days of [very] old... TTBOMK it was not invented by PowerBASIC, but for compatibility reasons it was retained.

        Interstingly, if you used a form of Hungarian-notation, you'd have no problems at all!

        Code:
        TYPE UDT_employee    
          sName as string * 20    
          iAge as integer
        END TYPE
        Anyway, this is the least of your problems... this particular code UDT will fail once someone has their 32768th birthday!

        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Code:
           [quote]
          Why did they choose to call the function NAME when RENAME would
          have been a more appropriate choice anyway.[/quote]
             
          Some things just make you feel ancient, don't they.
          ------------------
          -- Greg
          [email protected]

          Comment

          Working...
          X