Announcement

Collapse
No announcement yet.

Wish list and bug report

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

  • Wish list and bug report

    I have a list of various items ranging from glitch reports, to
    suggestions for the next version, to other things which may just
    need some clarification.

    The compiler doesn't check array dimensions.
    If I declare an array with two dimensions, and later use it with
    only one dimension, the compiler does not flag it as an error.
    For instance:
    Code:
    Dim MyArray(10, 10) As Long, y as Long
    
    y = MyArray(5)
    The compiler does not catch the error in the second line of code.
    Unlike checking for array bounds, array dimensions is something
    the compiler should be able to check at compile time. I do see a
    potential for this to actually be a feature if you want to access
    elements using just one index according to the way it's actually
    stored in memory. But this would need to be clearly documented,
    and the compiler would still need to produce a warning, in case
    this was not my intention. (Just now, I also noticed that you
    can declare two arrays with the same name and type, on the same
    line, and the compiler doesn't catch it).

    Tab setting doesn't work for all blocks.
    When I change the tab setting in the Option menu to 3, it works
    for things like If/Then, Functions blocks, etc... but not for
    some things like TYPE or UNION. Those two ignore the tab setting.

    Search engine problem.
    If I have lines such as: "Call MySub(Var, MyVar)", there is no
    way for me to successfully do a search for "Var" using PB's find
    button. If I search for "Var" without "Whole Word" matching,
    then it finds "MyVar" also, and if I do Whole Word matching, it
    skips over it entirely. This problem appears to be unique to PB.
    It makes it impossible to correctly do a global search & replace.

    Keyword mixed case doesn’t always work.
    In the IDE, if I type a keyword such as "ucase$", PB changes it
    to "UCase$" and changes the text color to blue. Ironically
    however, of all keywords, it doesn't work for MCase$; same for
    for StrDelete$, StrInsert$, or StrReverse$.

    F5 in the debugger doesn't work the way I expect.
    If I press F5 from the IDE, it doesn't call the debugger. When I
    finish running the program, pressing F5 says that the program
    must be reset first, which requires several keystrokes or mouse
    clicks. So F5 seems to be of limited use. Same goes for the
    Run/Debugger button in the debugger. It would be nice for PB to
    automatically reset/run when you press F5 or click Run.

    Debugger takes extra step for each Dim element.
    For instance, for this line: Dim a&, b&, c&, d&, e&, f&, g&, h&
    I have to click "Step Over" a bunch of times before moving to the
    next line. On the other hand, it skips over multi-statement
    lines. If I have a For/Next loop in one line, the debugger
    doesn't step through the loop. (That part is no big deal; just an
    observation. But the Dim step-over though is what can get
    annoying).

    Other Debugger suggestions
    I'd like to be able to place the cursor on a variable in the
    code, and have it display the value, like VB does with the yellow
    tool-tip type of thing. This is a great time saver. Then you
    don't have to constantly add and/or remove variables to the watch
    list. You would just place the cursor on the variable you are
    interested in. I think someone suggested drag-and-dropping of
    variables to the watch window. I can settle for that too if the
    above can't be done.

    Commented lines should have a different color in the debugger,
    just like in the IDE. Sometimes while debugging, I can't figure
    out why it suddenly skips a few lines of code. Then I scroll to
    the left and realize that those lines had been commented out.
    The limited debugger view compounds this problem.

    It would be nice to deal with just one source code listing,
    instead of having to switch between the IDE listing, and the
    debugger listing (that one being hard to navigate).

    PB/CC Execute problem
    I haven't really used PB/CC much (I almost forgot I even had it).
    But I was trying out the PRINT statement, and the sample Hello
    World program. When I run it from the IDE, the DOS box flashes
    and disappears. It would be nice for it to wait for you to press
    a key before exiting the DOS box if you're running it from the
    IDE.

    Functions shouldn't need to be declared in order.
    If memory serves me correctly, in the DOS version of PB, I could
    create functions in any order. But in PB/DLL I either have to
    write the functions in order of use, or Declare them at the top.
    I noticed that this isn't the case for Subs, so I figure it
    shouldn't technically be necessary for functions either.

    -- Misc wish items: --

    Split-screen editing
    Sometimes I make changes towards the top section of the source
    code which require changes to an area towards the bottom.
    Scrolling back and forth is not too convenient. VB's IDE
    provides a good example of split-screen editing which allows you
    to work on two sections of the same code simultaneously.

    InStr Enhancement
    VB has an optional argument for InStr which lets you compare two
    strings without regards to their case (upper/lower case). This
    would probably be more efficient than something like
    "InStr(UCase$(txt1$), UCase$(txt2$)). This concept can be
    extended to other PB string functions as well. (For my own math
    parser, I've developed a hybrid InStr which supports both PB and
    VB's syntax).

    Variant MsgBox
    I know PB doesn't support variants, and it doesn't need to. But
    it would be nice if I could accept a numeric argument for MsgBox
    without always having to surround it with Str$(). I want to be
    able to use it like the PRINT statement for DOS (I think PB/CC's
    PRINT allows this as well).

    Wizard.
    This doesn't need to be anything too fancy. But sometimes I want
    to quickly create a program. But then I have to type a lot of
    code before I can start even something simple. PB should provide
    several templates. There would be a template for a standard DLL
    file, another for .EXEs. It would add the oppropriate LibMain or
    PBMain declarations, and Option Explicit (if you set that option
    on), and optionally a list of Include files (that I can add or
    remove from the template).

    End Function automatic completion.
    When defining a function, it would be nice if when I pressed
    enter after "Function MyFunction() As Long" PB would automatically
    add a line which says "End Function", like VB does. Same for
    Sub. Also if you have a Sub and later change it to a Function,
    it would be nice for PB to change the "End Sub" line to
    "End Function". These are small shortcuts but they save time in
    the long run.

    Combine Option Explicit with Def[...]
    A number of my function definition lines are too long with things
    like "As Long" (no pun intended) and ByVal appended to each
    argument, and Alias followed by the same function name etc...
    I'm not sure what kind of syntax you'd implement for it, but
    whichever way, with the above option I can do:
    "Function MyFunc(ByVal a)"
    instead of
    "Function MyFunc(ByVal a As Long) if there was a way to combine
    DefLng with Option Explicit. See further comments below for
    ByVal et al.

    #Option ByVal
    If most of the arguments in my functions will be passed ByVal
    instead of the default ByRef, then I'd like an option like this
    so that I don't have a bunch of ByVals in the code. In my code,
    a number of lines with ByVals in it are longer than the screen
    width. It can be further enhanced by allowing you to specify
    which data types would be ByVal or ByRef by default. I actually
    have a lot of AsciiZ arguments, and those I pass by reference.
    So maybe I'd have two lines like this:

    #Option ByVal Long
    #Option ByRef Asciiz

    Scale down need for Alias
    Alias for exported functions is useful. However, when all of my
    exported subs/functions require an alias with a duplicate of the
    same function name, it seems redundant. PB should export
    functions using the literal letter case used in the code,
    unless explicitly aliased otherwise.

    The Open File menu should remember the current directory.
    If I open a file, and then open another, it would be nice for it
    to start from the same directory, instead of the C:\ root
    directory. Or perhaps there should be a way to set a default
    project directory.

    Compiler warnings.
    If there is a syntax error the compiler stops, and indicates the
    error. However, it would be nice for it to also have a list of
    warnings for things that aren't a syntax error, but can
    potentially cause a problem. A specific example I have in mind
    is if I have a global variable, and I declare a local variable of
    the same name, it should warn me of the potential problem. A
    programmer may specifically want to use the same name for a local
    variable, or it might be done accidentally by the programmer as
    an oversight.

    Don't save before running or compiling.
    If I remember correctly, in the DOS version of PB, I could make
    temporary changes to a program and run it, without saving those
    changes first. I want to be able to do the same in PB/DLL.
    Likewise sometimes I want to create a quick program just to do a
    simple task, but before I can run it, I unfortunately have to
    select a directory, and then make up a file name, and then
    erase it afterwards (or else become creative in continually
    finding unique names). This isn't very convenient.

    Allow CodePtr for a label from a different function.
    I made use of this in PB 5 after checking with tech support to
    make sure it was safe. But PB 6 removed this feature. Apparently
    it was done to allow label names to be local to each function,
    which is a fine idea. But the PB 5 feature can be re-instated
    without breaking anything if you have it so that the external
    function name can be specified. For instance:
    I = CodePtr(MyFunction.MyLabel). If you need clarifications on
    how and why I want to use this let me know. It has an important
    use in something I want to do.

    Mention the words "Line" and "Column" at the bottom.
    In the bottom right of the IDE, there are two numbers. When
    you're towards the top of your source code, or in the case of a
    short program, it is not obvious which number represents what.
    There is more than plenty of space in the status bar to precede
    the numbers with their description. There is probably other
    useful info that can be placed on the long mostly empty status
    bar.

    Equates of local scope
    Sometimes I may need equates that are local to a function, for
    the same reason I would need to define local variables without
    worrying about coordinating names between functions.

    Remove need for constant specifiers symbols for equates.
    You'd probably make this optional, in case others prefer the
    required % before numeric equates.

    Equates for other data types
    I want to be able to create an equate for floating point and
    other types.

    Way to comment a block of text.
    I use the ' character to comment a line, and $IF 0 for a block.
    However $IF 0 is not as good. The IDE changes the case of words
    I type in that block, if they happen to be keywords, against my
    will. Also it doesn't change the overall color of the commented
    block to make it easily identifiable, like other comments.

    Assume $Compile Exe implicitly.
    If I want to quickly write a simple program and I use PBMain,
    then the compiler should implicitely compile as an EXE file
    without me having to type that line.

    Replace$ function
    Sometimes one may need to get a new string with the Replaced
    value without modifying the original string. Replace$ should
    optionally work as a function (just like MID$ can be a statement
    or function).

    Enhance Sub/Function box
    The Sub/function box at the top right of IDE allows you to jump
    directly to a function. This is great. Now if I manually move
    into a function, then that box should be updated to reflect the
    current function that I'm in also.

    Enhance Extract$ and Remain$
    Make it support a negative first argument, so it can start from
    the end. This would seem like a natural extension to these
    functions, which would make it work like other PB string
    functions.

    StrConv
    VB has a StrConv function which does several things, including
    converting from Unicode. Such a function might be somewhat handy.


    --- Documentation issues: ---

    "Regular Expression" links to the REGISTER topic.
    There are two links under "Regular Expression" in the help file
    index. One of them goes to REGISTER, which seems to be an
    unrelated topic.

    Is _ (underscore) a valid character for use in variable names?
    It appears to be. If so, it should be clearly documented in the
    help file for naming convention (for variables, functions, etc...).

    Can UDT elements share the same name as a function or PB
    keyword?

    I haven't tried but it I assume it should work. Either way,
    it should be documented.

    List the Equate Values for Libmain.
    The LibMain topic lists equates, such as %DLL_PROCESS_ATTACH,
    etc... I don't want to $Include the large WIN32API.INC for every
    project, neither is it fun to fish out that information from that
    file when in a hurry. And I shouldn't have to memorize these
    values.

    Include "All Data Types" or "Data Type Summary" under the
    Data Types listing in the Help file Contents section.

    This information is actually there, but it's under another
    heading, making it harder to find when I need it.

    What does "Animate Delay" do?
    In the Window / Options / Compiler menu, there's a box which says
    "Animate Delay". When I drag the question mark to that box, it
    comes up with a blank help topic.

    The PB/CC help file should clearly list what sets it apart from
    PB/DLL

    (likewise with the PB/DLL help file).

    Do numeric equates, which are preceded with % support only
    16-bit integers?

    The answer should be documented.

    Group function type listings.
    The way the help file is currently organized, it is difficult for
    instance to find out all the string-related functions. The
    Contents section of the help file, and/or the index should have a
    categorized list of functions. For instance "String functions"
    would list all string-related functions; Math Functions would
    list all math-related functions, etc... The VB help file (VB 5)
    has a good example of how it can be organized, under "Keywords by
    Task".

    Include a "What's New" section.
    It would list new features, as well as existing features that
    were enhanced. This is very important. There are features that
    I stumble upon that I wouldn't have known about simply by browsing
    the help file. And sometimes I may already be familiar with a
    particular function and miss out an neat enhancements that were
    added to it in the latest version.

    Change name of VB topic
    from "Working with Visual Basic" to "Visual Basic, Working with".
    It would be much easier to find in the help index that way.

    UDT confusion
    The second paragraph seems to say that a User Defined Type cannot
    include an array element, but later it gives an example of how to
    do just that. Also, later it says that two-dimensional array
    elements of a UDT must be defined with constant dimensions. It's
    not clear if it's the same or different for a 1 dimensional array.
    And can a UDT array element be defined with a lower bound?

    Explain how AND and OR do bitwise and boolean double-duty
    The document states that these operators serve for both boolean
    and bitwise calculations. But it doesn't explain how it determines
    which one to use. The explanation is not obvious, and not trivial,
    especially if one works back and forth with VB and PB, as they
    handle it differently. In VB, if I have A = &B101 and B = &B010,
    and then use:

    If A AND B Then ...

    Instead of doing a boolean operation as I'd expect
    (True AND True = True), it does a bitwise AND, and returns a
    zero (False). After running across this subtle but potent
    problem in VB I always explicitly use relational operators
    when AND or OR are present. For instance:

    If A>0 AND B>0 Then ...

    All this time I assumed that PB had the same problem, but it
    seems like PB knows when to do a bitwise calculation, and when to
    do a boolean operation. But I haven't really tested it in too much
    depth to be sure. So it would help if the documentation could
    clearly state how it differentiates between a boolean and a
    bitwise expression. And you can mention the difference between
    VB and PB on this issue in the doc file.

    ------------------
    Daniel Corbier
    UCalc Fast Math Parser
    http://www.ucalc.com
    Daniel Corbier
    uCalc Fast Math Parser
    uCalc Language Builder
    sigpic

  • #2
    I won't try to address all of your items, but...

    > The compiler doesn't check array dimensions.

    That is definitely by design. It allows multi-dimensional arrays to be addressed "linearly" as well, which is a useful function. Especially considering that certain functions like ARRAY SCAN always treat arrays as having one dimension. (I understand that this will be documented better in the next version on the help file.)

    > PB/CC Execute problem

    IMO that would cause as many problems as it solves. Personally I would not like it if I had to manually close every program I run in the IDE, whether it is PB/CC or PB/DLL. The easy solution is to add a WAITKEY$ to the end of your program. Or SLEEP.

    > Functions shouldn't need to be declared in order.
    > I noticed that this isn't the case for Subs, so I
    > figure it shouldn't technically be necessary for
    > functions either.

    The CALL keyword tells the compiler that a "word" is a sub, so it can continue. Without that it can't be sure whether a word is an undeclared variable, or a function that it hasn't encountered yet, or a simple typo. Which error message should it display?

    -- Eric


    ------------------
    Perfect Sync Development Tools
    Perfect Sync Web Site
    Contact Us: mailto:[email protected][email protected]</A>
    "Not my circus, not my monkeys."

    Comment


    • #3
      Daniel,

      I've gotten into the habit of adding leading spaces before every
      use of a variable in my code. The Find feature works then, also
      CTRL-Left & CTRL-Right when moving the cursor from word to word.

      Code:
      Call MySub(Var, MyVar)  --->  Call MySub( Var, MyVar)
      If PB can add the Split Screen editing, I'll agree with you about
      the auto-updating of the Sub/Fn box. Otherwise, I enjoy begin able
      to CTRL-PgUp to edit equates/globals at the top of my file and then
      use the Sub/Fn box to return to where I was.

      I like the explicit (%) declaration of equates.

      Otherwise, your list seems very reasonable to me.

      ------------------
      Bernard Ertl

      [This message has been edited by Bern Ertl (edited March 12, 2001).]
      Bernard Ertl
      InterPlan Systems

      Comment


      • #4
        I really dislike ANY option... except Option explicit.
        It's therable if you get an include file with option base 1 for example.
        Never liked Defint or else.

        in my vision they never should be invented in the first place.


        ------------------
        hellobasic

        Comment


        • #5
          Quite the list! Thanks.

          Tab setting doesn't work for all blocks.
          Actually, it does, but the current auto-indent handling uses a somewhat idiosyncratic
          approach with variable-sized indentations according to the length of the keyword used
          to start the block. This is likely to change in the future.

          Search engine problem.
          If I have lines such as: "Call MySub(Var, MyVar)", there is no
          way for me to successfully do a search for "Var" using PB's find
          button. If I search for "Var" without "Whole Word" matching,
          then it finds "MyVar" also, and if I do Whole Word matching, it
          skips over it entirely.
          The IDE expects a "whole word" to have white space on either side. This is also
          likely to be subject to future adjustment.

          Keyword mixed case doesn’t always work.
          A few keywords aren't capitalized by the IDE. This will be fixed in the next
          update.

          if I have a global variable, and I declare a local variable of
          the same name, it should warn me of the potential problem.
          A common technique here is to use an appropriate variable naming scheme to help you
          differentiate by scope. For example, prefix all global variables with "g_".

          The Sub/function box at the top right of IDE allows you to jump
          directly to a function. This is great. Now if I manually move
          into a function, then that box should be updated to reflect the
          current function that I'm in also.
          This is already on the wish list. It appears that implementing this might impose
          a significant performance penalty, however, so it may not be practical.

          Is _ (underscore) a valid character for use in variable names?
          An underscore is a valid character in any symbol name (although symbols must
          begin with an ASCII letter). Yes, the requirements for symbol names should be
          better documented.

          Can UDT elements share the same name as a function or PB
          keyword?
          Function, yes. Keyword, no.

          What does "Animate Delay" do?
          It specifies the delay between steps when you use the Animate option in the
          debugger.

          Do numeric equates, which are preceded with % support only
          16-bit integers?
          Any integers (up through 64-bit QUAD).

          Explain how AND and OR do bitwise and boolean double-duty
          All such operators are inherently bitwise in BASIC. The exception is in the
          use of AND in a PowerBASIC conditional statement, where evaluation is done
          in a Boolean fashion by default (to allow for early-out optimization). Use
          parentheses around the conditional expression to force bitwise evaluation
          in all cases. Yes, this will be covered in more detail in future revisions
          of the docs and help files.



          ------------------
          Tom Hanlin
          PowerBASIC Staff

          Comment


          • #6
            Tom, is the "early-out" optimization the same as "short-circuit"
            evaluation (as explained in the MSDN), where the second argument
            is not evaluated if the first argument of AND is false? You
            mentioned the optimization for AND, but is it also done for OR?
            For instance:

            If A=1 Or SlowFunction(A) = 10 Then ...

            Would it skip the second argument? If not, I'd like to suggest
            that as a feature. Perhaps there might be some complications
            which would make it difficult to implement. I noticed that in
            the .NET version of VB, it seems like they will separate the
            functions so that you have "AND" (boolean AND) and "BitAnd",
            and "OR" separate from "BitOr". But if PB can do it with one
            operator for bitwise and boolean, then it's even better.

            As for the Whole Word search, I do hope that it is changed.
            Bern suggested adding a space before variable names. But the
            problem is extended to commas and quotes as well. For instance
            consider:

            Dim A As Double, B As Double, C As Double

            Now I want to Search/Replace the word Double with Long. That
            won't work either. You'd have to make it work around parenthesis
            (opening and closing), brackets, quotes, commas, etc... Although
            I haven't verified it just now, I'm pretty sure that the various
            IDEs I've used, and Wordprecessor, Wordpad, Notepad, Browser type
            programs, likely all do Whole Word searches the way I had in mind.

            Eric, VB doesn't seem to mind the order of function definitions.
            So I figure it must be possible with PB as well. Perhaps it
            would require a second pass, and take a fraction of a second
            longer to compile, which would not bother me. PB can include an
            IDE option that you can toggle depending the programmer's
            preference on the matter. I tend to have a preference for fewer
            and shorter lines of code (w/o sacrificing legibility) to
            accomplish the same task.

            PB can have an IDE option for Waitkey$ for PB/CC. That way we
            both would have it the way we want it. Or if PB implements the
            Template idea, then one can add Waitkey$ to the start-up
            template. The template would have the PBMain declaration, along
            with whatever you usually want to start up with. When I want to
            just print something out real quick, I find myself loading VB
            to do it, because it takes fewer keystrokes. If PB's quick
            load-up time was combined with an optional start-up template
            that would be ideal.

            Concerning array dimension checking, if it's by design then that's
            fine (as long as it's documented). But I found some other little
            things, which I'm not sure would be by design. Consider the
            following code, for instance, which compiles without a problem:

            Code:
            $Compile Exe
            Option Explicit
            
            Function PbMain()
               Dim MyArray(10) As Long, MyArray(10, 10) As Long
               Dim OneDim(10) As Long, Answer(10) As Long
               Dim Answer As Long
            
               Answer = OneDim(1, 2, 3)
            
            End Function
            Notice the duplicate definition of MyArray; OneDim is
            declared with one dimension, but used with 3, and Answer
            is declared both as an array and as a regular variable.

            ------------------
            Daniel Corbier
            UCalc Fast Math Parser
            http://www.ucalc.com
            Daniel Corbier
            uCalc Fast Math Parser
            uCalc Language Builder
            sigpic

            Comment


            • #7
              "Early-out evaluation" is also referred to as "short-circuit evaluation", yes.
              Also yes, this is automatically done for OR operations. No special handling is
              needed in that case, because the "truth" of a bitwise OR is the same as the
              truth of a Boolean OR. Such is not the case for ANDs, which is why PowerBASIC
              optimizes further by assuming a default of Boolean ANDs in conditionals.

              Yes, it would require at least one additional pass by the compiler to avoid
              the need to declare functions if they are referenced before they are
              encountered in the code. No, this is not the sort of modification that is
              likely to be undertaken lightly.

              There is no problem with DIM'ing Answer as both an array and a scalar
              variable, as it will always be clear to both the compiler and the programmer
              which one is referenced. I'm not sure why duplicate DIMs of MyArray go
              through. I'll refer it to R&D.

              ------------------
              Tom Hanlin
              PowerBASIC Staff

              Comment


              • #8
                Code:
                '#Register NONE 'required with FLUSH (hopefully reported)
                DIM ALL
                #COMPILE EXE
                FUNCTION PBMAIN AS LONG
                  DIM Count AS LONG
                  OPEN "DATA" FOR BINARY SHARED AS 1
                  MSGBOX "Count before flush" + STR$(Count&)
                  FLUSH #1
                  MSGBOX "Count after flush" + STR$(Count&)
                END FUNCTION
                ------------------
                How long is an idea? Write it down.

                Comment


                • #9
                  Thanks Mike, but that one has been known for some time, and it has been discussed on the BBS a few times too.

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

                  Comment


                  • #10
                    Wishlist for PBDOS, PBCC en PBDLL

                    Build-in or Adding : DEFAULT PARAMETERS and OVERLOAD ROUTINES

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

                    Comment


                    • #11
                      Lance,
                      A post somewhere on known problems would be
                      useful. Newer users wouldn't know about flush.



                      ------------------
                      How long is an idea? Write it down.

                      Comment


                      • #12
                        Understood, however, responsibility for such a posting is under control of R&D and PowerBASIC Management, not Tech Support.

                        To be clear, the problem with FLUSH is that it can corrupt a register variable, so using #REGISTER NONE just within the SUB/FUNCTION that FLUSH occurs solves the problem.


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

                        Comment

                        Working...
                        X