
On Wed, Oct 23, 2019 at 8:33 PM Steven D'Aprano <steve@pearwood.info> wrote:
The most complicated feature I can think of is whether we should allow escaping spaces or not:
names = %w[Aaron Susan Helen Fred Mary\ Beth] names = %w[Aaron Susan Helen Fred Mary%x20Beth]
The second one? No. If you want that, use a post-processor or something. Using a backslash to escape a space would be a decent option, but I'd also be fine with disallowing it, if it makes it easier to define the grammar. If this syntax is restricted to a blank-separated sequence of atoms ("NAME" in the grammar), it will still be of significant value, and there's always the option to make it more flexible in the future. But I'm not a fan of the %w syntax. If it comes to selection of colour for the bikeshed, I'd rather that the list be created using another variant of the same syntax we currently have for list creation: numbers = [1, 2, 3, 4, 5] from_loop = [x * 2 for x in numbers] names = [from Aaron Susan Helen Fred Mary] "Build a list from this set of words." Every list creation starts with an open bracket and ends with a close bracket. But that's just bikeshedding. ChrisA