ときどきの雑記帖 RE* (新南口)
メロスのように
なつやすみ
なんだけど例によって以下略
perl
Why everybody codes in perl always : r/perl というのを見かけ、ほう。と元記事を見ると…
Why Nobody Codes in Perl Anymore - YouTube
どゆこと?
Zig
なんか面白そうな機能がいろいろ。
とくに興味をひかれたものをいくつか挙げてみると
その1
String Literals
Raw or multiline strings are spelled like this:
const raw =
\\Roses are red
\\ Violets are blue,
\\Sugar is sweet
\\ And so are you.
\\
;
This syntax doesn’t require a special form for escaping \ itself:
const still_raw =
\\const raw =
\\ \\Roses are red
\\ \\ Violets are blue,
\\ \\Sugar is sweet
\\ \\ And so are you.
\\ \\
\\;
\\
;
It nicely dodges indentation problems that plague every other language with a similar feature. And, the best thing ever: lexically, each line is a separate token. As Zig has only line-comments, this means that \n is always whitespace. Unlike most other languages, Zig can be correctly lexed in a line-by-line manner.
Raw strings is perhaps the biggest improvement of Zig over Rust. Rust brute-forces the problem with r##""## syntax, which does the required job, technically, but suffers from the mentioned problems: indentation is messy, nesting quotes requires adjusting hashes, unclosed raw literal breaks the following lexical structure completely, and rustfmt’s formatting of raw strings tends to be rather ugly. On the plus side, this syntax at least cannot be expressed by a context-free grammar!
その2
Prefix Types
Where Zig departs from C the most is the syntax for types. C uses a needlessly confusing spiral rule. In Zig, all types are prefix:
u32 // An integer
[3]u32 // An array of three integers
?[3]u32 // An array of three integers or null
// A pointer to...
*const ?[3]u32
While pointer type is prefix, pointer dereference is postfix, which is a more natural subject-verb order to read: ptr.* = 92;
その3
Identifiers
Zig has general syntax for “raw” identifiers: @“a name which a space” It is useful to avoid collisions with keywords, or for exporting a symbol whose name is otherwise not a valid Zig identifier. It is a bit more to type than Kotlin’s delightful
a name with a space
,but manages to re-use Zig’s syntax for built-ins (@TypeOf) and strings.
ちょっと前にSwiftの次のバージョンで同様の機能が入るらしいというのを書いたけど、 ここを読むとKotlinにはすでにあるものらしいすね
- Kotlin/JVM でテストメソッド名に空白を含められる理由 #Kotlin - Qiita
- Javaプログラマーが使うと揶揄されなくなる「Kotlin」の基本構文: Android Studioで始めるKotlin入門(2)(3/3 ページ) - @IT
ついでに書くとKotlinにはこういうものもあるらしく
val sql2 = """
|SELECT *
|FROM MyTable
|WHERE cond > 1
""".trimMargin()
val sql3 = """
#SELECT *
# FROM MyTable
# WHERE cond > 1
""".trimMargin("#")
Kotlinの文字列クラスにはデフォルトで、「trimMargin」という、 文字列の各行にある最初の空白文字列を「|」まで削除するメソッドがあります。
そう言えばRubyのヒアドキュメントでこの種の空白をごにょごにょする機能があったような。 Perlはどうだったっけ?
WG 14
アレとかアレとかちょっとくらい読める余裕はあると思ったんだがなあ…
新刊近刊
圏論の歩き方
10月上旬新刊予定
— 書泉_MATH (@rikoushonotana) August 10, 2025
『圏論の歩き方[改訂版]』圏論の歩き方委員会 4400円(日本評論社)
「圏論ブーム」から10年。その火付け役となった本書が、その後の進展なども含めて待望の改訂版として登場!
予約受付中⇩https://t.co/QXnnJbqM62 pic.twitter.com/NSh8a3FwGl
水族館飼育員の
ほかの本を探しているときに平積みされているのが目に入った。 たしかマイナビで4コママンガ(水族館ネタ)描いていた人だよね。 そうか単行本出たのか(そう言えばいつの間にかマイナビで見かけなくなっていた)と思ったら
出版社: さくら舎; 初版 (2023/7/6)
2年前にも出ていたでござるの巻
境界線の世界史
awk
Add support for building with slimcc. - gawk.git - gawk というコミットがあったけどslimccってなんじゃ? という状態なのでコミットにあったリンク先を見ると
fuhsnn/slimcc: C23 compiler with C2y/GNU extensions for x86-64 Linux/BSD, written in C99
This is a fork of Rui Ueyama’s chibicc with fixes and enhancements, including:
- C99 features: VLA parameters, VLA de-allocation, K&R old-style functions.
- C11 features: _Static_assert(), over-aligned locals, _Generic with qualifiers.
- C23 features: constexpr, enum:T, #embed, auto, _BitInt, nullptr, ={}
- C2Y features: named loops, if declarations, _Countof.
- defer: enable with -fdefer-ts, or use _Defer.
- WG14 proposals: VA_TAIL, #def #enddef.
- GNU features: inline assembly, commonly used attribute’s.
- MSVC features: #pragma pack, anonymous struct.
- Basic codegen optimizations (close to GCC/Clang at -O0).
ふむ。
FORTRAN Compiler on IBM 704
- The arithmetic translator-compiler of the IBM FORTRAN automatic coding system | Communications of the ACM
- Assembly listing of transcription - Software Preservation Group
- FORTRAN II
しました
ついに、Debian 13 trixieがリリースしました。おめでとう!そして、作業をしていただいた皆様、お疲れさまでした。https://t.co/uPx8qklqA4
— Debian JP Project (@debian_jp) August 10, 2025
「リリースされました」じゃないのかなあこの場合。 「しました」なら、 「Debian 13 trixieをリリースしました」 とか・
とはいっても「発売しました」とかこの種の使い方を少なからず見かけるから そういうものなのかもしれない(謎)
由比ヶ浜
由比ヶ浜行ったらイカちゃんがいたwhttps://t.co/TTKeT2WYSs pic.twitter.com/eh4J362Lsc
— イカビク (@RCAVictorCo) August 9, 2025
由比ヶ浜だったのか>舞台
無駄に頑丈
ここ二数十年の沿岸警備隊の砕氷艦に対する基準がめったやたらと高かった理由が、第二次大戦期に建造された七隻(+後にカナダ向けに一隻追加建造)のウィンド級重砕氷艦を45年間も運用した経験でした。
— Yu P. Eiwalkee (@yupeiwalkee) August 11, 2025
*その昔、南極で日本の宗谷を救援したUSCGCバートン・アイランド(WAGB-283)はその六番艦です。 pic.twitter.com/Y56I9xKMty
これから始まる一連の投稿が面白かったのだけど
いわゆる「無駄に頑丈な昔のアメリカ製品」ですね。今じゃ過去の話ですけどorz
にちょっとウケた。で
ウィンド級~ポーラー級と優れた砕氷艦を80年も運用した結果、沿岸警備隊は「数が少なければこそ」砕氷艦に高い性能を求めるようになりました。
— Yu P. Eiwalkee (@yupeiwalkee) August 11, 2025
ですがその一方で、頑丈に作ったせいで寿命が長いということは、次の砕氷艦が建造されるまで何十年も間が開くことを意味し、結果的に建造技術を喪失。
いろいろ考えさせられるですねえ(こなみかん
件
その意味のくだりを漢字にすると「件」ですよ。ひらがなで書いた方がいいと思います。
— グラ (@gra_tan_) August 11, 2025
調べてみると確かに訓読みの一つに「くだり」があった、
漢字変換の候補でも出てきた くだり→件
PONG
前々から気になっていたこと。アーケードゲーム、アタリ『PONG(1972年)』の筐体の中には普通のテレビがそのまんま入ってました。しかも接続方法はのちの家庭用でお馴染みの『RF接続』なのです。外部入力端子が一般的でなかった時代ならではですね。 pic.twitter.com/yLXC6uLc1e
— うみヽ(>へ<)ノ (@woomy) August 12, 2025