ときどきの雑記帖 迷宮編

最新ページへのリンク
目次ページへのリンク

一つ前へ 2011年5月(中旬)
一つ後へ 2011年6月(上旬)

ホームへ

2011年05月31日

■_

5月も終わり。と。

■_

reddit でえらくほめられてた(はずなんだけど見当たらない… また別の投稿がされてるみたいだけど) unicode - Why does modern Perl avoid UTF-8 by default? - Stack Overflow

utf 8 - Why does modern Perl avoid UTF-8 by default? - Stack Overflow

I wonder why most modern solutions built using Perl don't enable UTF-8 by default.

I understand there are many legacy problems for core Perl scripts, where it may break
things. But, from my point of view, in the 21st century, big new projects (or projects
with a big perspective) should make their software UTF-8 proof from scratch. Still I
don't see it happening. For example, Moose enables strict and warnings, but no Unicode.
Modern::Perl reduces boilerplate too, but no UTF-8 handling.

コアの Perl スクリプトには、break thing してしまうようなさまざまな legacy 問題がある
ということはわたしも理解しています。けれどもわたしの見るところでは、この21世紀に
大規模な新規プロジェクト(もしくは big perspective を伴うプロジェクト)はその開始点
からソフトウェアを UTF-8 proof にしておくべきなのです。
Still I don't see it happening.
For example, Moose enables strict and warnings, but no Unicode.
たとえば Moose は strict と warnings を有効にしますが、Unicode は有効にしませんし、
Modern::Perl ば boilerplate も縮小しますが、UTF-8 のハンドリングはしません。

Why? Are there some reasons to avoid UTF-8 in modern Perl projects in the year 2011?
なぜでしょうか?
この2011年における modern Perl のプロジェクトで UTF-8 を排除するなんらかの
理由があるのでしょうか?

Commenting @tchrist got to long, so i add it here.

It seems that i did not make myself clear. I try add some things.

略
I really like Perl. But dealing with unicode is painful. I still find myself running
against walls. Some way tchrist is right and answers my questions: new projects don't
attract UTF-8 because it is too complicated in Perl5.PS. Sorry for my English!

わたしは本当にPerlが好きですが、Unicodeを扱うのは苦痛です。
I still find myself running against walls.
Some way tchrist is right and answers my questions: new projects don't attract UTF-8
because it is too complicated in Perl5.
ある意味で tchrist は正しく、わたしの疑問にも答えています。
新しいプロジェクトは UTF-8 を引き寄せません。なぜなら、それは Perl 5には
複雑すぎるものだからです。

PS. Sorry for my English!


回答はまた。

■_

■_

むー、あれとかあれをまとめている時間がなっしんぐ。

■_

あれの#2が終わりませんでした ○| ̄|_

2011年05月30日

■_

ダブルフェイス最終巻とヤングキングHOURS。 皇帝陛下の出番なし(笑)

■_

この会社辞めようと思ったソースコード#1C 

799 仕様書無しさん [sage] 2011/05/30(月) 07:52:18.91 ID: Be:

    void hoge2(string x){
    }

    void hogeapi() {
    char hoge[4 * 1024 * 1024];
    string x;
    x = hoge;
    printf("%s\n", x);
    hoge2(x);
    }


    勘弁してくれ

800 仕様書無しさん [sage] 2011/05/30(月) 14:34:56.92 ID: Be:
    な 何が起きるの?
    何をしたいの? 

怖いなw>C++

■_

■_ JVM

とりあえずこの辺から読んできゃいいのかな。

jdk/src/share/javavm/include/opcodes.h

hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp
hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp
hotspot/src/share/vm/interpreter/bytecodeInterpreter.inline.hpp
hotspot/src/share/vm/interpreter/cppInterpreter.cpp
hotspot/src/share/vm/interpreter/cppInterpreter.hpp

hotspot/src/share/vm/primes/jvm.cpp

■_ 重箱の隅

InfoQ: アジャイルのリーダーたちがPMIのアジャイル認証について議論する

もちろん私はこのことを歓迎し、そして、PMIが以前のアプローチからアジャイルのアプローチ
に変わることを楽しみにしています。当然、この試金石は原理に忠実に実行されるプロジェクト
の成功となるでしょう。

InfoQ: Agile Leaders Weigh in on PMI Agile Certification

I of course welcome this and look forward to PMI shifting from its previous approach 
to an agile approach. The test of this will be, of course, the success of the projects 
that adhere to its principles.

「試金石は~成功となるでしょう」って? 「試金石」の意味を取り違えてるような気がする。

2011年05月29日

■_

雨で外にも出ず、かといって家で何かをしたでなく(笑)

Coders at work は11章まできた。

■_ quote

lispでQUOTEの意味 | OKWave

lispでQUOTEの意味

lispを使ってプログラムをしているのですが、

(caar '('A))をエラーになると予想しながら実行したら

>(caar '('A))
>QUOTE

となりました。

なぜエラーにならなかったのですか?
また、QUOTEはどういう意味ですか?

よろしくお願いします。

ANo.1

'A => (QUOTE A)
です。

そこから
(CAAR '('A))
=>(CAR 'A)
=>(CAR (QUOTE A))
=>QUOTE

ということでは無いでしょうか。

補足

回答ありがとうございます。

'A => (QUOTE A)

とリストになるのは何故ですか?

また、
'Aを実行すると実行結果はAですし、
(car 'A)を実行するとエラーでした。

なので、
carのときは'Aは(QUOTE A)に変換されていません。

なぜ、
caarのときは'Aが(QUOTE A)に変換されるのですか?

'A は quote A だよねえと思いつつよくわからんので調べた。

GNU Emacs Lispリファレンス・マニュアル: 8. 評価

8.3 quoteする

特殊形式quoteは、一つの引数を、書かれたとおり、評価をせずに 返します。これによって、定
数シンボルやリストなど、 自己評価型ではないオブジェクトをプログラムに含める手段が用意
されています (数、文字列、ベクタなど、自己評価型オブジェクトをquoteする必要はありませ
ん)。

Special Form: quote object

    この特殊形式はobjectを評価せずに返します。 

quoteはしょっちゅうプログラムで使われるので、Lispはそれを便利にする リード構文を用意し
ています。アポストロフィ文字(`'')に続く一つのLisp オブジェクト(リード構文において)は、
第1要素がquoteで、2番目の要素 が先のオブジェクトというリストに展開されます。したがって、
リード構文'x は、(quote x)の省略形です。

quoteを使う式の例を挙げます:
 	

(quote (+ 1 2))
     ⇒ (+ 1 2)
(quote foo)
     ⇒ foo
'foo
     ⇒ foo
''foo
     ⇒ (quote foo)
'(quote foo)
     ⇒ (quote foo)
['foo]
     ⇒ [(quote foo)]

そのほかのquoteを行なう構文要素には、Lispで書かれた匿名ラムダ式が コンパイルされるよう
になるfunction(see section 匿名関数)、 ほかの部分の計算や置換をする間、リストの一部だ
けをquoteするために使用する `(see section 逆引用符)があります。

'(quote foo) ⇒ (quote foo) ということなのね。

■_ scripting

ここで取り上げられた元の記事はまだ読んでいないというw ffi がどうとかいうのは見えたんだけど。

Scripting languages grow up : programming

Since when is TCL the first general purpose scripting language?

I remember writing ARexx in elementary and middle school. I'm sure there are much 
older scripting languages. REXX had an implementation on every major platform before 
TCL showed up.

http://en.wikipedia.org/wiki/REXX


And since when did Java introduce garbage collection to the mainstream programming 
world? The author doesn't seem to know much about the history of programming languages.

REXX March 20th, 1979


Or awk. It is much like perl before there was perl. It's ancient too.


What, scripting languages grow up again?


I kind of want to make a joke about Perl 6 and someone living over their parents' 
garage, but that sort of feels kind of tired, and I like Perl, so I won't, but I will 
imply that I could have.


Do they also finally get a job and move out of their parents' house?


and lets not forget that the "built-in" functionality of your scripting lang 
is almost always built at the C level and simply exposed in the script language.

what the author is missing is a critique of two of his mentioned languages...lua and 
javascript...to effectively provide for programming in the large. its still a major 
hassle in js...and no, functions-as-namespaces are not a solution

REXX March 20th, 1979 こんなに古かったんだ…

■_

■_ What Every C Programmer Should Know About Undefined Behavior #1/3

いろいろ手直しすべきとことがあるけどその辺は投げっぱなしジャーマン

LLVM Project Blog: What Every C Programmer Should Know About Undefined Behavior #1/3

LLVM Project News and Details from the Trenches

Friday, May 13, 2011

What Every C Programmer Should Know About Undefined Behavior #1/3
すべての C プログラマーが未定義動作について知っておくべきこと (1/3)


People occasionally ask why LLVM-compiled code sometimes generates SIGTRAP signals when the 
optimizer is turned on. After digging in, they find that Clang generated a "ud2" 
instruction (assuming X86 code) - the same as is generated by __builtin_trap(). There are 
several issues at work here, all centering around undefined behavior in C code and how LLVM 
handles it.

オプティマイザーが有効にされているときに、LLVM でコンパイルされたコードがときどき 
SIGTRAP シグナルを発生させることがあるのはなぜかとユーザーが時折り尋ねてくることがあり
ます。調べてみると彼らは Clang が (X86コードを仮定した場合) "ud2" 命令を生成
していることを発見します。これは __builtin_trap() によって生成されるものと同じです。
そこにはいくつかの issue がありますが、
C のコードにおける未定義動作とそれを LLVM がどのように handle しているかという点に集約されます。

This blog post (the first in a series of three) tries to explain some of these issues so that 
you can better understand the tradeoffs and complexities involved, and perhaps learn a few 
more of the dark sides of C. It turns out that C is not a "high level assembler" 
like many experienced C programmers (particularly folks with a low-level focus) like to think, 
and that C++ and Objective-C have directly inherited plenty of issues from it.

この(三回シリーズの第一回である)ブログ投稿ではあなたがより良くトレードオフと 
complexities involved を理解し、さらにおそらくあともう少しの C の dark sides を学ぶた
めにこれらの issues の幾つかの説明を試みます。C が、経験を積んだ多くの C プログラマー
(とりわけハード寄りの low-level な部分に focus している人たち) が考えるような高度なア
センブラー ("high level assembler") ではなく、また、C++ や Objective-C は C
から plenty of issues (多くのことがら) をそのまま受け継いでいるということを明らかにします。


Introduction to Undefined Behavior
未定義動作への introduction

Both LLVM IR and the C programming language have the concept of "undefined behavior". 
Undefined behavior is a broad topic with a lot of nuances. The best introduction I've found 
to it is a post on John Regehr's Blog. The short version of this excellent article is that 
many seemingly reasonable things in C actually have undefined behavior, and this is a common 
source of bugs in programs. Beyond that, any undefined behavior in C gives license to the 
implementation (the compiler and runtime) to produce code that formats your hard drive, 
does completely unexpected things, or worse. Again, I would highly recommend reading 
John's article.

LLVM IR とプログラミング言語の C の両方ともが“未定義動作”という考え方 (consept) を持
っています。未定義動作とは a lot of nuances を伴った broad topic です。わたしが見つけ
た best introduction は Jonh Regehr の blog にあった投稿です。この素晴らしい article 
の short version にはC に実際にある未定義動作のうちの reasonable であると思われるもの
がたくさんありますが、そしてこれはプログラム中に存在するバグの common source です。
Beyond that,
C におけるすべての未定義動作はハードディスクをフォーマットしたり完全に予想外のことを行
うコードかさもなければ有用なコードを生成するための(コンパイラーやランタイムの)実装のラ
イセンスを与えます。繰り返しになりますが、John の article を読むことを強くお勧めします。


Undefined behavior exists in C-based languages because the designers of C wanted it to 
be an extremely efficient low-level programming language. In contrast, languages like 
Java (and many other 'safe' languages) have eschewed undefined behavior because they want 
safe and reproducible behavior across implementations, and willing to sacrifice performance 
to get it. While neither is "the right goal to aim for," if you're a C programmer 
you really should understand what undefined behavior is.

C ベースの言語には未定義動作が存在します。それは、C の設計者たちはこの言語を extermely 
に効率的なハードウェア寄りのプログラミング言語 (low-level programming language) とする
ことを望んだからです。それとは対象的に、Java のような言語 (と多くの“安全な”言語) は
未定義動作を避けていました。それは、その設計者たちが言語を安全かつ複数の実装をまたがっ
て reprocucible な動作をするものにしてするよう望み、そのために性能を犠牲にすることを選
択したからです。どちらも "the right goal to aim for," (目指すべき正しい目標)
ですが、もしあなたが C プログラマーであるのなら、未定義動作がどういったものなのかを本
当に理解しておくべきです。

Before getting into the details, it is worth briefly mentioning what it takes for a 
compiler to get good performance out a broad range of C apps, because there is no 
magic bullet. At a very high level, compilers produce high performance apps by a) 
doing a good job at bread and butter algorithms like register allocation, scheduling, 
etc. b) knowing lots and lots of "tricks" (e.g. peephole optimizations, loop 
transformations, etc), and applying them whenever profitable. c) being good at 
eliminating unnecessary abstractions (e.g. redundancy due to macros in C, inlining 
functions, eliminating temporary objects in C++, etc) and d) not screwing anything up. 
While any of the optimizations below may sound trivial, it turns out that saving just 
one cycle out of a critical loop can make some codec run 10% faster or take 10% less 
power.

