From: "Martin J. Dürst" Date: 2020-09-27T16:56:39+09:00 Subject: [ruby-core:100185] Re: [Ruby master Feature#16994] Sets: shorthand for frozen sets of symbols / strings Hello Eric, others, On 26/09/2020 05:04, Eric Wong wrote: > matz@ruby.or.jp wrote: >> Remaining issues: >> >> * Name? `%ws` would be the first two character specifier after `%`. Is it reasonable? Or should we seek another name? >> * Frozen? `%w` returns non frozen array of non frozen strings. How should `%ws` behave? > > How about suffix notation similar to Regexp modifiers? > > [ 'foo', 'bar' ]s Whatever the actual syntax, it would be better to have such specifiers up front. Array/Hash/Set literals can be quite long. (Regexps can also be quite long, but in that case, they usually use whitespace/linebreaks (and a /x at the end), and are therefore easy to spot from the first line.) Regards, Martin. > Or with ability to specify ordering: > > [ 'foo', 'bar' ]os # ordered set > [ 'foo', 'bar' ]us # unordered set > > Fwiw, I sometimes wish I could use unordered hash to save space: > > { 'foo' => 'bar' }u > > And maybe 'f' modifier for frozen strings of values > >> https://bugs.ruby-lang.org/issues/16994#change-87685 Unsubscribe: