< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #11529 has been reported by Eike Dierks.
----------------------------------------
Feature #11529: extensible % literal declarations
https://bugs.ruby-lang.org/issues/11529
* Author: Eike Dierks
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
The ruby syntax provides for declaring literals by using the % escapes:
- %q(foo) => 'foo'
- %Q(foo) => "foo"
- %w(foo bar) => ['foo', 'bar']
- %i(foo bar) => [:foo, :bar]
It should be possible to define new % escapes.
*Use cases:*
I currently use:
%q{select foo from bar}
to quote my sql statements.
It would improve readability to spell that:
%sql{select foo from bar}
(with %sql being an alias of %q [see parsing problems below])
But there could be more interesting uses:
%hash[
a 1
b 2]
%triples[
a b c
1 2 3]
%json/{"foo":"bar", "zip":"zap"}/
%octal_data[012 345 677]
and the extension code would be something like
def %hash(s)
return ...
end
Notes:
- I did expect this to be a problem. But it's not.
- in my faint memory, old ruby versions were rumoured to parse %sqfooq => "foo"
but this is no longer true: %sqfooq => SyntaxError: (eval):2: unknown type of %string
- the characters used for enclosing should be clearly defined
- we have two classes:
-- paired chars like () [] {} <>
-- quoting chars like ' " / @ _ # $ %
My Suggestion:
- the quoting chars should be deprecated (try this: %Q%%%%)
- the set of paired chars should be extended to include selected pairs from unicode math symbols
- unicode does not yet define a plane for open-close-brackets
- see http://stackoverflow.com/questions/13535172/list-of-all-unicodes-open-close-brackets
--
https://bugs.ruby-lang.org/