詳細に入る前に、broad range of C apps で良好な性能を得るためにコンパイラーが行っている
ことについて手短に言及しておくことには価値があります。なぜなら魔法の弾丸 (magic bullet) 
というものは存在しないのですから。非常に高い水準で以下のことがらを行うことでコンパイラ
ーは高性能のアプリケーションを生成します。
a) レジスター割り当てやスケジューリングなどのような基本的なアルゴリズム
   (bread and butter algorithms) できちんと仕事をする
b) 数多くの (lots and lots of) “トリック”(覗き穴最適化、ループの変形、など)
   を知り、そして profitable なときはつねにそれらを適用する。
c) 不必要な抽象化
   (redundancy due to macros in C, 関数のインライン化、C++ における一時オブジェクトの削除、など)
   の除去をうまくやる。
d) 一切害を及ぼさない。

While any of the optimizations below may sound trivial, it turns out that saving just 
one cycle out of a critical loop can make some codec run 10% faster or take 10% less 
power.

上で挙げた最適化は瑣末 (trivial) なものに思えるかも知れません。しかし、たったの 1サイ
クルを critical loop から取り除くことで一部の codec では 10% の高速化と 10% の電力節約
ができるかもしれないのです。


Advantages of Undefined Behavior in C, with Examples
C における未定義動作のアドバンテージ

Before getting into the dark side of undefined behavior and LLVM's policy and behavior 
when used as a C compiler, I thought it would be helpful to consider a few specific 
cases of undefined behavior, and talk about how each enables better performance than a 
safe language like Java. You can look at this either as "optimizations 
enabled" by the class of undefined behavior or as the "overhead avoided" 
that would be required to make each case defined. While the compiler optimizer could 
eliminate some of these overheads some of the time, to do so in general (for every 
case) would require solving the halting problem and many other "interesting 
challenges".

未定義動作や C コンパイラーとして使ったときの LLVM の policy and behavor の暗黒面に入
り込む前に、この未定義動作のアドバンテージというものが未定義動作のうちのごく少数の 
specific cases を良く考える手助けやそれぞれの未定義動作が Java のような安全な言語 
(safe language) よりも良好な性能をどのように可能にしているのかについて述べる手助けにな
るとわたしは考えました。このことは未定義動作のクラスによって可能となる最適化もしくは
 "overhead avoided" that would be required to make each case defined.
(定義するとオーバーヘッドが必須となってしまうようなものの除去?)
のいずれかによって調べることが可能です。コンパイラーのオプティマイザーはこういったオー
バーヘッドの一部をときには取り除くことができるかもしれませんが、すべてのケースにおいて
そのようにすることは halting problem の解決とその他多くの "interesting 
challenges" を要求します。


It is also worth pointing out that both Clang and GCC nail down a few behaviors that 
the C standard leaves undefined. The things I'll describe are both undefined according 
to the standard and treated as undefined behavior by both of these compilers in their 
default modes.

C の標準が未定義のまま放置している Clang と GCC の両方ともが nail down する少数の動作 
(a few behavior) を指摘することにも価値があります。わたしがこれから説明することは
both undefined according to the standard でありかつ
どちらのコンパイラーもそのデフォルトモードで未定義動作として扱っているものです。

Use of an uninitialized variable: This is commonly known as source of problems in C 
programs and there are many tools to catch these: from compiler warnings to static and 
dynamic analyzers. This improves performance by not requiring that all variables be 
zero initialized when they come into scope (as Java does). For most scalar variables, 
this would cause little overhead, but stack arrays and malloc'd memory would incur a 
memset of the storage, which could be quite costly, particularly since the storage is 
usually completely overwritten.

