-
Notifications
You must be signed in to change notification settings - Fork 0
Possible Heuristic errors to be corrected

The screenshot shows one example of a pervasive problem in F#
The parseNumExpr function looks OK, but is missing a closing bracket. This is detected only AFTER the function ends, with error message there that does not easily locatethe missing closing bracket.
Needs fising with heuristics to detect when something like this is probably a missing closing bracket 9and if possible where it is).
Deterministic: missing spaces around “;” in lists: [a;b] -> [a ; b ] This is stylistic (not error related) since parse is same, but F# style guidelines state you should always have spaces
Heuristic:
let f a b c =
a * (b + c
let g a b = b*b
g aThis will be parsed with two errors that are not clear: a heuristic would suggest a closing bracket at the end of the a * (b + c. Of course this might be wrong, maybe something else was intended, but it is the most likely solution.
Bracket mismatches are particularly likely in complex bracketed expressions, in this case the wrong brackets can lead to valid parse with values that have a correct but unusual type – e.g. high order functions. Again a heuristic could suggest possible changes, with reasons. The point about heuristics is that the suggestions are often correct but may be wrong.
Another type of heuristic would identify expressions that are too complex and suggest a refactoring with an intermediate value to simplify. Here the idea is to get more readable code.
Another type of heuristic would replace anonymous functions used in complex expressions by named subfunctions: this often makes code easier to analyse and read.
Here a suggestion is probable if in typical coding it is likely to be the correct answer, has high utility if it resolves a parse error otherwise difficult to detect. Typically there will be some complex errors that are difficult to detect where such suggestions will be more valuable.
One of the issues in F# is that intellisense means you tend to pay attention only to parse errors above the current edit point: these will be precise. Using this info it is possible to be very mislead, even though if you looked at the parse below the current edit point as well it might resolve the issue. These errors should be detected if possible. They are too complex for me easily to find you one! They can however lead to a long time staring at code not understanding why a parse error exists. Look out for things that cause difficulty as you learn F#
-
Research
-
Implementation
-
Weekly Reports
-
Meeting Feedback