janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
123 stars 35 forks source link

create a table instead of an array to hold the fibers in pmap-full #166

Closed mraveloarinjaka closed 10 months ago

mraveloarinjaka commented 10 months ago

There is a crash when using pmap-full because the list of fibers passed to "join" is an array and not a table. The fix aligns pmap-full implementation to pcall.

error: bad slot #0, expected table, got <array 0x600002C65C40>
  in table/clear [src/core/table.c] on line 411
  in drain-fibers [/Users/mraveloarinjaka/projects/sandbox/aoc2023/jpm_tree/lib/spork/ev-utils.janet] on line 35, column 3
  in join [/Users/mraveloarinjaka/projects/sandbox/aoc2023/jpm_tree/lib/spork/ev-utils.janet] on line 56, column 10
  in pmap-full [/Users/mraveloarinjaka/projects/sandbox/aoc2023/jpm_tree/lib/spork/ev-utils.janet] (tailcall) on line 84, column 3
sogaiu commented 10 months ago

That does look like a mismatch.

Using tabseq seems better and it's what pcall (which also uses join) does -- perhaps that's something that motivated the specific proposed changes :)

Just spelling things out here for other reviewers.

mraveloarinjaka commented 10 months ago

Hello, What are the next steps? It is not clear whether I should amend the changes or if I am missing something.

sogaiu commented 10 months ago

My earlier comment was just saying that the proposed changes looked on the ok side. Sorry if that was unclear.

I think this PR and some others are awaiting the main maintainer's availability -- AFAIU he is pretty busy.