未初期化変数の使用:
これは C プログラムにおける source of problems として一般に知られているもので、これを
捕捉するツールはコンパイラーの警告から静的/動的解析まで数多くあります。これは、(Java 
がやっているような)スコープに変数が現れたときにゼロでの初期化を要求しないことによって
性能を向上させます。大部分のスカラー変数ではこれはわずかのオーバーヘッドにしかなりませ
んが、スタック上の配列 (stack arrays) や malloc されたメモリー (malloc'd memory) はそ
の領域に対する memset を招き (incur) ます。確保された領域は一般的には完全に上書きされ
てしまうものなので、そうやって memset することは quite costly な可能性があります。


Signed integer overflow: If arithmetic on an 'int' type (for example) overflows, the 
result is undefined. One example is that "INT_MAX+1" is not guaranteed to be 
INT_MIN. This behavior enables certain classes of optimizations that are important for 
some code. For example, knowing that INT_MAX+1 is undefined allows optimizing 
"X+1 > X" to "true". Knowing the multiplication 
"cannot" overflow (because doing so would be undefined) allows optimizing 
"X*2/2" to "X". While these may seem trivial, these sorts of 
things are commonly exposed by inlining and macro expansion. A more important 
optimization that this allows is for "<=" loops like this:

符号付き整数のオーバーフロー:
(たとえば) 'int' 型に対する算術式がオーバーフローすると、その結果は未定義です。一つの
例としては、"INT_MAX+1" が INT_MIN になることは保証されていません。この振る舞い
は、一部のコードには重要であるような特定の最適化(certain classes of optimizations) を
可能にします。例えば、INT_MAX+1 が未定義であることが分かっていれば、"X+1 > X" を "true"
に最適化できます。乗算が (オーバーフローしたときに行うことが未定義であるために)“オー
バーフローできない”ことがわかっていれば"X*2/2" を "X" に最適化できま
す。このようなことは些細に思えるかもしれませんが、この種のことはインライン化やマクロの
展開において日常的に見られるものなのです。これによって可能になるより重要な最適化は次の
ような for "<=" ループに対するものです:


for (i = 0; i <= N; ++i) { ... }


In this loop, the compiler can assume that the loop will iterate exactly N+1 times if 
"i" is undefined on overflow, which allows a broad range of loop 
optimizations to kick in. On the other hand, if the variable is defined to wrap around 
on overflow, then the compiler must assume that the loop is possibly infinite (which 
happens if N is INT_MAX) - which then disables these important loop optimizations. 
This particularly affects 64-bit platforms since so much code uses "int" as 
induction variables.

このループでコンパイラーは、"i" がオーバーフローについて未定義であればループ
が正確に N+1 回繰り返されると仮定できます。一方この変数がオーバーフローしたときに wrap 
around するように定義されていたならば、コンパイラーはそのループが無限ループとなる可能
性がある (N が INT_MAX の場合発生します) が、ことを仮定しなければならず、それによって
この種の重要なループ最適化を disable してしまいます。この最適化は特に 64ビットプラット
フォームで効果があります。それは多くのコードが "int" を induction variables 
として使っているからです。


It is worth noting that unsigned overflow is guaranteed to be defined as 2's complement
(wrapping) overflow, so you can always use them. The cost to making signed 
integer overflow defined is that these sorts of optimizations are simply lost (for 
example, a common symptom is a ton of sign extensions inside of loops on 64-bit 
targets). Both Clang and GCC accept the "-fwrapv" flag which forces the 
compiler to treat signed integer overflow as defined (other than divide of INT_MIN by -1).

符号なし整数のオーバーフローが 2の補数のオーバーフローであるかのように定義されることを
保証することは大変価値のあることです (it is worth nothing)。ですから、いつでもこれを使
うことが可能です。符号付き整数のオーバーフローを定義するための代償はこの種の最適化を失
ってしまうことです(たとえば 64ビットターゲット上のループの内側での大量の符号拡張があり
がちです)。Clang と GCC の両方とも符号付き整数のオーバーフローが (INT_MIN を -1 で割っ
たもの以外として)定義されたものであるかのようにコンパイラーに強制する 
"-fwrapv" フラグを受け付けます。



Oversized Shift Amounts: Shifting a uint32_t by 32 or more bits is undefined. My guess 
is that this originated because the underlying shift operations on various CPUs do 
different things with this: for example, X86 truncates 32-bit shift amount to 5 bits 
(so a shift by 32-bits is the same as a shift by 0-bits), but PowerPC truncates 32-bit 
shift amounts to 6 bits (so a shift by 32 produces zero). Because of these hardware 
differences, the behavior is completely undefined by C (thus shifting by 32-bits on 
PowerPC could format your hard drive, it is *not* guaranteed to produce zero). The 
cost of eliminating this undefined behavior is that the compiler would have to emit an 
extra operation (like an 'and') for variable shifts, which would make them twice as 
expensive on common CPUs.

大きすぎるシフト量:
uinnt32_t を32ビット以上シフトしたときの結果は未定義です。わたしは 種々の CPU がシフト
操作において異なる動作をすることが理由でこのようになっているのではないかと思っています。
たとえば X86 では 32 ビットのシフト量は 5ビットの範囲に丸められますが (したがって 32ビ
ットシフトの結果は0ビットシフトの結果と同じです)、PowerPC では 6ビットの範囲で丸められ
ます (したがって 32ビットシフトの結果はゼロになります)。これらはハードウェアの違いであ
るので、その動作は C では全くの未定義です (したがって PowerPC 上で 32 ビットシフトした
ことによってあなたのハードディスクをフォーマットしてしまうかもしれませんし、シフトの結
果が 0になることは保証*されていません*)。この未定義動作の除去のコストはコンパイラーが
変数のシフトのために ('and' のような) extra operation を emit しなければならないもので
あり、これは一般的な CPU では操作を二倍高価なものにしてしまうものです。

Dereferences of Wild Pointers and Out of Bounds Array Accesses: Dereferencing random 
pointers (like NULL, pointers to free'd memory, etc) and the special case of accessing 
an array out of bounds is a common bug in C applications which hopefully needs no 
explanation. To eliminate this source of undefined behavior, array accesses would have 
to each be range checked, and the ABI would have to be changed to make sure that range 
information follows around any pointers that could be subject to pointer arithmetic. 
This would have an extremely high cost for many numerical and other applications, as 
well as breaking binary compatibility with every existing C library.

wild ポインターの dereference や配列の範囲外へのアクセス:
(NULL や free 済みのメモリーなどの) random ポインターを dereferecing することや配列の
範囲外へのアクセスの special case は説明するまでもないほどの C applocations における一
般的なバグです。この未定義動作の source を取り除くには配列のアクセスでは範囲チェックが
必須となって、また、ポインター演算が必要となるであろうすべてのポインターに範囲情報が付
くようにその ABI (Application Binary Interface) も変更しなければならなくなるでしょう。
これは数値演算やその他のアプリケーションにとっては既存のすべてのCライブラリとのバイナ
リ互換を壊してしまうばかりでなくextermely high cost となるでしょう。

Dereferencing a NULL Pointer: contrary to popular belief, dereferencing a null pointer 
in C is undefined. It is not defined to trap, and if you mmap a page at 0, it is not 
defined to access that page. This falls out of the rules that forbid dereferencing 
wild pointers and the use of NULL as a sentinel. NULL pointer dereferences being 
undefined enables a broad range of optimizations: in contrast, Java makes it invalid 
for the compiler to move a side-effecting operation across any object pointer 
dereference that cannot be proven by the optimizer to be non-null. This significantly 
punishes scheduling and other optimizations. In C-based languages, NULL being 
undefined enables a large number of simple scalar optimizations that are exposed as a 
result of macro expansion and inlining.

NULL ポインターの dereferencing:
一般に信じられていることに反して、C における null ポインターの dereferencing は未定義
です。null ポインターの dereference をしたときにトラップするように定義されてはいません
し、あるページを 0番地に mmap したときにもそのページにアクセスするとは定義されていませ
ん。これは wild ポインターの dereference やNULL を番兵として使うことを禁止するルールを 
falls out します。NULL ポインターの dereference を未定義にすることで広範囲の最適化が可
能となります:対照的に、Java はコンパイラーに対してオプティマイザーが non-null であるか
どうかをprove できない任意のオブジェクトポインター dereference をまたがった副作用を持
つ操作(side-effecting operation) の移動を invalid にしています。これはスケジューリング
やその他の最適化を significantly に punishes (罰する、やっつける)します。C ベースの言
語では NULL を未定義としておくことで、マクロ展開やインライン化の結果として生じる単純な 
scalar optimizations の多くが可能となります。


If you're using an LLVM-based compiler, you can dereference a "volatile" 
null pointer to get a crash if that's what you're looking for, since volatile loads 
and stores are generally not touched by the optimizer. There is currently no flag that 
enables random NULL pointer loads to be treated as valid accesses or to make random 
loads know that their pointer is "allowed to be null".

LLVM ベースのコンパイラーを使っている場合、コンパイラーをクラッシュさせたいのであれば
その目的のために "volatile" null pointer を dereference できます。それは 
volatile のロードやストアは一般的にオプティマイザーが関与しないところだからです。
random NULL ポインターのロードを valid access として扱うことやrandom ロードが対象とな
るポインターが "allowed to be null" かどうかをわかるにすることを有効にするフ
ラグは現状ではありません


Violating Type Rules: It is undefined behavior to cast an int* to a float* and 
dereference it (accessing the "int" as if it were a "float"). C 
requires that these sorts of type conversions happen through unions: using pointer 
casts is not correct and undefined behavior results. The rules for this are quite 
nuanced and I don't want to go into the details here (there is an exception for char*, 
vectors have special properties, unions change things, etc). This behavior enables an 
analysis known as "Type-Based Alias Analysis" (TBAA) which is used by a 
broad range of memory access optimizations in the compiler, and can significantly 
improve performance of the generated code. For example, this rule allows clang to 
optimize this function:

型規則違反:
int* から float* へのキャストやキャスト結果の dereference ("float" であるかのごとく 
"int" にアクセスする) は未定義動作です。C はこの種の型変換 (type conversions) が共用体
を通して起きることを要求しています。ポインターのキャストを使うことは正しくない (not 
correct) と同時に、結果は未定義なものになります。これに対する規則は quite nuanced です
が、ここでは詳細を述べません
(there is an exception for char*, 
vectors have special properties,
unions change things, etc)。
この振る舞いは TBAA ("Type-Based Alias Analysis") として知られるコンパイラー
におけるメモリーアクセス最適化の広範囲で使用されている解析を可能にし、生成されたコード
の性能を significantly に改善できるようにします。たとえばこの規則は clang が


  float *P;
  void zero_array() {
    int i;
    for (i = 0; i < 10000; ++i)
       P[i] = 0.0f;
  }


into "memset(P, 0, 40000)". This optimization also allows many loads to be hoisted 
out of loops, common subexpressions to be eliminated, etc. This class of undefined behavior 
can be disabled by passing the -fno-strict-aliasing flag, which disallows this analysis. When 
this flag is passed, Clang is required to compile this loop into 10000 4-byte stores (which is 
several times slower), because it has to assume that it is possible for any of the stores to
 change the value of P, as in something like this:

この関数を最適化して "memset(P, 0, 40000)" としてしまえるようにします。この
最適化はまた多くのロードをループの外に追い出したり共通部分式を削除したりするような最適
化などを可能とします。このクラスの未定義動作はこの解析を禁止する -fno-strict-aliasing 
フラグを渡すことでdisable できます。このフラグが渡されたとき Clang はこのループを (数
倍遅い) 10,000 個の四バイトストア命令にする ことをコンパイラーに要求しますが、それは次
の例のように何かをストアするために P の値を変更する可能性があることを仮定する必要があ
るからです。



  int main() {
    P = (float*)&P;  // cast causes TBAA violation in zero_array.
    zero_array();        // キャストによって zero_array 内で TBAA違反が引き起こされる
  }


This sort of type abuse is pretty uncommon, which is why the standard committee decided that 
the significant performance wins were worth the unexpected result for "reasonable" 
type casts. It is worth pointing out that Java gets the benefits of type-based optimizations 
without these drawbacks because it doesn't have unsafe pointer casting in the language at all.

この種の abuse は pretty uncommon であり、そしてそれは significant な performance wins 
は "reasonable" type casts による予想外の結果 (unexpected result) を容認する
だけの価値があると標準化委員会 (standard committee) が判断したものです。Java がこの種
の drawbacks なしに型ベースの最適化によって利益を得たことを指摘することには価値があり
ます。それは Java が unsafe なポインターのキャストを言語として持っていないからです。


Anyway, I hope that this gives you an idea of some of the classes of optimizations enabled by 
undefined behavior in C. There are many other kinds of course, including sequence point 
violations like "foo(i, ++i)", race conditions in multithreaded programs, 
violating 'restrict', divide by zero, etc.

いずれにしても、C における未定義動作によって有効となる幾つか最適化のクラスの考え方をあ
なたに示せたことを望みます。もちろん、この他にも "foo(i, ++i)" のようなシー
ケンスポイント違反、マルチスレッドプログラムにおける競合条件、ゼロ除算による 
'restrict' 違反などを含む多くの種類があります。

In our next post, we'll discuss why undefined behavior in C is a pretty scary thing if 
performance is not your only goal. In our final post in the series, we'll talk about how 
LLVM and Clang handle it.

次回は、なぜ性能が唯一の目標でないときには C における未定義動作は pretty scary thing 
なのかについて論じます。そしてシリーズの最終回では LLVM と Clang がそれをどのように 
handle するかについて述べます。

-Chris Lattner
Posted by Chris Lattner at 11:25 AM

2/3 と 3/3 はどーすっかのう。

2011年05月28日

■_

インプット重要ですが、取り込むことばかりに時間をとられていると意味ないですな(反省)

Interface と ASCII.technologies を買った。

■_ 関数型言語が支配する

でいいんだろか > Functional Languages will Rule

Functional Languages will Rule (but not this year) - Good Stuff

(略)

So, five years later, I still think that functional languages will rule... the 
functional programming paradigm... one that stresses immutable data structures, 
composition, and pattern matching will provide a better way to write complex systems 
whether those systems are business systems, interactive applications, games, or even 
system level... writing those systems using functional languages will provide a better 
foundation, better stability, and ultimately lower total cost of ownership.

だから、5年の後には関数型言語が支配的になるであろうとわたしは考えている。
immutable なデータ構造、合成、パターンマッチングといったものの強調は、
ビジネスのものであろうとなかろうと複雑なシステムであるとか
対話的アプリケーション、ゲーム、システムレベルであってさえ
それらを記述するためのより良い手段を提供するだろう。
関数型言語を使ってそういったシステムを記述することは
better foundation、より良い安定性、さらには ownership の
とことん低減されたトータルコストをもたらすだろう。
#イマイチ

Let's take a tour of the landscape to see where each of the major functional languages 
is and why I think it hasn't become popular.

で、挙げられた言語が Erlang、Haskell、OCaml、F#、Scalaといったところ。 気が向いたら以下略

■_ All My Code is Now in Git

github にアカウント作ったけど放置したままだ

All My Code is Now in Git - House Absolute(ly Pointless)
All My Code is Now in Git

By Dave Rolsky on May 26, 2011 5:12 PM

Yesterday I converted all of my (many) Mercurial repos over to Git. The reason for 
this has very little to do with my preference. I've used both hg and git quite a bit 
over the past few years, and both are quite good. However, the (FOSS) Perl community 
as a whole seems to have settled on git, and people complained about having to use hg 
with my code.

(略)

Overall, here's my list of plusses and minuses for both hg and git:

Git:

    * + Gitalist and gitolite beat anything available for hg

    * - You really need something like gitolite to manage access control if you have
        lots of repos
        すでに多くのリポジトリを持っているのなら、gitolite のようなアクセスコントロール
        を管理するものが必要だろう

    * + The gitg program is way nicer than hgk (gah, Tk)
        gitg は hgk よりも良い

    * - git's UI (it's command set, basically) can be really weird
    * + git is infinitely flexible (rebase, squash, amend, ...)
    * - git is infinitely flexible (rebase, squash, amend, ...)

Hg:

    * + Much saner UI - I think hg is just better thought out

    * - Having two types of branches really isn't helpful - pick one, please
        ブランチに二つのタイプがあるのは本当に助けにならない。
        どちらかひとつにして欲しい

    * + Hg's help/docs is much better. The git docs seem to present things in an
        entirely random order, instead of helping you do learn common operations
        first. Compare "hg help pull" to "git help pull" some time.

        Hg のヘルプやドキュメントはとても良い。git のドキュメントは一般的な操作を
        最初に学ぶのを手助けするのではなく、完全にランダムな順序で内容が並べられている
        様にに感じられる。


Both are excellent tools, but for Perl work it's probably best to just choose the one 
"everyone" is already using.

UI とドキュメントは Hg のがよいと。

■_

■_ DNS

WEBラジオ・テレビ・ポッドキャストなどネット番組 30 

529 声の出演:名無しさん [sage] 2011/05/27(金) 21:41:51.64 ID:+GrSYX3/0 Be:
    だからDNSが浸透しただけだっての 

539 声の出演:名無しさん [sage] 2011/05/28(土) 07:24:05.00 ID:uxZGes340 Be:
    >>529
    DNSとか言われても意味分からんて 

542 声の出演:名無しさん [sage] 2011/05/28(土) 10:26:14.62 ID:uQFL6tcJ0 Be:
    >>539
    どれだけ
    なまえが
    しんとうしたか 

542 にくすりと。

■_

Excel VBA 質問スレ Part19 

8 デフォルトの名無しさん [] 2011/05/19(木) 18:39:40.63 ID: Be:
    vbaのコードをカラー印刷する方法ってある?
    MS XPS Document Writerを使っても白黒にしかならないんだけど。

    VB2008ならMS XPS Document Writerでカラー印刷できるのに、
    VBAはなんでカラー印刷にならないんだろうか? 

14 デフォルトの名無しさん [] 2011/05/19(木) 20:58:45.19 ID: Be:
    >>8
    実は俺もコードをカラー印刷する方法を知りたい。
    誰か教えて。 

16 デフォルトの名無しさん [sage] 2011/05/20(金) 03:56:03.69 ID: Be:
    ソースをVisualStudioにコピペして印刷 

18 8=14 実は同一人物ですw [] 2011/05/20(金) 09:59:30.88 ID: Be:
    >>16
    うまくいきました。ありがとうございます。
    16さんもやってますか?

    しかし、XPS Document Writerは
    いちいち上にパス名が表示されてうざいのですが、
    これを全く表示しない方法ってある?
    16さんのような使い手ならご存知かと。。。 

