Announcement

Collapse
No announcement yet.

need a compiler warning

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

  • need a compiler warning

    In the code below:

    PHP Code:
    function preMain() {
        
    _init true;
    }

    var 
    _init true;

    function 
    main() {
        if(
    _init) {
            
    // If sym is renamed sym1 then we hit the final debug()
            // function at the bottom
            
    var sym getSymbol().split(" ");
            if(
    sym[0] != "ES") {
                
    debugPrintln("symbol is ES");
            }
            else {
                
    debugPrintln("symbol is not ES");
            }
            
            
    _init false;
        }
        
        
    debugPrintln("before test function");
        var 
    ff close(0sym("nq #f"));
        
    debugPrintln("after test function");

    the final print statement isn't hit because sym() blows up because I've used a var called sym ealier on.

    Not sure if this is intended functionality or not. If it is intended functionality then it would be useful if the pre-compiler or syntax checker could make sure that certain keywords weren't used in a context which they shouldn't be used such as here. Or perhaps generate a meaningful message to help track down such erroneous coding.
    Standing on the shoulders of giants.
Working...
X