ときどきの雑記帖 RE* (新南口)
World of Ptavvs
Modula-2 in GCC
世間一般的にはRustが入る方に注目、なんだろうけど😄
Modula-2 Language Frontend Patches Ready For Merging Into GCC 13 - Phoronix
近刊
一月発売予定らしいものが オライリージャパンの 新刊・近刊情報 にはまだ書名すらもでていない (12月14日時点)のに Amazonでは表紙も出てたりして、 これは一体…
前からこんなだったっけ?
核融合
U.S. to announce major breakthrough in zero-carbon nuclear fusion energy: https://t.co/Dx5JKB8DUE Comments: https://t.co/ZOHtyouDll
— Hacker News (@HNTweets) December 12, 2022
をはじめとして核融合の「ブレークスルー」に関する話題があちらこちらで 出ているけど、今回のこの手法は 「慣性閉じ込め」というものなのね。 レーザーを使ったものというのは以前にも聞いた覚えがあるけど こういう名前がついていたとは知らなかった。
Firefox
Firefoxユーザー必見! ブラウジングを快適化するアドオン10選 | ライフハッカー・ジャパン
コピペ禁止を解除「Absolute Enable Right-Click & Copy」
右クリックでのコンテキストメニューを抑制されて イライラすることがたまにあるのでこれはいいかも。
本文や画像のコピペ目的で出そうとしてるわけじゃないんだがなあ>コンテキストメニュー
正規表現のマッチングアルゴリズムの改善
タイムアウト機能は知っていたけど 「マッチングアルゴリズムの最適化」 はどんなんだろう。
について。
正規表現のマッチングアルゴリズムの改善
Feature #19104: Introduce the cache-based optimization for Regexp matching - Ruby master - Ruby Issue Tracking System
上の正規表現のマッチングは Ruby 3.2 だとタイムアウトを設定しなくても一瞬で終わるけど、Ruby 3.1 だと終わらない。
"a"*30+"X" =~ /\A(a+)+\z/
これでも 13秒くらいかかる。Ruby 3.2 でアルゴリズムが変更されt大幅に改善されたらしい。
というのが出て、そこから
などを見ようと思っていたらさらに
キャッシュによるRubyの正規表現のマッチングの高速化の紹介 - クックパッド開発者ブログ
という記事が出て詳しくそこで説明されていたというオチ。
9月からRuby開発チームにインターンシップとして参加している@makenowjustです。 総合研究大学院大学の学生で、 普段は情報セキュリティに関する研究をしています。
インターンシップでは、キャッシュ (メモ化) を利用したRubyの正規表現の高速化を行いました。 ReDoSと呼ばれる、 バックトラックが爆発することでマッチング時間が膨大になる脆弱性があります (ReDoSについては、 拙作ですがWEB+DB PRESSに掲載された記事があります)。 近年、ReDoSは多く報告されており、 Rubyもその例外ではありません (参考1、参考2)。 今回実装した最適化は、ReDoSを防ぐことを目的としたもので、 多くの正規表現のマッチング時間が文字列の長さに対して線形となります。
Implement cache optimization for regexp matching by makenowjust · Pull Request #6486 · ruby/ruby
なるほど。 この方は確か以前になにかツールを発表していたような… と履歴を探してみる。 これか
makenowjust-labs/recheck: The trustworthy ReDoS checker
GNU C Language Intro and Reference
以前言及した最終成果物には出てこない部分を訳してみるとかと 改めて目を通してみると、最初のパラグラフから
One of the difficulties that users of computers for numerical work face, whether they realize it or not, is that the computer does not operate in the number base that most people are familiar with. As a result, input decimal fractions must be converted to binary floating-point values for use in computations, and then the final results converted back to decimal for humans. Because the precision is finite and limited, and because algorithms for correct round-trip conversion between number bases were not known until the 1990s, and are still not implemented on most systems and most programming languages, the result is frequent confusion for users, when a simple expression like @code{3.0*(1.0/3.0)} evaluates to 0.999999 instead of the expected 1.0. Here is an example from a floating-point calculator that allows rounding-mode control, with the mode set to @emph{round-towards-zero}:
のようにやたらとカンマを使っていて、 「うげー」となり、 それでもさらに読み進めると
Programming languages used for business applications, notably the venerable Cobol language, have therefore always implemented financial computations in @emph{fixed-point decimal arithmetic} in software, and because of the large monetary amounts that must be processed, successive Cobol standards have increased the minimum number size from 18 to 32 decimal digits, and the most recent one requires a decimal exponent range of at least @code{[-999, +999]}.
のように。 一個のパラグラフに見えたものが一つの文だったりするものがあって「なんじゃこりゃ」な状態に。
rmsの書く文章ってこんなだったっけ?
FORTRAN Compiler on IBM 704
クォートネタをまだ引っ張るよ😄
quote
The Evolution of Lisp を見ると、Lisp1.5の辺りでは evalquoteだったのでクォート記号を使わないでも問題なかった?
2.2.1 Early MacLisp
A key difference between MacLisp and Interlisp was the approach to syntax. MacLisp favored the pure list style, using EVAL as the top level. Interlisp, along with Lisp 1.5, used EVALQUOTE. To create a dotted pair of the atoms a and b in MacLisp, one would type this expression to EVAL:
(cons (quote a) (quote b))
or, using the syntactic abbreviation ’x for (quote x),
(cons ’a’b)
In Lisp 1.5, one could type an expression (actually two expressions) like this to EVALQUOTE:
cons(a b)
The “quote” in the name EVALQUOTE signifies the “implicit quoting of the arguments” to the function applied. MacLisp forked off and used EVAL exclusively as a top level interface, while BBN- Lisp (and thus Interlisp) accommodated both, using EVAL if the input was one form and APPLY if the input line was two or more forms.
Remove apostrophe
Perlでは名前空間、というかパッケージ名の区切りにアポストロフィを使っていた
(とは言えPerl5では::
がほとんどだと思うけど)のだけど
いろいろ問題があるので止めようという話が出ているらしい。
- PR on removing ’ (single quote) as package separator (an Ada legacy) was submitted : perl
- RFCs/rfc0015.md at main · Perl/RFCs
- Ada Programming/Delimiters/’ - Wikibooks, open books for an open world
Abstract
Remove support for ’ (apostrophe) as package namespace separator.
login.c
UNIXの login.c は、ログイン時に実行されるプロセスの argv[0] の最初の文字を '-' に変更し、これによりシェルは自分がログインシェルであるかどうかを判定する。この仕様は、約50年前の UNIX v2時代からすでに存在していたことが判明。https://t.co/C7KgB7fLQY
— 新山祐介 (Yusuke Shinyama) (@mootastic) December 11, 2022
このlogin(1)の話、Hacker Newsにあった Unix’s special way of marking login shells goes back to V2 Unix (at least) | Hacker News によるとV1からそうだったらしい?
Goes back to the reconstructed version of V1– from login.s https://github.com/jserv/unix-v1/blob/master/src/cmd/login.s :
mov uid,r0 sys setuid sys exec; shell; shellp ... shellp: mshell 0 ... mshell: <-\0>
記述はアセンブリ言語だけど、確かにそんな感じ。
Verse
以前話題に出たVerse の続報があったようで反応がいくつか。
Haskell などで有名な Simon Peyton Jones 氏らが Epic Games で開発している Verse 言語のプレゼン資料。Haskell 等の関数型と Prolog 等の論理型を融合したような言語になってる。
— MIURA Masahiro (@Dubhead) December 12, 2022
Beyond Functional Programming: The Verse Programming Language https://t.co/IcaQ3osKIU
Unreal Engineの新スクリプト言語Verseの詳細が出てた。仕様もコンパイラもランタイムもオープンソースで提供して他のゲームエンジンでも使えるようなオープンスタンダードを目指すらしい。数十億のユーザーが書くコードにスケール、関数型をメインストリームへ https://t.co/Ghl2BgHG5T https://t.co/6k7dAZwMkj
— こりん@VR (@korinVR) December 12, 2022
verseの条件分岐まわりを見ていてIconを思い出した
— でこれき (@dico_leque) December 12, 2022
Rubyist のための他言語探訪 【第 7 回】 Iconhttps://t.co/zmB0CLJ26x
- Beyond Functional Programming: The Verse Programming Language [pdf] | Hacker News
- Beyond Functional Programming: The Verse Programming Language (Epic Games’ new language with Simon Peyton Jones) : programming
- https://simon.peytonjones.org/assets/pdfs/haskell-exchange-22.pdf
条件分岐についてはHacker Newsでも Iconに言及したコメントがあった (Iconなつかしい…)
- There are no booleans in the language! Conditionals can still succeed or fail, but failure is defined as returning zero values and success is defined as returning one or more values.
This is similar to how Icon works: https://en.m.wikipedia.org/wiki/Icon_(programming_language)
https://t.co/fv49okfMYD Simon Peyton Jones、Epic Gamesに行ってたのか知らなかった!!これは楽しそう
— kinaba (@kinaba) December 12, 2022
プログラミング言語系の学会をゲーム開発の観点からの言語設計の話で埋め尽くして欲しい
— kinaba (@kinaba) December 12, 2022