- src/lexp.ml
- Added a new lexp `AttributeTable`
- Modified multiple functions to handle the new lexp
- src/lparse.ml
(circular reference issue)
- moved special forms implementation from builtin.ml to lparse.ml
- probably that builtin.ml will be removed soon
- finished the implicit arguments lookup
- btl/types.typer
- called our attribute table simply `Attribute`
- src/opslexp.ml:
- replace `AttributeTable` by a dummy during type erasure
- src/debruijn.ml
- removed old property_environment and related functions
Please write your commit messages in the present tense, i.e. describe what the change *does*. E.g. "Add a new lexp `AttributeTable`".
expand_dmacro_ : Macro -> List Sexp -> List Sexp; expand_dmacro_ m args = case m
- | DMacro_ f => (f args);
- | DMacro_ f => (f args)
- % Wrap a Macro in a list of Sexp if Macro_ is used
- | Macro_ f => cons (a := Sexp) (f args) (nil (a := Sexp));
The (a := Sexp) args shouldn't be needed any more nowadays.
===================================== samples/bugs.typer ===================================== --- /dev/null +++ b/samples/bugs.typer @@ -0,0 +1,8 @@ +x = 2.0; +y = 2; +% This produce the same error +% While I think the first one should say "x" has the wrong type +% and the second should say "Integer::mult expects Integers as arguments" +% i.e `hastype` should force type checking +main = (x : Int) * y; +main = x * y;
I don't know what you mean by "`hastype` should force type checking". But I think the error message will be the same in both cases for the foreseeable future (the type of `*` already tells us the arg is of type `Int` so the hastype makes no difference), and I definitely don't consider this as a bug.
Currently we get
[!] Error LPARSE Type mismatch! Context expected `Int` but expression has type `Float`
with a line+column pointing at the `x` variable. We could improve it by giving the start *and* end of the expression (in this case, the expression is a single char, so it wouldn't help much, but in general it's helpful), and we could improve it by making the "context" a bit more precise (i.e. pass to `Lparse.check` not just the expected type, but some "context description" which in this case could be something like "1st arg of `*`").
\ No newline at end of file
[ Try and terminate your files with newline, as god intended. ]
- | AttributeTable of lexp AttributeMap.t * ltype
You haven't added the corresponding code to all the functions that do `match` on a lexp (e.g. OL.check, OL.whnf, ...), so I'm not sure exactly what is the corresponding intended meaning. Please try and avoid `this pattern-matching is not exhaustive` warnings.
| AttributeTable _ -> e
in push_susp, this looks wrong.
The more I look at it, the more I think AttributeTable should not be a new `lexp` element, but should be a new builtin type, with corresponding built-in functions. This way, we don't need to change whnf, check, and whatnot.
Stefan