Opened 10 years ago

Closed 10 years ago

#543 closed defect (fixed)

something funky going on with THE

Reported by: gz Owned by: gb
Priority: normal Milestone:
Component: Compiler Version: 1.3
Keywords: Cc:

Description

From #ccl on irc, user ecyrb:

(defmacro mk-arr (type init &optional len)
  "Make array with elements of TYPE, initializing."
  (if len `(make-array ,len :element-type ,type :initial-element ,init)
      `(make-array (length ,init) :element-type ,type
        :initial-contents ,init)))

(eval '(the (simple-array simple-string (2))
            (mk-arr 'simple-string '("Jan" "Feb"))))

;Compiler warnings : 
;   In an anonymous lambda form: Undefined function MK-ARR 
> Error: Special operator or global macro-function MK-ARR can't be FUNCALLed or APPLYed 
> While executing: #<Anonymous Function #x30004112FDDF>, in process listener(1). 

Change History (3)

comment:1 Changed 10 years ago by gz

  • Component changed from Runtime (threads, GC) to Compiler
  • Summary changed from something funky going on with eval/the to something funky going on with THE

Another way is to invoke it is:

(lambda () (PROGN (the array (mk-arr 'simple-string '("Jan" "Feb")))))

Works ok without the PROGN.

comment:2 Changed 10 years ago by gz

Above case is fixed in r12276, but the following fails:

? (defmacro mk-arr (init) `(make-array (length ,init)))
MK-ARR
? (lambda () (progn (the array (mk-arr '("Jan" "Feb")))))
;Compiler warnings :
;   In an anonymous lambda form: Undefined function CCL::ALLOCATE-TYPED-VECTOR

comment:3 Changed 10 years ago by rme

  • Resolution set to fixed
  • Status changed from new to closed

should work post r12354

Note: See TracTickets for help on using tickets.