brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 110 forks source link

internal error #1660

Closed shriram closed 5 months ago

shriram commented 2 years ago

This program reliably produces an internal error on the second print:

import tables as T
lst-in = [list: "a", "b", "c"]
lst-freq = [list: 1, 1, 1]
fake-table = [T.table-from-columns:
  {"title"; lst-in},
  {"freq"; lst-freq}]

print(fake-table) #returns <table>
print(fake-table.all-rows()) #returns the internal errors message

Credit Milan Capoor for finding it.

blerner commented 5 months ago

Yep -- it's trying to use the ascii-table library to render that list of rows more nicely, but that library isn't available in the browser. I'll put in a temporary textual rendering of rows so that this doesn't crash. It'll render rows as [row: "col1" => val1, "col2" => val2, ...], and I won't update the string rendering of <table>, yet, since figuring that out is precisely what ascii-table does :)