Arc Forumnew | comments | leaders | submitlogin
3 points by pg 6119 days ago | link | parent

By optional, do you mean optional type declarations like you might get with this?

  (mac declare args
    `(do ,@(map (fn ((x y))
                  (w/uniq g
                    `(let ,g ,y
                       (unless (isa ,g ',x) (error "Bad type." ',x ,g)))))
                (pair args))))
For user-defined typing, do you need something more than annotate?


5 points by Jekyll 6119 days ago | link

Qi is completely type inferring, so it proves the type correctness of the code at compile time from a minimum number of declarations, like the ML family of languages.

However, as this is optional, it can also be switched off in places to handle code that the type system can not prove correct.

To make a similar system work, you'd have to label the inputs and return type of each function, and enforce the consistency of this, all at compile time. There is a complete prolog system buried in QI allowing the types to self reference and be turing complete in terms of complexity.

Having said that, the whole of QI is only meant to be 4k lines of common lisp and under an MIT license, so it'd be quite easy to port the interesting bits of it once the core of arc has stabilised.

-----

1 point by ryantmulligan 6118 days ago | link

pg, I was referring to Jekyll's explanation of optional typing. The 'maybe' means that I don't know the value in it, I've just heard that some people like it.

-----

2 points by jules 6116 days ago | link

How can Qi be type inferring when its type system is turing complete?

-----

1 point by Jekyll 6115 days ago | link

IRC, the type inference is not guaranteed to terminate in pathological cases.

-----

0 points by jules 6062 days ago | link

You mean type checking.

-----