確かにてきとーに(キーワードやらが)色分けされて印刷されるとうれしい。か。 あのエディター見通しが悪いし。 テキスト形式で出力しておいてふつーのエディター使うのもありだけど。

■_

明日も雨かな

2011年05月27日

■_

MOLESKIN のパックマン30周年記念だかのノートが半額ぐらいになって売ってたので買ってみた。

■_ たぼぱ

別の探し物をしてたら引っかかった。 Trubo Pascal 3.0 をリバースエンジニアリングとか。よくやるなあ。

Turbo Pascal 3.0 Compiler and Code Generation Internals


Turbo Pascal 3.0 Compiler / Code Generation Internals

The following is documentation I created after reverse engineering the Turbo Pascal 
3.01A compiler. While many features, e.g. units and objects, have been added, today's 
compiler is still related to the old code.

Before you flame me about stuff that has been fixed, remember that this is about an 
OLD version of the compiler.

以下略

4.0ならなお良かったのに。とは望みすぎだろうか。

■_

■_ (まだ)読んでない

面白そうではあるんだけど。

The Architecture of Open Source Applications

Architects look at thousands of buildings during their training, and study critiques 
of those buildings written by masters. In contrast, most software developers only ever 
get to know a handful of large programs well?usually programs they wrote 
themselves?and never study the great programs of history. As a result, they repeat one 
another's mistakes rather than building on one another's successes.
RubyGems is not a Battlefield: Part 1 (5/25 meeting w. Eric+Ryan) - The Majestic Sea Creature

Tonight I had my first meeting with Eric and Ryan to discuss the areas of greatest 
tensions with the current state of RubyGems. The meeting was quite productive and my 
personal impression is that despite the intense drama in recent weeks, that both Eric 
and Ryan realize that there are issues that need addressing and are willing to make 
concrete steps to ease tensions. The following list outlines specific changes that 
they plan to make happen:
Re: Suggestions on implementing an efficient instruction set simulator in LuaJIT2

Final words: A modern compiler contains a huge set of heuristics that interact with 
each other in strange ways. They have been tuned for 'average' code. But an 
interpreter is a very different beast, so you'll inevitably get disappointing results. 
--Mike

■_

寝る。

2011年05月26日

■_

・ダムエー
GUNDAM A (ガンダムエース) 2011年 07月号 [雑誌]
キリシアあぼーん>オリジン そしてドロスどんだけでかいんだw

・モーニング
グラゼニが週刊連載。 そいや単行本まだ買ってなかった。 というかコンビニで一回見かけたけど本屋では見かけてない気がする。

なんか最近、微妙な「無双」の使い方をぽつぽつ見かけるような。

■_ 愚問

どうも同じ人っぽいのだけど、慇懃無礼というかなんと言うか。

●接続の有無の認識についての拙い愚問です。
 サーバへアクセスしてきたクライアント群との個別的なコネクショ...
 http://questionbox.jp.msn.com/qa6761962.html

--
●シングルサインオンについての酷く拙い愚問です。
 シングルサインオンの仕組みが導入されていますと、たとえ同じID...
 http://questionbox.jp.msn.com/qa6762049.html

--
●L2TPについての酷く拙い愚問です。
 L2TPが利用されている間柄の下では、P2Pの通信が行なわれている...
 http://questionbox.jp.msn.com/qa6758192.html

--
●L2TPをP2P方式で使う状況に関する愚問です。
 P2PをWAN側で使う場合にも送受信の優先順位が固定化されていない...
 http://questionbox.jp.msn.com/qa6760591.html

●グローバルIPアドレスについての稚拙な愚問です。
 WAN側からポート開放対象の「ストレージ群」への【ウェブアクセ...
 http://questionbox.jp.msn.com/qa6760600.html

--
●ポート開放の保全についての酷く拙い愚問です。
 サーバ側で開放させるポート番号を固定化させないといけないのは...
 http://questionbox.jp.msn.com/qa6760690.html

--
●「フレッツスポット」についての拙い愚問です。
 「フレッツスポット」で、複数の顧客の方々が【個別のISP業者】...
 http://questionbox.jp.msn.com/qa6755244.html

--
●ウェブメールについての酷く拙い愚問です。
 メールクライアントソフトから送信させずに、ブラウザ経由の方式...
 http://questionbox.jp.msn.com/qa6752174.html

--
●ウェブアクセスについての稚拙な愚問です。
 WAN側からポート開放対象の「ストレージ群」への【ウェブアクセ...
 http://questionbox.jp.msn.com/qa6754228.html

--
●セーフモード関連の酷く拙い愚問です。
 セーフモード起動中にはDeviceManager画面の表示項目もが食い違...
 http://questionbox.jp.msn.com/qa6748335.html

--
●コピーガード対象CDに関しましての拙い愚問です。
 コピーガードが設定されているCDでは、誤り訂正符号が意図的に壊...
 http://questionbox.jp.msn.com/qa6749731.html

