-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are empty tables prohibited or not? #1697
Comments
My 2c:
|
I think @bennn 's suggestion is great. The error can say “if you really meant to make an empty table, use |
I like it too, with that error message! |
Hmm, counterargument: |
Well, that was the original argument. Why was it ever disallowed? |
I think it was a question of whether the table could grow or not. An empty table with multiple columns could add new rows. Could an empty table with no columns add new rows? Explicitly, is |
Yes, it would seem to me we can have a table of no columns with N rows. Then, when we add a column, we can provide (say) a list of N values and each one would extend one of those empty rows. |
Shriram and I noticed a funny thing about tables the other day!
If you try to create a table with an empty schema using
table: end
, you get the message "This table has no column names, but tables must have at least one column." But that's not true! Because the expression(table: colname row: 3 end).drop("colname")
doesn't throw an error, and gives you a table without columns.The B2T2 spec requires the ability to make tables with an empty schema, so it seems like the
table: end
syntax should work.Originally posted in the code.pyret.org repo, but that was a mistake.
The text was updated successfully, but these errors were encountered: