search for: maybe_add

Displaying 2 results from an estimated 2 matches for "maybe_add".

2008 May 24
0
[LLVMdev] Advice on CFG pre-analysis
...ay. I have to agree with earlier poster, I'm not sure altering the type of values is tractable; this seems better as a diagnostic analysis. A way to leverage the type system here might be with 'match' statement like ml's. Consider: type maybe 'a = None | Some 'a let maybe_add x y = match x, y with | Some x, Some y -> x + y | Some n, None | None, Some n -> n | None, None -> None Here, the expressions like 'Some x' and 'None' are patterns, which match different variants of the 'maybe int' type. 'Some x' and 'Some...
2008 May 24
8
[LLVMdev] Advice on CFG pre-analysis
In the language I am working on, there are cases where the call flow graph can affect the type of a variable. A simple example is a "nullable" type (a pointer which is allowed to be NULL), which can be converted into a non-nullable type via an if-test. So for example if x is nullable, and I test x != NULL, then inside the conditional block the type of x is no longer nullable.