--
●「RAID管理ユーティリティ」についての愚問です。
 Buffalo社製のRAID管理ユーティリティ(http://buffalo.jp/downl...
 http://questionbox.jp.msn.com/qa6745525.html

●急に気になった拙い愚問です。
 PCの自作を行なった経験が御座いませんので、拙い内容なのですが...
 http://questionbox.jp.msn.com/qa6745627.html

--
●ロードバランサについての酷く拙い愚問です。
 ロードバランサが導入されていますと、複数のサーバに同じポート...
 http://questionbox.jp.msn.com/qa6744256.html

●メインメモリについての酷く拙い愚問です。
 メインメモリから各アプリケーションへ割り当てられ得るアドレス...
 http://questionbox.jp.msn.com/qa6744351.html

--
●「アローヘッド」に関しましての酷く拙い愚問です。
 東京証券取引所のアローヘッドは、一体どういう仕組みで1000倍の...
 http://questionbox.jp.msn.com/qa6740945.html

--
●USB接続型のHDDについての酷く拙い愚問です。
 PC用の外付けHDDの中にも、TV放送の録画にも適した機種が増えて...
 http://questionbox.jp.msn.com/qa6741586.html

--
●二重ログインに関しましての愚問です。
 同じIDで同じサーバへ同時にログインされてはいけない故に、二重...
 http://questionbox.jp.msn.com/qa6738411.html

●ディレクテッド・ブロードキャストに関する愚問です。
 ディレクテッド・ブロードキャストはVPNとかVLANとかの環境の下...
 http://questionbox.jp.msn.com/qa6738425.html

--
●DMZのメリットについての愚問です。
 適切な個数のポートの開放よりもDMZの採用の方が比較的に望まし...
 http://questionbox.jp.msn.com/qa6738431.html

--
●エラー表示に関しましての愚問です。
 「補足入力」の枠への入力の直後に、次の通りの表示がよく出てい...
 http://questionbox.jp.msn.com/qa6739257.html

--
●マルチキャストレートについての愚問です。
 PCからのウェブブラウジングとTVでのハイビジョン放送視聴とを同...
 http://questionbox.jp.msn.com/qa6736163.html

--
●削除後の質問のQナンバーについての愚問です。
 もし削除後にも対象の質問のQナンバーが欠番になっていなかった...
 http://questionbox.jp.msn.com/qa6736956.html

--
●別拠点からの二重ログインについての愚問です。
 OKWave様のサーバの事例でも構いませんが、別の拠点から同じサー...
 http://questionbox.jp.msn.com/qa6737066.html

●仮想メモリの容量についての愚問です。
 仮想メモリの容量が物理メモリの容量を超える事はよく有るのでし...
 http://questionbox.jp.msn.com/qa6737134.html

--
●PC部品の相性についての酷く拙い愚問です。
 Wikipediaの或るページ(http://ja.wikipedia.org/wiki/%E7%9B%B...
 http://questionbox.jp.msn.com/qa6734366.html

--
●トランザクション処理についての愚問です。
 例えば此のサイトで回答欄への入力が行なわれている間に、もし質...
 http://questionbox.jp.msn.com/qa6735000.html

--
●相性問題についての愚問です。
 メモリの相性問題は頻繁に多くの書籍等でも見受けられますが、或...
 http://questionbox.jp.msn.com/qa6732131.html

--
●NASのデータの復旧についての愚問です。
 PC内部のCドライブからのデータサルベージの場合には、Ubuntuの...
 http://questionbox.jp.msn.com/qa6731979.html

--
●ソフトウェアルーターについての愚問です。
 Buffalo社製の「親機子機切り替えツール(http://buffalo.jp/dow...
 http://questionbox.jp.msn.com/qa6729961.html

--
●設定保存復元ツールについての愚問です。
 Buffalo社の「設定保存復元ツール(http://buffalo.jp/download/...
 http://questionbox.jp.msn.com/qa6727631.html

--
●データベースの初心者からの愚問です。
 Oracleの参考書を初めて読ませて頂いた時に、次の疑問にぶつかり...
 http://questionbox.jp.msn.com/qa6713130.html

●ループバックアダプタについての愚問です。
 昨日迄の問い合わせへ御協力を賜れました御蔭で、”Oracle”の利...
 http://questionbox.jp.msn.com/qa6714869.html

■_ Haskellは

Node.js の作者様がインタビューで

Node.js Interview: 4 Questions with Creator Ryan Dahl | Bostinnovation: Boston Innovation, Start-ups and Tech News

BostInno: Why did you originally choose javascript for node?

Dahl: Originally I didn't. I had several failed private projects doing the same on C, 
Lua,  and Haskell. Haskell is pretty ideal but I'm not smart enough to hack the GHC. 
Lua is less ideal but a lovely language - I did not like that it already had a lot of 
libraries written with blocking code. No matter what I did, someone was going to load 
an existing blocking Lua library in and ruin it. C has similar problems as Lua and is 
not as widely accessible.  There is room for a Node.js-like libc at some point – I 
would like to work on that some day.

V8 came out around the same time I was working on these things and I had a rather 
sudden epiphany that JavaScript was actually the perfect language for what I wanted: 
single threaded, without preconceived notions of “server-side” I/O, without existing 
libraries.

Haskell is pretty ideal but I'm not smart enough to hack the GHC. かあ。

■_

■_ ××パターン

この記事結構面白そう

 >Fuzz Box: Resign Patterns
Resign Patterns

The article titled Resign Patterns by Michael Duell was recently posted in a Linkedin 
discussion by Sergey G. , (Systems Architect).

The discussion  was about:

    What's your favorite design pattern? Why? 

and among the very useful and informative comments the Resign Patterns one hit me the 
most. It is a humorous take on design patterns and how they are applied under 
development pressure.

I reformatted the article in pdf format and is now available from Google Docs.

You can read the original text below.

以下略

肝心な部分はまだ読んでないw

■_ (?:en)?coding

Ruby 初心者スレッド Part 43

268 デフォルトの名無しさん [sage] 2011/05/26(木) 08:51:46.46 ID: Be:
    どうでもいいんだけど、 encoding: utf-8 と書くのはできればやめて欲しい
    coding: utf-8 と書いて欲しい 

269 デフォルトの名無しさん [sage] 2011/05/26(木) 09:04:13.45 ID: Be:
    coding:utf8と書けるようにしなかったのは世紀の大失策 

275 デフォルトの名無しさん [sage] 2011/05/26(木) 11:45:17.46 ID: Be:
    >>268
    意味的にはencoding=符号化の方法、coding=プログラムを書くこと
    だと思ってたから、encodingのほうが合ってるような気がするんだが 

280 デフォルトの名無しさん [sage] 2011/05/26(木) 12:02:10.29 ID: Be:
    # -*- coding: utf-8 -*-
    # encoding: utf-8
    # coding: utf-8

    のどれかを推奨
    -*- をつけると Emacs さんが自分向けだと思ってコマンド解釈開始するので、その場合は conding でないと困る

    # -*- encoding: utf-8 -*-

    はファイル開くときに Emacs さんが毎回文句言うのであまりよくない
    ああ、vim くんはなんかこうオリジナリティ(苦笑)のある書き方があったはず 

けっこう違いがあるのね。

■_ arrays of arrays

awkについて語るスレ $2 
595 デフォルトの名無しさん [sage] 2011/05/25(水) 20:17:22.02 ID: Be:
    あぁああぁぁぁ~~~無理だったか、、無理なのかー!a[0][0] = 1 → syntax error 

最新版の(開発晩だっけか?) gawk ならできたりする。

8.7 Arrays of Arrays
====================

`gawk' supports arrays of arrays. Elements of a subarray are referred
to by their own indices enclosed in square brackets, just like the
elements of the main array.  For example, the following creates a
two-element subarray at index `1' of the main array `a':

     a[1][1] = 1
     a[1][2] = 2

   This simulates a true two-dimensional array. Each subarray element
can contain another subarray as a value, which in turn can hold other
arrays as well. In this way, you can create arrays of three or more
dimensions.  The indices can be any `awk' expression, including scalars
seperated by commas (that is, a regular `awk' simulated
multidimensional subscript). So the following is valid in `gawk':

     a[1][3][1, "name"] = "barney"

2011年05月25日

■_

・アフタヌーン
月刊 アフタヌーン 2011年 07月号 [雑誌]
読むところが少なくなった感が。

・ビッグコミック
星を継ぐもの。

■_

■_ 今日も今日とて

つつく。

InfoQ: Scala 2.9.0、並列コレクションを導入

去年Scala 2.8がリリースされたとき、それによって導入されたバイナリレベルおよびソースレ
ベルの非互換性について多くのユーザは懸念していた。Martin Odersky氏は最近メーリングリス
トでこの話題を取り上げた:
InfoQ: Scala 2.9.0 Introduces Parallel Collections

When Scala 2.8 was released last year, many users were concerned about the binary and 
source incompatibilities it introduced. Martin Odersky recently addressed the topic on 
the mailing list:

「非互換性を導入」のようには言わないんじゃないかなあ。>「導入」 持ち込まれたとか入り込んだ。の方が意味が通じると思うのだけど。 「非互換性」は「機能」のようなものじゃないし。

■_

風呂入ったり本を読んでたりすると時間が。

2011年05月24日

■_

Coder at Work
献本されたりとかないので自分で買いました。
表紙

■_ 21 Years of Python

Guido パパがどこかで講演したんですかね。 そのとき使用されたスライド → http://mvdirona.com/jrh/TalksAndPapers/GuidoVanRossum_21_years_of_python.pdf

知っていることもいろいろあったのですが、興味深かったところ。 Perspectives - Guido van Rossum: 21 Years of Python にあるメモを拝借して

Perspectives - Guido van Rossum: 21 Years of Python

·         Python 2 vs Python 3

o   Fixing deep bugs intrinsic in the design

o   Avoid two extremes:

§  perpetual backwards compatibility (C++)

§  rewrite from scratch (Perl 6)

o   Our approach:

§  evolve the implementation gradually

§  some backwards incompatibilities

§  separate tools to help users cope

■_ 重箱の隅

InfoQ: Monoの死と再生
資金調達

Monoベースの商品提供に専念する会社というアイデアはまったく新しいというわけではない。
Miguelによれば、彼らは去年Novellにスピンオフ企業をつくることを説得しようとしたようだ。
それはうまくいくことはなかったが、このことにより彼らが“エンジェルによる資金調達”と新
会社を商用製品の開発に十分なほど長く創業を続けるためのエンジニアリング契約の組み合わせ
を準備できると説明しているかもしれない。

とはいえ、Xamarinは次のようなことをするためのさらなる資金調達を模索している:
InfoQ: The Death and Rebirth of Mono
Funding

The idea of a company dedicated to just Mono-based offerings isn't entirely new. 
According to Miguel they were trying to convince Novell to create a spin-off company 
for the last year. While that never panned out, it probably explains who they were 
able to line up a combination of “angel funding” and engineering contracts to keep 
the new company afloat long enough to develop their commercial offerings.

That said, Xamarin is looking for even more funding to do things such as:

While 以下の文の訳に違和感が。 「創業」って「長く続ける」ものではないですよねえ。

■_

もうひとつ。

InfoQ: Essential: a new Language Workbench
One of the key differences, when compared to other tools like Eclipse Xtext, is that 
Essential focuses on model interpretation which means that prototyping a code 
generation can be done in an agile way without the need of generating any 
infrastructure boilerplate or meta-editor plumbling accessories. By Contrast Xtest 
requires that for any change in the model, a new version of the model parser be 
generated, which is at the core of the transformation engine.
Our industry is evolving at an incredible pace, with new architetures, architectures 
components, SDKs appearing almost daily, and the variety of devices on which solutions 
need to operate, the switch to a modeling approach to software development (MDSD), and 
metaprogramming in particular, could become more compelling. What do you think?
InfoQ: Essential: 新しい言語ワークベンチ
Eclipse Xtestなどの他のツールと比べた場合、重要な差異の一つは、Essentialがモデル解釈に
フォーカスしている、すなわち、コード生成のプロトタイプをつくることがいかなるインフラ用
の定形コードやメタエディタをつなぐアクセサリを生成する必要のないアジャイルなやり方で行
うことが可能である、ということだ。対照的に、Xtestはそのモデルのどんな変更をしたときで
も、新しいバージョンのモデルパーサが生成され、それが変換エンジンの中心となる。
私たちの業界は信じられない程のペースで進化している。そしてそれは、新しいアーキテクチャ、
アーキテクチャの要素、ほぼ毎日のように出てくるSDK、種々のデバイスなどがあり、その上で
動作しなければならないソリューション、ソフトウェア開発に対するモデリングアプローチへの
転換(MDSD)、特にメタプログラミングについてもっと考えざるを得なくなるかもしれない。あ
なたはどう考えるだろうか?

前半。 「対照的に」に続いている文が、その前の文とつじつまがあっていないような。 原文にある "requires" にあたる部分も訳文にはないですよね。

後半では、「そしてそれは」の「それ」って何を指しているんでしょう? 「わたしたちの業界」? 原文では“with”を使っているのだし、「そしてそれは」以下の扱いのニュアンスが違うような。

種々のデバイスなどがあり、その上で動作しなければならないソリューション というのは原文だと and the variety of devices on which solutions need to operate にあたると思うんですが、on which solution なんだから、 この部分の「主役」は "variety of devices" ではないでしょうか? これを含む "Our industry is" から始まる文はカンマはたくさんあるし , and というのも二箇所出てきたりして非常に面倒くさいものですが、 "could become more compelling" なものには「ソリューション」は入らないんじゃないでしょうか。

■_

■_

じかんがねー

The Daily Flux ≫ Blog Archive ≫ Getting newbies involved in open source
http://brandonhays.com/blog/2011/05/23/getting-newbies-involved-in-open-source/

LLVM Project Blog: C++ at Google: Here Be Dragons
http://blog.llvm.org/2011/05/c-at-google-here-be-dragons.html

Tail recursion makes your loops cleaner : Inside T5
http://blog.ezyang.com/2011/05/tail-recursion-makes-your-loops-cleaner/

この辺のこともなんか書こうと思ってたのに

■_ Things I miss from Java while programming in C#

飽きた(こればっか)

Things I miss from Java while programming in C# ≫ Cameron McKay

Things I miss from Java while programming in C#

Posted May 2, 2011

One of the perks of being a freelance programmer is that I get to program in a lot of 
different languages, either because the client has dictated a certain language, has 
left the choice up to me, or limited me by what is supported by a host (Hi PHP!).

フリーランスのプログラマーでいることの one of the perks (役得/特典のひとつ?) は
クライアントが特定の言語を支配していてそれを選択することを強制されたり
あるいはホストでサポートされているものが制限されている (やあ PHP!) 
ために多くの異なる言語でプログラムを書くことです。

As fate would have it, I have had the good fortune to have extensive experience with 
both C# and Java. While many articles will list things a programmer misses from C# 
while coding in Java (properties, LINQ, reified generics, type inference, named and 
optional parameters, closures, continuations), this post intends to look at things a 
Java programmer might miss while coding in C#.

As fate would have it, 
わたしは  C# と Java の両方で extensive experience する good fortune を had しました。
多くの articles では C# を使っていたプログラマーが Java でコーディングしているときに
なくて困っているものを列挙していますが
(properties, LINQ, reified generics, type inference, named and optional parameters, closures, continuations)、
このポストでは Java プログラマーが C# でコーディングしているときに物足りなさを
感じるかもしれないことがらに焦点を当てています。

1. Method return type covariance
   method return type の covariance

Covariant method return types are one of the lesser known Java features (see Section 8.4.5
in the JLS). Basically, Java allows you to narrow the return type of a method when
overriding it in a sub-class. For example:

covariant method return type はあまり知られていない Java の機能です
(JLSの Section 8.4.5を参照してください)。
基本的には、サブクラスでオーバーライドされているときに
メソッドの retrun type を narrow することを Java は許可します。
例をあげましょう:

public class Foo {
}

public class SubFoo extends Foo {
}

public class Bar {
    final Foo foo = new Foo();
    public Foo getFoo() {
        return foo;
    }
}

public class SubBar extends Bar {
    final SubFoo subFoo = new SubFoo();

    @Override
    public SubFoo getFoo() {
        return subFoo;
    }
}

Although situations where this is needed are seldom, it is a nice feature to have when you
need it. An good example of its usage is in the Apache Wicket framework. All pages in Wicket
typically derive from the WebPage class. Thus, when you want to access information from a
custom Wicket session you need to do something like this:

これが必要となる局面はめったにありませんが、必要となったその時にはあると nice な機能で
す。その良い使用例は Apache Wicket framework です。Wicket のすべてのページは typically 
に WebPage class から derive しています。したがって、カスタム Wicket セッションから情
報にアクセスしたい場合には次のようにする必要があります:

public class UserInfoPage extends WebPage {
    public UserInfoPage() {
        FooSession session = (FooSession) getSession();
        String userName = session.getUserName();
        ...
    }
}

However, if you add a class above UserInfoPage called FooPage, you can use a covariant
return type to eliminate the unsightly cast:

ただし、上記の UserInfoPage に FooPage というクラスを追加すれば、
covariant return type を使って unsightly なキャストを削除できます。


public class FooPage extends WebPage {
    @Override
    public FooSession getSession() {
        return (FooSession) super.getSession();
    }
}

public class UserInfoPage extends FooPage {
    public UserInfoPage() {
        FooSession session = getSession();
        String userName = session.getUserName();
        ...
    }
}

To me this is preferable to adding another method called getFooSession(). Having two methods
can be confusing to a future maintainer (do I want getFooSession() or getSession()? What's
the difference?) and needlessly clutters your IDE's code completion.

わたしにとってこれは getFooSession() という名前の別のメソッドを追加するのに好都合です。
二つのメソッドを持つことは、将来のメンテナーを混乱させたり (わたしは getFooSession や 
getSeesion() を要求するでしょうか? その違いは?) IDE のコード補完を不必要に混乱させてし
まうかもしれません。


There is no equivalent in C#, short of adding a method. Will C# ever support such a feature?
It's hard to say, but probably not anytime soon. There has been a request for covariant
method return types since 2004. Microsoft response then was:

メソッドの追加を除く (short of adding a method) と、これと等価なものは C# にはありません。
C# もこういった機能をいずれはサポートするでしょうか?
It's hard to say, but probably not anytime soon.
covarinat な method return type は 2004年からリクエストされているものですが、
Microsoft の反応はこういうものでした:

    We hear this request a lot. We'll consider it for the next release.
    そのような要望は多数届いています。次のリリースでは考慮したいと考えています。

After seven years and three major C# releases, it looks like they're still considering it.

7年が経ち、C#は三つのメジャーリリースを数えましたが、彼らはまだ considering it しているようです。

2. Class-like enums (クラスのような enum)

This one is not a big surprise, as it is typically mentioned as one of the few things that
Java has done better that C#. In C#, enums are basically glorified integral types. As such,
they can't contain any extra data without using attributes. While attributes are nice,
accessing them requires quite a bit of boilerplate.

これは big surprise ではなく、C# よりも Java がよく行っている数少ないことのひとつとし
て typically に mention されるものです。C# の enum は基本的には glorified (実際よりも
よく見える) integral types です。C# の enum それ自体は attribute を使わずに extra data 
を含むことができません。attribuite は nice ではあるのですが、それにアクセスするには
quite a bit of boilerplate が必須となります。


public enum MotionType {
    Stationary,
    Walking,
    Running,
    [Description("Time Travelling")],
    TimeTravelling
}

...

MotionType type = MotionType.TimeTravelling;
var description = type
    .GetType()
    .GetField(type.ToString())
    .GetCustomAttributes(typeof(DescriptionAttribute), false)
    .Cast<DescriptionAttribute>()
    .First()
    .Description;
Console.WriteLine(description);

A further restriction of C# enums if that they can't be used as a generic constraint.
For example, the following code would not compile:

generic constraint として使うことができない場合、C# の enum にはさらなる制限があります。
たとえば次のようなコードはコンパイルできません:

public class Monster<TMotionType> where TMotionType : enum {
}

According to C# MVP Jon Skeet, this is not a restriction of the CLR, but is actually a
restriction of the Microsoft C# compiler. The best you can do to work around this is
to use the broader constraint where : struct, or the Unconstrained Melody library.

C# MVP の Jon Skeet によれば、これは CLR の制限ではなくMicrosoft の C#コンパイラーの制
限であるそうです。これに対してあなたができる最善の workaround は、struct のようにもっ
と制限の緩いものを使うか、さもなくば Unconstraind Melody ライブラリを使うといったもの
です。


Java enums, on the other hand, are specialized classes. Like C# enums, Java enums can
be used with switch statements and be converted to integral types. However, Java enums
go far beyond these simple uses. Java enums can have instance fields, instance methods
and even per-constant methods. Java generics can also be constrained to take only enums.

一方 Java の enum は specialized class です。C# の enum のように Java の enum も 
switch 文に使用できて、integral types に変換されます。しかし Java の enum はこういった
単純な使い方以外にもインスタンスフィールドやインスタンスメソッド、per-constant メソッ
ドさえ持てるのです。Java のジェネリクスは enum だけを取るように制限することも可能です。


Here's how the MotionType enum could be written in Java (notice how easy it is to get the
description in this case):

Java で MotionType enum をどのように書けるかの例を出しましょう
(notice how easy it is to get the description in this case):

public enum MotionType {
    STATIONARY("Stationary"),
    WALKING("Walking"),
    RUNNING("Running"),
    TIME_TRAVELLING("Time Travelling");

    public final String description;
    MotionType(String description) {
        this.description = description;
    }
}

...

MotionType type = MotionType.TIME_TRAVELLING;
System.out.println(type.description);

This is just scratching the surface of Java enum capabilities. I highly recommend reading
Chapter 6 of Effective Java or the Oracle enum documentation.

これは Java の enum capabilities の表面を引っ掻い (scratching the surface) ただけです。
わたしは Effecive Java の第6章か Oracle enum documentation を読むことを強くお勧めします

3. Anonymous inner classes (無名の内部クラス)

This is another it's-useful-when-you-need-it feature of Java that C# mostly addresses with
events and delegates. The most common situation for anonymous inner classes in Java is for
listeners:

これはもうひとつの、C# がイベントと delegete を使って mostly address しているJava の 
it's-useful-when-you-need-it feature です。Java における無名内部クラスの most common 
situation はリスナーに使うものです:

Widget widget = new Widget() {
    public void onInteraction(WidgetState state) {
        ...
    }
};

In C#, this is handled using events and delegates:
C# ではこれはイベントと delegete を使って handle されます:


Widget widget = new Widget();
widget.Interaction += state => {
    ...
};

The C# approach is superior in most cases. There's far less clutter and it's a lot easier to
add listener support to a class in C#. Furthermore, since it's a language feature, you can
count on it being more or less the same everywhere. However, it's not without drawbacks.
You'll notice in the previous Java example, we can guarantee that there is only one listener.
Furthermore, if we declare onInteraction as abstract, we can also ensure that all concrete
implementations of Widget have an onInteraction handler. The event/delegate approach as
written cannot make the same guarantees.

この C# 流アプローチはほとんどのケースで superior です。C#では clutter は格段に少ない
し、あるクラスにlistener のサポートを追加するのもとても簡単です。加えてこれは言語の機
能であるので、どこでも同じものであることを期待できます。けれどもそのやり方に欠点がない
わけではありません。
You'll notice in the previous Java example, 
we can guarantee that there is only one listener.
それに加えて onIteraction を abstract として宣言していたら、
Widget の concrete な実装すべてが onInteraction ハンドラーを持つことも ensure できます。
event/delegete 方式では make the same gurantees するように書けません。



Since C# does not support anonymous inner classes, the best we can do to emulate them is
something like this:

C# は無名内部クラスをサポートしていませんから、
それをエミュレートする最善策は次のようにすることです:

Widget widget = new Widget(state => {
    ...
});

…or, if we wanted to make it a little more clear, we could use named parameters:
あるいは、もう少し明確にしたいと望むなら named parameter を使えます;

Widget widget = new Widget(onInteraction: state => {
    ...
});

Locally scoped final/readonly variables
局所化されたスコープを持つ final/readonly 変数

In the book Code Complete 2, Steve McConnell recommends that you use final keyword whenever
possible. The justification for this being that less mutable code is easier to keep track of
mentally and less likely to be accidentally modified. Although the practice of making
everything final can be weird at first, you eventually become so used to using final that
you start to feel a little bit exposed whenever a variable isn't marked final.

Code Complete 2 という本の中で、可能な場合はいつでも予約語 final を使うように Steve 
McConnell は勧めています。書き変えにくい (less mutable) コードは mentally に追跡 (keep 
track) し易く、間違って変更 (accidentally modify) されにくいです。最初はすべてを final 
にしてしまう practice に不安を感じるでしょうが、じきに final を常用するようになり変数
に final がついていないとき常に expose したくなることでしょう。


C# has a nearly equivalent keyword to final: readonly. However, for some reason, readonly is
only usable on the field level. In the local scope, there is no direct equivalent to final in
C#. The best you can do is use const, but this only works with compile-time constants, so

C# は final にほぼ等しい予約語の readonly というものを持っていますが、
いくつかの理由で、この readonly は field レベルでのみ使用可能になっています。
ローカルスコープにおいて、C# には final と direct eqivalentなものはありません。
あなたができる次善の策は const を使うことですが、
これはコンパイル時にのみ働くものです。ですから、


const string foo = Foo.getString();

…won't work.

これは期待通りには動作しません。

Conclusion (結論)

In this article we looked at four features of Java that lack direct C# equivalents: covariant
method return types, class-like enums, anonymous inner classes and locally-scoped
final/readonly keywords. C# is often thought of as a “better Java”. However, as this
article has shown, this is not true. Java may not have as many bells and whistles as its
newer cousin, but it still offers some compelling features that may never find their way into
C#.

この article でわたしたちは、C# には direct quivalents がないような Java の 機能四つ、
すなわちcovariant method return types, クラスのような enum (class-like enums)、 無名内
部クラス (anonymous inner classes)、スコープが局所化されている予約語の final/readonly 
(locally-scoped final/readonly keywords)に注目しました。C# はしばしば“better Java”と
見なされています。けれどもこの articleで述べたようにそれは真実ではありません。Java は
その newer cousin のような many bells and whistles を持っていないかもしれません。しか
しまだ、their way itno C# が never find であろういくつかの compelling features を 
offer しています


Copyright c 2011 Cameron McKay

2011年05月23日

■_

北方三国志
三巻同時に発売。 三巻の終わりで虎牢関の辺りまでかな。気になるところがそこそこあるけど、まあ面白い (原作小説は読んでません)。
三国志 (1) (バンブーコミックス) 三国志 (2) (バンブーコミックス) 三国志 (3) (バンブーコミックス)
しかし、紙がいいのか同サイズのほかの本に比べると重みがあるような。

どうもわたなべさんとはまた別のわたなべさんがいらっしゃるらしい(謎)

■_ 懇親会

秋葉原でやったのはいつだっけ? ってまあそのあとは参加してないんですが。

Rubyについて Part 43 

356 デフォルトの名無しさん [sage] 2011/05/23(月) 03:20:41.85 ID: Be:
    RubyKaigi初めていくんだけど知人いないのに懇親会とか言ってもしょうがないよね。
    泣きながら独りで飯を食うだけになりそう。 

357 デフォルトの名無しさん [sage] 2011/05/23(月) 03:51:51.14 ID: Be:
    あくまで主観だけど
    他の言語の集いと比較すると人付き合い苦手(非リア充)な感じの人が集まってるからあんま気にすんな。 

358 デフォルトの名無しさん [sage] 2011/05/23(月) 04:01:31.68 ID: Be:
    あいつがリア充だったころ俺はうな重だった
    奴らがペアプログラミングしてるころ俺はペヤング食ってた

    わかるかなぁ、わかんねえだろうなぁ 

360 デフォルトの名無しさん [] 2011/05/23(月) 09:06:44.04 ID: Be:
    むかしのRubyKaigi懇親会はみんな話すことが出来なくて食べ物だけが
    消費されていたが、最近は食い物はあまるようになった、とどっかのブログで見たな。

361 デフォルトの名無しさん [sage] 2011/05/23(月) 09:35:20.46 ID: Be:
    >>360
    みんなはなせなくて食べ物ばかり減っていく光景想像してわろた 

362 デフォルトの名無しさん [sage] 2011/05/23(月) 09:47:55.30 ID: Be:
    というか、事前用意して発表するのでない限り、対面で話す内容なんて特にないんだよな
    お互いの私生活なんて知っても仕方ないし、
    Rubyやプログラミングの話するなら家のPCでメッセージ飛ばせばいい
    これならirbもメールログもGoogleも完備な上、時間も実質無制限だ

    いや、無線とノートPC持ってくる人も多いんだけどさ 

363 デフォルトの名無しさん [sage] 2011/05/23(月) 09:52:13.53 ID: Be:
    Twitterのオフ会でわざわざ集まりながらリプライで会話する人たちに似ている 

364 デフォルトの名無しさん [sage] 2011/05/23(月) 10:56:07.75 ID: Be:
    これまでのレスをまとめると、独りで行く人は懇親会に参加してもあんまり意味ないと・・・。 

365 デフォルトの名無しさん [sage] 2011/05/23(月) 12:00:28.70 ID: Be:
    自ら絡んでいくか、絡まれる必要があるかもしれない。
    絡まれるためにLTでウケを取るという技も一応あるか。

366 uy [sage] 2011/05/23(月) 12:41:32.71 ID: Be:
    コミュ障wwwwwwwwww

    これだから、COMIC1とかM3はあるのに、プログラム関連でそういう発表場みたいなもんないんだよね

367 デフォルトの名無しさん [sage] 2011/05/23(月) 13:07:18.67 ID: Be:
    >>366
    なぜCOMIC1w 

369 デフォルトの名無しさん [sage] 2011/05/23(月) 16:14:16.73 ID: Be:
    懇親会は、知らん人と話して人脈を作るためにあるらしい

370 デフォルトの名無しさん [sage] 2011/05/23(月) 17:48:05.92 ID: Be:
    貰ったサインの数で景品(2009)とか
    会いたいと希望する人(入場時に名札に書く)と会わせることが出来た数で景品(2010)とか
    という懇親会の企画は人脈作りを狙っているらしい。 

371 デフォルトの名無しさん [sage] 2011/05/23(月) 17:56:24.30 ID: Be:
    学生ですけど、就職先探しに懇親会にでるのは有りですかね? 

372 デフォルトの名無しさん [sage] 2011/05/23(月) 18:00:32.45 ID: Be:
    >>371
    なし
    そんなアンオフィシャルものに出るより前に「決まっている」はずだから
    なにより仕事とプライベートを自分のために安易に混ぜてはいけない

    まあ、インターンでも探せばいいんじゃないのかしら 

373 デフォルトの名無しさん [sage] 2011/05/23(月) 18:06:19.12 ID: Be:
    >>368
    > RAnt
    そういうノリだとMavenはRavenになるのか。胸が熱くなるな。

374 デフォルトの名無しさん [sage] 2011/05/23(月) 19:21:32.12 ID: Be:
    インターンなんてやって現場見せたら絶対就職する香具師居ないだろうなw 

375 デフォルトの名無しさん [sage] 2011/05/23(月) 19:40:50.90 ID: Be:
    だいたい地雷だけど全部が全部地雷ってわけじゃ……。 

376 デフォルトの名無しさん [sage] 2011/05/23(月) 19:47:20.11 ID: Be:
    「つらいおしごと」のレベルで留まってる現場の方が絶対に多いと断言できる

    ひどい所にぶち当たると心が死ぬのも確かなので、選択肢がないならロシアンルーレットだが 

たぶんそこかしこに小集団ができて話し込んでると思われるので、 適当なところに張り付いてタイミングを見計らって会話に参加してみたりするといいんじゃないかな。 などと言ってみる。

■_

■_ 今日の

InfoQ: Jeremy Keith 氏の考える HTML5 のデザイン原則
4. 牛道を舗装する

広く受け入れられている実装がすでにあるのなら,新たな仕様を作るよりも,それを採用するこ
とを検討すべきだ。

例えば HTML5 では,<nav> や <section>,<article>,<aside> などの新たなアー
ティクルモデルが導入されていて,<section> の中で新たに <h1> を開始することができ
る。この方法ならば6つに限定されず,いくつでもヘッダを作ることが可能だ。Tim 
Berners-Lee 氏が 1991 年に記したように。

この、「牛道を舗装する」なんですが、原文では

InfoQ: Jeremy Keith on the Design Principles of HTML5
4. Pave The Cowpaths

When a practice is widely accepted, the specification should consider adopting it 
instead of creating a new one.

For example, HTML5 added some new tags such as <nav>, <section>, <article> 
and <aside>, which introduced a new article model. You can start a new <h1> in a 
<section>, in this way you would have infinite headers instead of six. Tim 
Berners-Lee wrote in 1991:

Pave The Cowpaths まあ直訳すな。がそれでは意味が通らないこと甚だしいので この3語で丸ごとぐぐると → Pave The Cowpaths - Google 検索 いろいろ引っかかります。 日本語ページだとほぼHTML5の話題しかひっかからないようですけど。 んで、

Improving It: Pave the cowpath - good and bad
Pave the cowpath - good and bad

'Pave the cowpath' is a term commonly used in workflows and BPM to indicate a rapid 
implementation that takes the current flow of work, automating it as-is. The cowpath 
(or goat-track) exists because its a commonly trodden path followed by workers to get 
the job done, some based on rules (there's a fence in the way and a gate to go through) 
and some based on convention (a well trodden track is easier to follow than blazing a 
new course through the long grass).

もうちょっとうまい言い換えはなかったかなあと。 なんかいいことわざとかあったろうか。

■_

なんか、かまってちゃんに見えなくも(謎)

2011年05月22日

■_

バグ報告メーリングリストが独立してた bug-gawk (date)

まだあったのだねえ。 コーレル、圧縮ユーティリティソフトWinZip最新版「WinZip 15」 | パソコン | マイコミジャーナル

■_ でざぱた

visitor パターンは苦手だw

「【GoF】デザインパターン 6 

961 デフォルトの名無しさん [sage] 2011/04/07(木) 13:54:18.82 ID: Be:
    visitorパターンの本質って何でしょうか?
    ダブルディスパッチは関係ない気がしました 

962 デフォルトの名無しさん [sage] 2011/04/07(木) 14:39:23.46 ID: Be:
    switchが整数値で分岐するのに対し、visitorは型で分岐する。
    型を整数で表せばswitchが使えるが、整数で表したくないならvisitorを使う。 

963 デフォルトの名無しさん [sage] 2011/04/07(木) 14:55:26.56 ID: Be:
    >>961
    新幹線でワゴンの売り子さんが世話しにきてくれるだろ。
    自分が行かなくても世話してくれる人が引数によって向こうからやってきてくれるのがビジターパターン。 

964 デフォルトの名無しさん [sage] 2011/04/07(木) 14:58:48.85 ID: Be:
    >>962
    なるほど

    >>963
    処理の対象が処理をしてくれるクラスを指定するみたいなことでしょうか 

わかるようなわからないような・・・>963

■_ これから読む

pdf だったりしたので。

www.hans-eric.com » Incremental Development and Regression Testing Paper Released

Incremental Development and Regression Testing Paper Released

May 17th, 2011 Hans-Eric	Leave a comment Go to comments

As you might know I wrote about the regression testing problem in The Swamp of Regression Testing.


略
You find it under Shared Stuff on my website, or by following the below link.

Incremental Development and Regression Testing (PDF)
http://www.hans-eric.com/wp-content/uploads/2011/05/Incremental-development-and-regression-testing.pdf

Please don't hesitate to contact me if you have any feedback to share.

Cheers!

■_ 特殊フォーム

vallog: フラットなリストをネストしたリストに

vallog: フラットなリストをネストしたリストに
(define (flat->nest start-pred end-pred ls
                    :optional (filter-func identity))
  (let rec ((ls ls)(acc '()))
    (if (null? ls)
        (values (reverse acc) '())
        (cond ((start-pred (car ls))
               (receive (nested rest)
                   (flat->nest start-pred end-pred (cdr ls) filter-func)
                 (rec rest (cons (filter-func (cons (car ls) nested)) acc))))
              ((end-pred (car ls))
               (values (reverse (cons (car ls) acc))
                       (cdr ls)))
              (else (rec (cdr ls)(cons (car ls) acc)))))))

元記事だとキーワードハイライティングがついてるんですが、 receive ってのがハイライトされてて「はて、そんな関数やらあったろうか」 と悩むことしばし。

Gauche ユーザリファレンス: 4.6 変数束縛

Special Form: receive formals expression body …

    [SRFI-8] この構文により、多値を受け取ることができます。 formalsはシンボルのリストです。
    不完全なリストであっても構いません。 expressionが評価され、返された値がlambda形式の引数の
    束縛と 同じようにしてformals内の変数と束縛され、その環境下でbody …が 評価されます。


    (define (divrem n m)
      (values (quotient n m) (remainder n m)))

    (receive (q r) (divrem 13 4) (list q r))
      ⇒ (3 1)

    (receive all (divrem 13 4) all)
      ⇒ (3 1)

    (receive (q . rest) (divrem 13 4) (list q rest))
      ⇒ (3 (1))

    なお、多値のcall-with-valuesは receiveと等価な手続き的インタフェースです。 多値を複数
    のトップレベル変数に束縛するには、define-values (定義参照) が使えます。 また、SRFI-11
    (srfi-11 - Let-values) のlet-valuesと let*-valuesはletのような形式で多値を扱うことがで
    きます。 

勉強不足でした ○| ̄|_ つーか、srfi にどういうのがあるのかとかほとんど知らなかったり。

■_ 10の

途中に割りと見かける気がするフレーズ (“Write every commit message like the next person who reads it is an axe-wielding maniac who knows where you live”) があったので訳されてるかと思ったけどそうではない?

Troy Hunt: The 10 commandments of good source control management

Observations, musings and conjecture about the world of software and technology

The 10 commandments of good source control management

Ah source control, if there's a more essential tool which indiscriminately spans 
programming languages without favour, I'm yet to see it. It's an essential component 
of how so many of us work; the lifeblood of many development teams, if you like. So 
why do we often get it so wrong? Why are some of the really core, fundamentals of 
version control systems often so poorly understood?

I boil it down to 10 practices – or “commandments” if you like – which often break 
down or are not properly understand to begin with. These are all relevant to version 
control products of all types and programming languages of all flavours. I'll pick 
some examples from Subversion and .NET but they're broadly applicable to other 
technologies.

1. Stop right now if you're using VSS – just stop it!
   もしVSSを使っていたら今すぐ使うのを止める。特に書く止めろ!

説明略

2. If it's not in source control, it doesn't exist
   source control の中にないのなら、存在していないのと同じ

説明略

3. Commit early, commit often and don't spare the horses
   早めにコミット。こまめにコミット。

# don't spare the horses がよくわからん。
# Don't spare the horses - Idioms - by the Free Dictionary, Thesaurus and Encyclopedia.
# には Don't spare the horses.  (Australian informal)
#something that you say to someone in order to
#とかある

説明文略

4. Always inspect your changes before committing
   コミットする前に、常に自分の変更を検査すること

Committing code into source control is easy – too easy! (Makes you wonder why the 
previous point seems to be so hard.) Anyway, what you end up with is changes and files 
being committed with reckless abandon. “There's a change somewhere beneath my project 
root – quick – get it committed!”

説明文略
5. Remember the axe-murderer when writing commit messages
   コミットメッセージを書くときには axe-murderer を思い出せ

There's an old adage (source unknown), along the lines of “Write every commit message 
like the next person who reads it is an axe-wielding maniac who knows where you live”. 
If I was that maniac and I'm delving through reams of your code trying to track down a 
bug and all I can understand from your commit message is “updated some codes”, look 
out, I'm coming after you!

説明文略
6. You must commit your own changes – you can't delegate it
   自分のした変更は自分でコミットしろ。他人にまかせることはできない。

説明文略
7. Versioning your database isn't optional

説明文略
8. Compilation output does not belong in source control
   コンパイル時に生成されるものはsource controlの対象ではない

説明文略
9. Nobody else cares about your personal user settings
   あなたの個人的なユーザー設定などあなた以外の誰も気にしない

説明文略
10. Dependencies need a home too

説明文略
Summary
まとめ

None of these things are hard. Honestly, they're really very basic: commit early and 
often, know what you're committing and that it should actually be in VCS, explain your 
commits and make sure you do it yourself, don't forget the databases and don't forget 
the dependencies. But do please do forget VSS :)

以上のことで難しいものはひとつもありません。
正直なところ、どれもみな非常に基本的なものです。
早めにかつ頻繁にコミットを行い、自分のコミットしたものとそれがVCSでどのように
なるかを理解し、自分のコミットを説明して自分自身でコミットする。
データベースのことを忘れず、また、dependencies のことを忘れない。
ただし、VSSのことはどうか忘れ去ってください :)

Disclaimer

Opinions expressed here are my own and may not reflect those of my employer, my 
colleagues, my mates, my wife, the dog and so on and so forth. Unless I'm quoting 
someone, they're my own opinions and may not necessarily be cohesive nor entertaining 
but hey, at least they're original.

Copyright 2010, Troy Hunt

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License.

■_

■_

今週末もほとんどなにもできず

2011年05月21日

■_

25日発売なら今日あたりにはあるんじゃないかと思ったけどはずれ。

■_

大全ちゅー発売でスレッドの流速が急加速

かみちゅ!~かみさまでちゅうがくせい~ 97柱目

1 名無しさん@お腹いっぱい。 [sage] 2011/03/31(木) 22:26:27.54 ID:???0 Be:
    =======================重要=======================
    ・基本的にsage進行(メール欄に半角でsage)で。2chブラウザ推奨。
    ・荒らし、煽りは徹底的に放置。(コピペ荒らしは逐一削除依頼します)
    ・次スレは>970が立てること。立てられない時は代わりを指名。
    ・ニコニコ動画やYouTube、その他ダウンロード等での視聴についての話題は控えてください。
    ==================================================

    ■公式サイト
    http://www.aniplex.co.jp/kamichu/
    ■MXTV版公式サイト
    http://www.mxtv.co.jp/kamichu/
    ■NHKアニメワールド「かみちゅ!」
    http://www9.nhk.or.jp/anime/kamichu/

    ■平成17年度文化庁メディア芸術祭アニメーション部門優秀賞受賞(OP映像と舛成たんご尊顔が拝めます)
    ttp://plaza.bunka.go.jp/festival/2005/animation/000241/

    ■バンダイチャンネルによる有料配信(TV版全12話/第1話他無料プロモアリ)
    ttp://www.b-ch.com/ocn/ttl/index.php?ttl_c=573

    ■前スレ
    かみちゅ!~かみさまでちゅうがくせい~ 96柱目
    http://yuzuru.2ch.net/test/read.cgi/anime2/1298633848/

    過去ログ、関連スレ等は>>2-10あたりに。 

735 726 [sage] 2011/05/18(水) 21:51:03.89 ID:???0 Be:
    帰ってきた。そしてまだ読む。
    つーかこれゆりえ様信者なら買うべき本だわ。
    版権イラスト数点、キャラクター紹介、ストーリー紹介(DVDコメンタリーの抄録とホビージャパン連載時の
    倉田のコメント再録付き)、氷川竜介とアニメ様のコラム、尾道巡礼ガイド、グッズカタログ、
    キャラクター設定資料、三人娘&主要スタッフのインタビュー、アニメスタイルのインタビュー記事の再録、
    第1話の絵コンテ、ドラマCDの脚本(倉田の弁解付き…って、その媒体でも出したら買いますって、
    某アニメもアルバム初回版でやったんだし)と、てんこ盛り過ぎて全俺が泣いた。

    そういや、去年のロフトAでの模様載せるかもとか言ってたけど結局無かったなあ。
    もうあれから1年か。出るまでほんと待ったよなあ。最初は夏に出すって言ってたのにねw
    もう時効だろうから言うが、あのイベント、さすがに終電無くなりそうになったので、
    宇宙ショーのパート断念してとっとと中央線に乗ったら、同じ車両にまこまこと理科さんが
    いてマジでびびったwさすがにこっちは酔っ払いだったし声はかけられなかったけどさw

746 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 22:45:01.24 ID:???0 Be:
    大全ちゅーってもう発売されたの? 

747 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 22:48:56.08 ID:???0 Be:
    正式発売日は20日だよ 

748 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 22:54:58.35 ID:???P Be:
    >>731
    他の本と一緒に領収書貰って買えばおk
    コツは「あ~面倒くせーなー」みたいな顔で買うこと 

749 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 23:02:31.32 ID:???0 Be:
    いまさらなに恥ずかしがってんだよw

751 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 23:30:56.69 ID:???0 Be:
    もう出てるのか!
    店頭特典情報は結局無いのかな? 

752 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 23:33:13.28 ID:???0 Be:
    まだ信じないぞ 

753 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 23:42:15.13 ID:???0 Be:
    お、俺もまだ信じないぞ… 

754 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 23:49:01.30 ID:???0 Be:
    発売されたとか都市伝説 

755 名無しさん@お腹いっぱい。 [sage] 2011/05/18(水) 23:57:59.66 ID:???0 Be:
    >>726は、よくできたコラ 

757 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 04:01:33.28 ID:???0 Be:
    >>752-755
    気持ちはわかるwわかるぞww
    だがもういいんだ、いいんだよ・・・ 

758 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 10:26:45.76 ID:???0 Be:
    いーやアマゾンからの発送メールが来るまで信じないからな!! 

759 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 10:44:37.20 ID:???0 Be:
    >>758
    発送メールが来ても
    佐川なら、佐川ならきっとやってくれる 

760 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 11:22:41.91 ID:???O Be:
    集団幻覚乙 

761 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 11:55:05.17 ID:???O Be:
    最寄りのメイトが大全ちゅー!入荷しないとか・・・
    満足できねぇ 

762 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 13:28:07.50 ID:???0 Be:
    >>761
    だってそんなものは存在しないんだから入荷するはずも無い 

763 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 13:36:38.76 ID:???0 Be:
    さっき入荷しましたーって本屋から電話が来た
    取りに行くのは明日だが 

764 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 13:42:31.42 ID:???O Be:
    いいぜ…てめえらが大全ちゅーが発売されたと思ってるなら
    まずはそのふざけた幻想をぶち(ry 

765 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 13:47:05.95 ID:???0 Be:
    手元に来たとしてもそれが本当の大全ちゅーかどうか確かめるすべはない
    むしろ偽物の方が自然と言える 

766 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 14:02:03.49 ID:???0 Be:
    >>765
    つまり「かみちゅ!完全版大全ちゅー!」がでるということか 

767 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 14:07:09.82 ID:???P Be:
    今出回っている大全ちゅーはおそらく別の世界線より迷い込みし代物と考えるのが妥当 

768 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 14:33:09.79 ID:???0 Be:
    まさかとは思いますが、この「大全ちゅー!」はあなたの想像状の存在にすぎないのではないでしょうか。 

769 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 14:34:29.79 ID:???P Be:
    yurindo_akb:【アニメファンブック】遂に発売! TVアニメ「かみちゅ!」ファンブック
    「かみちゅ!大全ちゅ-!」! 待った待った待ちましたよ! 
    これを買ったみんなでさあ“か~み~ちゅ!” 棚番号F-1-4にございます。
    [http://twitter.com/yurindo_akb/status/71081864965795840]

770 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 14:51:08.81 ID:???P Be:
    >>769
    おい、そのページ存在しないって言われるぞ? 

771 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 15:06:28.61 ID:???0 Be:
    俺も開けない
    やっぱり発売は幻だったんだよ 

772 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 15:13:36.26 ID:???0 Be:
    騙されたでゲソ 

773 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 15:25:39.19 ID:???0 Be:
    アドレスの一番右をよく見るんだ
    とマジレスしてみる 

774 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 15:41:37.43 ID:???O Be:
    度重なる延期に誰もが疑心暗鬼だなw
    どうせまた延期だろ?わかってるってw 

775 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 16:02:23.67 ID:???P Be:
    かみちゅ! 大全ちゅー! 発売 「待ったよぅ!待ちましたよぅ!」
    http://blog.livedoor.jp/geek/archives/51260778.html

    >メロンブックス秋葉原店では18日入荷分ははその日の夜のうちに完売したみたい。
    Oh... 

798 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 21:32:35.85 ID:???0 Be:
    大全ちゅーが出たと聞いて
    う、うそだろ? 

799 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 21:39:15.21 ID:???0 Be:
    書店で予約したのに連絡こない・・・
    やっぱり盛大なドッキリなの? 

800 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 21:41:28.24 ID:???0 Be:
    嘘だッ!!!
    みんなで俺をだまして笑ってるんだ!そうにちがいない! 

802 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 22:07:29.40 ID:???0 Be:
    リアル書店で買ったけど
    つい裏返しでレジのお姉さんに渡してしまった
    ゆりえ様お許しください

    ていうかもっと大判だと思ってたのに意外に小さかったな 

810 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 22:19:42.25 ID:???0 Be:
    (ボソッ)かみちゅ!関連のアイテムが出るのはこれで最後か…。 

811 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 22:20:25.07 ID:???0 Be:
    大全ちゅーが出たのが本当らしいと聞いて、さっき急いでポチって来た。 

812 名無しさん@お腹いっぱい。 [sage] 2011/05/19(木) 22:34:15.23 ID:???0 Be:
    とらに行ったら置いてあった
    でもきっと錯覚だと思う 

820 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 00:27:17.15 ID:???0 Be:
    >>765
    ナポリタンのコピペ改変ができそうだw 

821 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 00:34:15.65 ID:???0 Be:
    まだメール来ない・・・ってか、先月来たメールではお届け予定日が22日-24日となってる。
    一年近く待ったんだ、あと3日4日くらいなんともないさ、ははははぁ・・・ 

837 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 09:31:51.43 ID:???0 Be:
    尼から大全ちゅー届いた!
    どうやらもう延期は無いと考えて間違いなさそうだ 

845 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 11:11:16.72 ID:???0 Be:
    だ、大全ちゅー届いた…中身もしっかり書いてあった
    これはもう信じていいみたいだな 

846 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 11:14:00.65 ID:???0 Be:
    半分ぐらい読んだがまだ信用できない
    とりあえず最後まで読みます 

851 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 12:32:34.08 ID:???O Be:
    新宿の紀伊國屋行ったら売ってた…
    まさか売ってるとは思ってなかったから手持ちがなくて買えなかった…

    俺のバカ! 

852 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 12:36:38.62 ID:???0 Be:
    紀伊國屋舐めんな
    無い本は無い書店だぞ 

866 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 18:42:48.20 ID:???0 Be:
    書店から電話きて早速買って来ました。
    かなり前に予約したのに忘れられてなくてよかった。

    かみちゅ見てたころは中学生だったのに、今じゃ浪人生・・・・ 

868 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 19:24:22.88 ID:???P Be:
    >>866
    おい! このアニメはR35指定だぞ 

875 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 21:59:29.73 ID:???0 Be:
    大全ちゅ~発売記念とはっさく大福と廣瀬の無事を祈るために、明日尾道行ってくる!
    天気ちょい微妙だけど、ゆりえ様のご加護がありますように。 

876 名無しさん@お腹いっぱい。 [sage] 2011/05/20(金) 22:32:37.04 ID:???P Be:
    はっさくと聞くと、未だにはっさく~♪はっさく~♪って聴こえてくる
    あれはかみちゅ!のコーラ饅頭のCMとタメを張るな 

891 名無しさん@お腹いっぱい。 [sage] 2011/05/21(土) 07:07:40.55 ID:???O Be:
    「大全ちゅー」の無事発売と俺の仕事に目処ついて帰宅、どっちが先かの勝負は「大全ちゅー」に軍配…
    早く手にとって見たいよ、期待していいのね!? 

922 名無しさん@お腹いっぱい。 [sage] 2011/05/21(土) 22:10:39.81 ID:???0 Be:
    ブルーレイを見直したくなって今見てる
    そんな気分にさせてもらえます>大全ちゅー!

    あと尾道行ってみたくなる 

スレッドが立てられたのが 3月31日で、買ったという報告があがったのが5月18日。 こまかいこたあいいんだよでざっと計算すると

>ruby -rdate -e "puts 734/(Date.parse('2011-5-18') - Date.parse('2011-3-31')).to_f"
=>15.291666666666666

三日間ちょっとでえらく伸びたなあw

かみちゅ!~かみさまでちゅうがくせい~ 97柱目

411 名無しさん@お腹いっぱい。 [sage] 2011/04/25(月) 22:53:53.91 ID:???0 Be:
    http://twitter.com/kamichu_mook/status/62512155211210753
    きたな 

412 名無しさん@お腹いっぱい。 [sage] 2011/04/25(月) 22:55:05.10 ID:???i Be:
    大全ちゅー公式Twitterより

    kamichu_mook
    ごぶさったー。本日『かみちゅ! 大全ちゅー!』校了いたしました! 
    大変長らくお待たせしてすいません。今度こそホントに5月20日発売です! 
    舛成監督ふくめた関係者のみなさまご協力ありがとうございました。
    発売までゆるゆるつぶやいていきたいと思いますのでよろしくお願いいたします! 

413 名無しさん@お腹いっぱい。 [sage] 2011/04/25(月) 23:01:19.49 ID:???0 Be:
    そういえば公式twitterなんてあったな
    すっかり忘れてたわ 


こんなのあったのか。でもまあ発売したからお役ごめんなんだろうか。

なんだこれw Twitter / @kamichu mook_staff: 尾道はいつか北道正幸。 ...

■_

■_

眠い


一つ前へ 2011年5月(中旬)
一つ後へ 2011年6月(上旬)

ホームへ


リンクはご自由にどうぞ

メールの宛先はこちらkbk AT kt DOT rim DOT or DOT jp