defaultxr / cl-patterns

Library for writing patterns to generate or process (a)musical sequences of mathematically (un)related (non-)compound values in Lisp.
https://w.struct.ws/cl-patterns
MIT License
77 stars 10 forks source link

Error "There is no class named COMMON-LISP-USER::PBIND-PSTREAM." #22

Closed TatriX closed 3 years ago

TatriX commented 3 years ago

Hi! If I evaluate this code twice:

(play (pb :pulse
        :instrument :pulse
        :quant 1
        :db -12
        :octave 4
        :degree [0 3 7 10 12]))

I'm getting the following error:

There is no class named COMMON-LISP-USER::PBIND-PSTREAM.
   [Condition of type SB-PCL:CLASS-NOT-FOUND-ERROR]

Restarts:
 0: [ABORT] abort thread (#<THREAD "cl-patterns clock-loop" RUNNING {10051AD263}>)

Backtrace:
 0: (SB-PCL::FIND-CLASS-FROM-CELL PBIND-PSTREAM NIL T)
 1: ((:METHOD MAKE-INSTANCE (SYMBOL)) PBIND-PSTREAM :PLAY-QUANT (1) :END-QUANT (1) :END-CONDITION NIL :PARENT NIL :CLEANUP NIL :PSTREAM-COUNT 0 :METADATA #<HASH-TABLE :TEST EQL :COUNT 0 {10068028D3}> :PAI..
 2: ((:METHOD CL-PATTERNS:AS-PSTREAM :AROUND (T)) (CL-PATTERNS:PBIND :INSTRUMENT :PULSE :QUANT 1 :DB -12 :OCTAVE 4 :DEGREE (0 3 7 10 12))) [fast-method]
 3: ((:METHOD CL-PATTERNS:AS-PSTREAM :AROUND (CL-PATTERNS:PATTERN)) (CL-PATTERNS:PBIND :INSTRUMENT :PULSE :QUANT 1 :DB -12 :OCTAVE 4 :DEGREE (0 3 7 10 12))) [fast-method]
 4: ((:METHOD CL-PATTERNS:AS-PSTREAM (CL-PATTERNS:PDEF)) (CL-PATTERNS:PDEF :PULSE)) [fast-method]
 5: ((:METHOD CL-PATTERNS:AS-PSTREAM :AROUND (T)) (CL-PATTERNS:PDEF :PULSE)) [fast-method]
 6: ((:METHOD CL-PATTERNS:AS-PSTREAM :AROUND (CL-PATTERNS:PATTERN)) (CL-PATTERNS:PDEF :PULSE)) [fast-method]
 7: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN CL-PATTERNS:CLOCK-PROCESS))
 8: ((FLET "WITHOUT-INTERRUPTS-BODY-11" :IN SB-THREAD::CALL-WITH-RECURSIVE-LOCK))
 9: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK #<FUNCTION (FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK :IN CL-PATTERNS:CLOCK-PROCESS) {7FB2197DE64B}> #<SB-THREAD:MUTEX "Anonymous recursive lock" owner: #<SB-THREA..
10: (CL-PATTERNS:CLOCK-PROCESS #<CL-PATTERNS::CLOCK :tempo 1 :beat 12.0> 1/10)
11: (CL-PATTERNS:CLOCK-LOOP #<CL-PATTERNS::CLOCK :tempo 1 :beat 12.0> :GRANULARITY NIL)
12: ((LAMBDA NIL :IN CL-PATTERNS:START-CLOCK-LOOP))
13: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
14: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
15: ((FLET "WITHOUT-INTERRUPTS-BODY-11" :IN SB-THREAD::RUN))
16: ((FLET SB-UNIX::BODY :IN SB-THREAD::RUN))
17: ((FLET "WITHOUT-INTERRUPTS-BODY-4" :IN SB-THREAD::RUN))
18: (SB-THREAD::RUN)
19: ("foreign function: call_into_lisp")
 --more--
TatriX commented 3 years ago

Reverting to c417660 seems to resolve the issue here.

defaultxr commented 3 years ago

I think this is due to the use of symbolicate in 0f26bee8dab56f5757b7af71ff0e4c91cc3cb404; I always forget that it returns a symbol in the current package, not the package of the symbols provided as input. So if you run (cl-patterns:as-pstream (cl-patterns:pbind ...)) in a package that doesn't (use-package 'cl-patterns) then you would get an error like that. I'll revert the use of symbolicate to intern and will push a commit shortly.