Skip to content

Instantly share code, notes, and snippets.

@nurse
Last active February 28, 2018 11:53
Show Gist options
  • Save nurse/4324519 to your computer and use it in GitHub Desktop.
Save nurse/4324519 to your computer and use it in GitHub Desktop.
ぼくの考えた最強のRuby新機能案

ぼくの考えた最強のRuby新機能案

野心的な新機能案や、互換性等の理由でおよそ採用されないであろう夢を書き連ねています。

Remove Fixnum and Bignum

Fixnum と Bignum を削除して、Integer クラスに統合する。両者は Flonum のように内部的に切り替えられる。

1 / 2 is Rational

Integer#/ の結果を Rational で返すようにする。 https://bugs.ruby-lang.org/issues/5512#change-37021

0.1 is Rational

0.1 を浮動小数点数リテラルでは無く、有理数リテラルにする。 http://www.slideshare.net/mrkn/float-is-legacy

IANA tzname on Windows

Windows で Time#zone を tzdata の名前で出す。

Time.localでzoneを無視しない

そのままzoneに入れる

rubypath

Get the absolute path of ruby binary https://gist.github.com/nurse/1129437

SEGV時のスレッドダンプ

SEGV時にスレッドのリストなどを表示する

C拡張ライブラリサポートの廃止

https://twitter.com/_ko1/status/305339352307863556

日次・時刻計算の強化、時間型の追加など

Time calculating APIs

Time.offset_localtime / Time.offset_at

TimeWithZone

Joda time

https://bugs.ruby-lang.org/issues/7114

Concept

一連の機能を備えているかどうかを宣言するようなやつ

GoのInterfaceだなこれ

並行・並列

  • HTM 対応
  • Array#peach とか

mswin64 の long 対策

  • struct RString 等の long を ssize_t とかに変える

blockの開始位置・終了位置

  • assert_separately で欲しい

Typed Array

and と or の結合則

  • and の結合順位を or より上げる

MSVC14 (Universal C Runtime) の綺麗な対応

https://github.com/ruby/ruby/pull/884/files https://connect.microsoft.com/VisualStudio/feedback/details/1279133 http://d.hatena.ne.jp/nurse/20150426#1430026878

Unicode Support for Windows Command Line

https://bugs.ruby-lang.org/issues/2255

IO#each_line_without_lf

Dir#foreach_without_dot_and_dotdot

https://bugs.ruby-lang.org/issues/12010

WindowsでSleep()などのexportをやめる

Change Filesystem encoding to UTF-8 on Windows

ARGVもだな

Hash#compact

Use PowerShell

呼び出し元がprivateかを見て利用するdelegate

rails/rails#31944

Soft Typing for Arguments

diff --git a/parse.y b/parse.y
index 02529f4..1add807 100644
--- a/parse.y
+++ b/parse.y
@@ -4667,7 +4667,16 @@ f_bad_arg        : tCONSTANT
                    }
                ;

-f_norm_arg     : f_bad_arg
+f_arg_type     : tCONSTANT
+               | tCONSTANT '|' f_arg_type
+               ;
+
+f_norm_arg     : f_arg_type tIDENTIFIER
+                   {
+                       formal_argument(get_id($2));
+                       $$ = $2;
+                   }
+               | f_bad_arg
                | tIDENTIFIER
                    {
                        formal_argument(get_id($1));

speed up Time calculation

  • improve implemantations around wideval_t.

binding.irb

Where toplevel constants are defined?

akr: 今はトップレベルの定数(クラスも含む)はObjectに定義されているが、レキシカルスコープの外側、例えばmainに定義するのでもよかったのではないか。 ko1: すでにObject経由でいじっているコードが大量になるのでRubyで本当に導入するのは難しい https://bugs.ruby-lang.org/issues/11547

WishList & ToDo

links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment