Carp/examples/bugs.carp

32 lines
742 B
Plaintext
Raw Normal View History

2017-10-10 14:50:47 +03:00
;; This file contains examples of unsolved bugs
2018-01-30 17:22:07 +03:00
;; (load "Debug.carp")
;; (Debug.sanitize-addresses)
2017-12-15 17:31:56 +03:00
(project-set! "printAST" "true")
2018-01-28 08:17:23 +03:00
;; This shouldn't compile:
;; (defn faulty-repeat [n inpt]
;; (let [str ""]
;; (do
;; (for [i 0 n]
;; (set! &str &(append @str @inpt)))
;; @str)))
;; (defn main []
2018-01-28 08:17:23 +03:00
;; (let [strings (faulty-repeat 20 "x")]
;; (IO.println &strings)))
2018-01-30 17:22:07 +03:00
2018-02-01 19:29:45 +03:00
;; Instantiating generic struct with ref-type fails:
2018-02-02 14:06:34 +03:00
;; (deftype (Triv a) [x a])
;; (defn g [] (Triv.init &123))
;; (defn main []
;; (println* &(g)))
(defn main []
2018-02-02 14:06:34 +03:00
(let-do [t [1 2 3]
t-field (Array.nth &t 1)]
(do
(IO.println &(str @t-field))
(set! &t [4 5 6])
(IO.println &(str @t-field)))))