digego / extempore

A cyber-physical programming environment
1.41k stars 127 forks source link

Useful messages for keyword misuse #264

Open zygurt opened 8 years ago

zygurt commented 8 years ago

As per this thread on the google group: https://groups.google.com/forum/#!topic/extemporelang/Oa527GfZKYI

Trying to create an allocate memory to pointer 'array' gives error of "Could not resolve types!::is_empty unresolved:make-array". A use of keyword error would be good.

digego commented 7 years ago

;; this fails because 'array' is a reserved xtlang keyword (and we aren't checking for reserve keyword usage!!!) (bind-func is_empty:[i64,float,i64] (lambda (array:float* size:i64) (let ((n:i64 0) (stop:i64 1)) (while (and (< n size) (= stop 1)) (cond ((= (pref array n) 0.0) (set! n (+ n 1))) (else (set! stop 0)))) stop)))