ときどきの雑記帖 i戦士篇

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

一つ前へ 2009年2月(上旬)
一つ後へ 2009年2月(下旬)

ホームへ

2009年02月20日

■_

・おわらない
The History of Python 今日も終えられなかった。

・なんかもーgdgdっすよー

■_ Zed

ついったやってるらしい。 Twitter / zedshaw

んで、blogをばっさり削除。



Projects
Zed Shaw

Enjoy the show.
A New Blog

I enjoyed writing in my blog all last year, but it got old being the asshole all the 
time. This year, I’m going to write about all the other things in my life. It’ll be 
nicer, but not too nice. I do still enjoy poking fun at the people at the top.

The Atom feed is still there, and I’ll be changing it up to be easier to work with, 
but for now it’ll be dead until I get that working.

If you want to find out what I’m doing, you can track me on twitter which I update 
fairly regularly. I’ve also got a bit of software which updates the site from my 
twitter messages periodically.

Cleaning House

All of my old blog posts are gone. My SEO friends are screaming right now, but I want 
to only bring over the good stuff. Incidentally, if there is a blog post you find 
excellent then let me know and I’ll convert it into an essay.

■_ そのキモチ、わかるような気がするw

Share your haskell experience : haskell
Share your haskell experience (self.haskell)

The language: Beautiful. All the advantages of statical typing without the ugly syntax 
that is used by C/Java/etc. Now that doesn't mean it's perfect (If it were up to me 
I'd add first-class records and reorganize the type classes in the Prelude, e.g. 
subdivide Num) but it's a joy to code in.

Effect on other languages: Because Haskell doesn't allow unpure code like ML it forces 
you to think in a functional style. If you have so far only worked with imperative 
languages you'll learn a lot. The unfortunate side effect is that you'll start to 
notice the annoying behavior in those other languages. NullPointerExceptions? No 
pattern matching? No referential transparency? Get it away!

The Haskell platform: Haskell greatest weakness and the reason I don't use if for all 
my projects. A lot of packages cannot be fully installed with cabal install, 
especially on Windows (Some examples: cabal-install, lambdabot, yi, gtk2hs (the binary 
installer always complains my ghc install is invalid)). With any luck this will be 
solved this year by the Haskell Platform.

Overall: A lovely language that I would recommend learning to anyone.
I tried to learn Haskell and now I spend all my time reading Wikipedia articles on 
Category Theory!

Functors and morphisms and monoids! Oh my!

■_

関数型プログラミング言語Haskell Part10 
203 デフォルトの名無しさん [sage] Date:2009/02/19(木) 11:34:27  ID: Be:
    どうでも良いけど最近arrowの話題めっきり聞かなくなったな。 

204 デフォルトの名無しさん [sage] Date:2009/02/19(木) 11:40:21  ID: Be:
    一時はすべてのhaskellライブラリがarrowで書き換えられるんじゃないかって勢いだったのに、
    所詮は一過性の流行でしかなかったということか。 

205 デフォルトの名無しさん [sage] Date:2009/02/19(木) 12:25:55  ID: Be:
    arrowへの書き換え作業が、なぜメインストリームに乗ると考えるかが不思議。 

206 デフォルトの名無しさん [sage] Date:2009/02/19(木) 16:24:46  ID: Be:
    まぁ、実際arrowに書き換えないと乗り遅れるとみんなが思っていた時期もあった。 

207 デフォルトの名無しさん [sage] Date:2009/02/19(木) 17:12:55  ID: Be:
    arrowが分かってない人だけじゃね 

208 デフォルトの名無しさん [sage] Date:2009/02/19(木) 17:44:54  ID: Be:
    うむ。 おじいちゃんもがんばってるんだから みながんばれ
    ttp://www.cmas60.com/index.php 

209 デフォルトの名無しさん [sage] Date:2009/02/19(木) 22:20:57  ID: Be:
    おじいちゃん、F#にのりかえたようですが 

211 デフォルトの名無しさん [sage] Date:2009/02/19(木) 23:08:58  ID: Be:
    そのおじいちゃんすごいな、しかもForthちょうど今日完成したんだな。おめでたい 

【Perl,PHP】LLバトルロワイヤル4【Ruby,Python】
209 デフォルトの名無しさん [sage] Date:2009/02/19(木) 21:50:11  ID: Be:
    Guile は普及しなかったなあ。GIMP の Script-Fu ぐらいか?
    Guile Emacs プロジェクトがもう一度、生き返ってくれないかなあ。


    >>208
    Lua は面白いよな。Schemeの影響を強く受けているそうだ。すごくミニマルで
    美しい言語だと思う。

    [Think IT] 第2回:言語開発者が目標にするパフォーマンス「Lua」 (1/3)
    http://www.thinkit.co.jp/free/article/0711/4/2/
    > Luaの思想は言語のコアとしては選び抜かれた数少ない概念のみを提供し、そ
    > こから複雑な概念を「組み立てる」ことにある。Luaはオブジェクト指向言語
    > ではないが、テーブルとファーストクラス関数、そして少々のsyntactic
    > sugarによってオブジェクト指向の仕組みを非常に巧みに組み立てることがで
    > きる。

    しかも超高速。

    Lua LuaJIT benchmarks | Ubuntu : Intel・ Q6600・ quad-core Computer Language Benchmarks Game
    http://shootout.alioth.debian.org/u32q/benchmark.php?test=all??=luajit

210 デフォルトの名無しさん [sage] Date:2009/02/19(木) 23:01:23  ID: Be:
    guile emacsって何で死んだの? 

211 デフォルトの名無しさん [sage] Date:2009/02/20(金) 01:04:07  ID: Be:
    実際問題言語文法なんかよりもライブラリがどれくらい充実してるのかの方がはるかに大きい問題。
    XPath簡単に使えるの?Cookieパースできる?スレッドライブラリは?ZipとかSSLとかどうだっけ?
    とかそういうとこが結果的に言語の普及率に大きく影響してる。 

212 デフォルトの名無しさん [sage] Date:2009/02/20(金) 10:56:58  ID: Be:
    >>210
    > guile emacsって何で死んだの?

    実は知らない。Emacsを Scheme と Emacs Lisp の両方で拡張可能にするのが困
    難だったと、どこかで聞いたような気がするけれど、うろ覚え。

    うろ覚えの話が前提だから、真に受けずに聞いてほしいんだけど、たとえ困難
    でも SchemeとEmacs Lispを両方動かせるようにしなければ、Guile Emacsの存
    在意義はなかったと思う。

    Emacs Lisp以外を拡張言語にしたEmacsクローンはすでにいろいろある。
    Common Lisp の Hemlock や xyzzy、Scheme の Edwin、など。だけどどれも普
    及しなかった。xyzzyもずいぶん寂れた。

    言語自体としては、Emacs Lisp より Common Lisp や Scheme がすぐれている
    のは大方の賛同が得られるだろうけど、既存の資産やコミュニティを引き継げ
    るかどうかが、言語仕様よりはるかに重要だったんだと思う。

    あれ、なんか >>211 ともリンクする話になったな。 

213 デフォルトの名無しさん [sage] Date:2009/02/20(金) 12:56:02  ID: Be:
    『言語仕様で勝負したが、結果的には血液型程度の差しかなかった』

    疑似科学の片鱗を味わったぜ… 

214 デフォルトの名無しさん [sage] Date:2009/02/20(金) 13:37:57  ID: Be:
    性格の差が小さかったんじゃなくて経験の差が大きかったんだよ 

C++相談室 part66 
50 デフォルトの名無しさん [sage] Date:2009/02/19(木) 13:05:44  ID: Be:
    標準C++ライブラリの範囲で
    std::stringとstd::wstringの変換って出来ません?
    std::ostringstreamとかを使うのも可で、とにかく標準C++の範囲で。

51 デフォルトの名無しさん [sage] Date:2009/02/19(木) 13:22:17  ID: Be:
    >>50
    std::codecvtを使うらしいが詳細はシラネ 

52 デフォルトの名無しさん [sage] Date:2009/02/19(木) 13:42:40  ID: Be:
    >>50
    http://hw001.gate01.com/eggplant/tcf/cpp/strcnv.hpp 

53 50 [sage] Date:2009/02/19(木) 13:58:44  ID: Be:
    ありがとう。
    今から見てみるわ。

54 デフォルトの名無しさん [sage] Date:2009/02/19(木) 23:52:07  ID: Be:
    コードの変換っつて難しいね
    標準だけとコンパイラによって微妙に違ったり
    OSに渡すのに適してなかったり。

55 デフォルトの名無しさん [sage] Date:2009/02/20(金) 00:12:31  ID: Be:
    std::mbstowcs と std::wcstombs じゃだめ? 

62 50 [sage] Date:2009/02/20(金) 06:48:28  ID: Be:
    >>55
    std::wcstombsとかでも出来るのか。
    なんかこういうのホント分からん。こんな関数みたことねぇ。

63 デフォルトの名無しさん [sage] Date:2009/02/20(金) 17:28:19  ID: Be:
    >>62
    >>52のコードを書いた張本人だけど、ぶっちゃけ俺もロケールの動作とか関数とかはよく判っていない。
    そもそもwchar_t関係は具体的な定義が仕様になかったり、VCとgccでwchar_tの大きさが違ったり、
    さらにVCの各Ver.ごとに致命的なバグとか仕様の違いとかが結構あったりして、
    正直C++標準のロケールは使い辛いと言わざるを得ない。

    あまり本格的でない用途に使うならwchar_t/codecvtでもいいと思うけど、
    ちゃんとしたいならやっぱりICUとかの外部ライブラリを使って、
    さらにプリプロセッサでwin32と*nixを分岐させるとかの面倒なことをしなきゃだめだと思う。

    // >>52の引数2つの関数は、たぶん予めstd::locale::global(std::locale("japanese"));しないといけなかったはず。 

64 50(=62) [sage] Date:2009/02/20(金) 20:25:21  ID: Be:
    >>63
    そうなんですか。wchat_tはこのままだとC++の黒歴史状態に?
    そして、まさかあのコードを書いた方がここにいらっしゃるとは、2chって(てかネットって)わからない。

65 デフォルトの名無しさん [sage] Date:2009/02/20(金) 23:02:04  ID: Be:
    あのぅ、俺は
    hoge(int &arg)
    を参照渡しだと思っているんだが、

    hoge(int *arg)
    int i;
    hoge(&i)
    これも参照渡しって言うの?

    誰かこのモヤモヤを取ってくだしあうあ 

66 デフォルトの名無しさん [] Date:2009/02/20(金) 23:03:04  ID: Be:
    >>65
    それはアドレス渡し 

67 デフォルトの名無しさん [sage] Date:2009/02/20(金) 23:06:55  ID: Be:
    厳密にはC++に「参照渡し」は存在しない
    hoge(int &arg)は参照の値渡しだし
    hoge(int *arg)はポインタの値渡しだし
    渡された値を参照にも使えるというだけ 

68 デフォルトの名無しさん [sage] Date:2009/02/20(金) 23:19:04  ID: Be:
    >>65
    まさかとは思うけど、参照とアドレスを取得する時に使う&の区別は付いているよね?
    int a=&b;
    と
    int &x=y;
    とでは意味が全く違うことは知ってるよね? 

69 68 [sage] Date:2009/02/20(金) 23:20:08  ID: Be:
    あ。
    int a=&b;
    は
    int* p=&b;
    の間違いっす! 

70 デフォルトの名無しさん [] Date:2009/02/20(金) 23:34:40  ID: Be:
    >>67
    じゃあ、厳密な「参照渡し」ってなんだよ。

    hoge(int &arg)が正真正銘の参照渡しじゃなければ、何が違うというのだ? 

71 デフォルトの名無しさん [sage] Date:2009/02/20(金) 23:39:46  ID: Be:
    あぁ、勘違いしてたわ
    int a = &b;
    これも(意味は異なるが)参照だと思ってた

    ということは参照渡しって
    hoge(int &arg)
    だけなんだね

    sanx

72 デフォルトの名無しさん [sage] Date:2009/02/20(金) 23:53:24  ID: Be:
    >>67
    参照の値渡しwww
    hoge(int &arg) は正真正銘参照渡しだ。
    参照は再代入できないって点をよーく考えてみるんだな。 

73 デフォルトの名無しさん [sage] Date:2009/02/20(金) 23:59:52  ID: Be:
    >>67
    これってJavaの話だろう 

参照の値渡しはなかろうよ…

D言語 Part21 
63 デフォルトの名無しさん [sage] Date:2009/02/18(水) 04:01:12  ID: Be:
    earthquake changes of std.regexp to come

    In the upcoming releases of D 2.0 there will be rather dramatic breaking
    changes of phobos. I just wanted to ask whether y'all could stomach yet
    another rewritten API or you'd rather use std.regexp as it is for the
    time being.


    Andrei 

64 デフォルトの名無しさん [sage] Date:2009/02/18(水) 05:19:44  ID: Be:
    earthquake changes

    ガクテカ 

65 デフォルトの名無しさん [sage] Date:2009/02/18(水) 07:40:33  ID: Be:
    英語わかんないなりに翻訳するとぶっ壊すよ、ってこと? 

66 デフォルトの名無しさん [sage] Date:2009/02/18(水) 07:58:24  ID: Be:
    アンドレイ詩人過ぎる 

67 デフォルトの名無しさん [sage] Date:2009/02/18(水) 09:44:10  ID: Be:
    元スレッドからざっくり訳すと

    今のstd.regexpは設計、命名規則、実装、全部滅茶苦茶なんだよwww
    streamも撮れないとかutf-8しか認識しないとかカスすぎるwww
    俺が根っこから全部書き換えてやるから、トラブりそうなやつは今のうちに挙手しとけwww

    という感じ 

68 デフォルトの名無しさん [sage] Date:2009/02/18(水) 09:56:47  ID: Be:
    で、onigu組み込んだらワロス 

70 デフォルトの名無しさん [sage] Date:2009/02/18(水) 11:58:52  ID: Be:
    ちょwstd.rangeどうなったw 

71 デフォルトの名無しさん [sage] Date:2009/02/18(水) 19:43:24  ID: Be:
    >>68
    oniguruma をDで焼き直して実装ならそれはそれでうれしいかも試練。
    下手に独自仕様でこられると逆に厄介だ。

    正規表現は方言多すぎなんだよ…

76 デフォルトの名無しさん [sage] Date:2009/02/18(水) 22:17:40  ID: Be:
    正規表現はECMAScriptの規格になると思われ

    phobosはad hocくさい実装と、練ってレビューを受けた実装が入り混じっているからなあ。
    Tangoは網羅的で労力は頑張ったなという感じだが品質が保証済みかというとそうでもない。

    Java、.NET、Pythonにあるような無駄にでかい、標準扱いのライブラリがちょっと欲しかったり。
    Deimosという名前で。 

2009年02月19日

■_

・The History of Python
新作が出たのはいいんですが、分量がちょっと多めなのと 文章が訳しづらい(文の構造がつかみづらい~)ので悪戦苦闘しています。

若人視点: 衝動的に始めるFLOSSプロジェクト
http://el.jibun.atmarkit.co.jp/haya/2008/12/floss1-fb6c.html
http://el.jibun.atmarkit.co.jp/haya/2009/01/floss2sfjp-c12c.html
http://el.jibun.atmarkit.co.jp/haya/2009/02/floss3-3559.html
http://el.jibun.atmarkit.co.jp/haya/2009/02/floss4-809f.html
http://el.jibun.atmarkit.co.jp/haya/2009/02/floss5-8d1d.html

■_ Parrot 0.9.1

The Final Countdown [DVD] [Import]

1.0 になる直前のリリース。 一応手元の環境でも問題なくビルドができたんですが、 parrot.exe はできるんだけど、perl6.exe とか m4.exe とかはどうやって作るのやら。 別途配布されているバイナリ版も、今回からコアと、追加の言語にわけているみたいですね。

Parrot 0.9.1 "Final Countdown" Released! | Parrot VM
Parrot 0.9.1 "Final Countdown" Released!
Submitted by kjs on Tue, 02/17/2009 - 23:45.

o/~ We're leaving together,
       but still its farewell o/~

o/~ And maybe we'll come back,
       To earth, who can tell? o/~

o/~ I guess there is no one to blame
       We're leaving ground
           Will things ever be the same again? o/~

o/~ It's the Final Countdown...
       The Final Countdown  o/~

--Europe, "The Final Countdown"

On behalf of the Parrot team, I'm proud to announce Parrot 0.9.1 "Final 
Countdown." Parrot is a virtual machine aimed at running all dynamic languages.

Parrot 0.9.1 is available via CPAN (soon), or follow the download instructions. For 
those who would like to develop on Parrot, or help develop Parrot itself, we recommend 
using Subversion on our source code repository to get the latest and best Parrot code.

Parrot 0.9.1 News:

- Implementation (実装に関するもの) 
  + Support for portable 'Inf', 'NaN' and -0.0
  + pbc_disassemble prints constants in constants table
  + New experimental BigNum implementation
  + Pair is now a dynamic loadable PMC
  + Various function name sanification
  + New implementation of Strings component
  + Replace various PMC value union access code by VTABLE method invocations
  + Replace various PMC value unions by ATTRibutes
  + Removed SArray PMC. Use FixedPMCArray instead.
- Documentation (ドキュメントに関するもの)
  + Book
    - updates to Chapter 2 (getting started)
    - updates to Chapter 3 (PIR basics)
    - updates to Chapter 4 (PIR subroutines)
    - updates to Chapter 10 (HLLs)
    - updates to Chapter 12 (opcodes)
  + Function documentation
  + Pod documentation style modernized; no longer Perl 5 style.
  + PMC has an additional acronym: Poly Morphic Container
  + The DOD (Dead Object Detection) acronym is no longer used;
    use 'GC' to refer to the Garbage Collector component.
- Compilers (コンパイラーに関するもの)
  + IMCC
    - :named flag can now take string registers as argument
    - A single '=cut' directive is now ignored (without initial Pod directive)
    - :vtable subs now have proper access to 'self' pseudo variable
- Languages (言語について)
  + add new 'Pod' documentation parser
  + Pipp (PHP implementation):
    - Pipp is now at http://github.com/bschmalhofer/pipp
    - support for 'print', 'dirname', 'implode', 'str_replace',
    - various grammar fixes
  + ECMAScript
    + add 'quit', 'readline' builtins
    + fix 'Boolean' type and 'print' builtin
  + Lua
    - left the nest and is now at http://github.com/fperrad/lua/
  + Rakudo
    - left the nest and is now at http://github.com/rakudo/rakudo/
    - build instructions can be found at http://tinyurl.com/rakudo
  + lazy-k
    - left the nest and is now at http://github.com/bschmalhofer/lazy-k.git
  + unlambda
    - left the nest and is now at http://github.com/bschmalhofer/unlambda/
  + WMLScript
    - left the nest and is now at http://github.com/fperrad/wmlscript.git
  + removed Zcode implementation
- Tools
  + pmc2C
    - ATTRs are now inherited automatically in subclassing PMCs
- Deprecations
  + Parrot_readbc, Parrot_loadbc renamed to Parrot_pbc_read, Parrot_pbc_load.
  + .HLL_map directive in favour of 'hll_map' method on Parrot interpreter
  + Data::Escape library
- Tools
  + pbc_disassemble options added
  + pbc_dump renamed from pdump
- Miscellaneous
  + Parrot is now Copyright Parrot Foundation
  + Parrot's SVN repository is now hosted at https://svn.parrot.org
  + Various code cleanups, consting, 64-bit incompatibilities and other bug fixes

Thanks to all our contributors for making this possible, and our sponsors for 
supporting this project. Our next release is 17 March 2009.

Enjoy!

Parrot foundation すか。

■_ The History of Python: Adding Support for User-defined Classes

おわんねー


The History of Python: Adding Support for User-defined Classes
Adding Support for User-defined Classes (ユーザー定義クラスのサポートの追加)

Believe it or not, classes were added late during Python's first year of development 
at CWI, though well before the first public release. However, to understand how 
classes were added, it first helps to know a little bit about how Python is 
implemented.

信じようと信じまいと、Python におけるクラスというのものは、最初のパブリックリリース以
前からあったものではあるのですがCWI での late during Python's first year of development
で追加されたものなのです。とはいえクラスがどのように追加されたかを知るためにはPython 
でクラスがどのように実装されているかを最初に多少なりとも知っておくことは助けになるでし
ょう。


Python is implemented in C as a classic stack-based byte code interpreter or “virtual 
machine” along with a collection of primitive types also implemented in C. The 
underlying architecture uses “objects” throughout, but since C has no direct support 
for objects, they are implemented using structures and function pointers. The Python 
virtual machine defines several dozen standard operations that every object type may 
or must implement (for example, “get attribute”, “add” and “call”). An object 
type is then represented by a statically allocated structure containing a series of 
function pointers, one for each standard operation. These function pointers are 
typically initialized with references to static functions. However, some operations 
are optional, and the object type may leave the function pointer NULL if it chooses 
not to implement that operation. In this case, the virtual machine either generates a 
run-time error or, in some cases, provides a default implementation of the operation. 
The type structure also contains various data fields, one of which is a reference to a 
list of additional methods that are unique to this type, represented as an array of 
structures containing a string (the method name) and a function pointer (its 
implementation) each. Python's unique approach to introspection comes from its 
ability to make the type structure itself available at run-time as an object like all 
others.

Python は伝統的なスタックベースのバイトコードインタープリターもしくは  “virtual 
machine”としてCで実装されたもので、そしてやはりCで実装されたプリミティブ型のコレクシ
ョンが一緒にありました。underlying architecture が “objects” を使っていましたがCは直
接にはオブジェクトをサポートしていなかったので、構造体と関数ポインターを用いてオブジェ
クトが実装されていました。Python仮想機械はオブジェクトの型ごとに実装しても良かったり逆
にや実装しておかなければならないような標準的な操作(たとえば“get attribute”, “add” 
and “call”)を several dozen 定義していました。そしてオブジェクト型は静的に割り当て
られた一つ一つがそれぞれなんらかの標準操作に対応するような関数ポインターの並びを保持し
ている構造体によって表現されています。オブジェクト型はこれらの関数ポインターは典型的に
は static 関数に対する参照で初期化されていました。しかし一部の操作はoptionalであり、か
つそのオブジェクト型は操作の実装を行わない場合には関数ポインターの値をNULLのままにして
おくということもできました。この場合仮想機械は実行時エラーを生成するかあるいは一部の場
合はその操作のデフォルト実装を提供するかします。型構造体は、様々なデータフィールドや型
に固有な additional メソッドのリストへの参照のいずれかひとつを抱えていて、(メソッド名
をあらわす)文字列と(メソッドを実装している)関数ポインターとをそれごれが保持している構
造体の配列として表現しています。Pythonの introspection に対するunique なアプローチは、
型構造体それ自身を実行時に他のすべてのオブジェクトと同様に利用可能にする能力からきたも
のです。


An important aspect of this implementation is that it is completely C-centric. In fact, 
all of the standard operations and methods are implemented by C functions. Originally 
the byte code interpreter only supported calling pure Python functions and functions 
or methods implemented in C. I believe my colleague Siebren van der Zee was the first 
to suggest that Python should allow class definitions similar to those in C++ so that 
objects could also be implemented in Python.

この実装に対する An important aspect はそれが完全に C-centric だったということです。
事実、標準操作のすべてと標準メソッドのすべて
(all of the standard operations and methods)は
Cで書かれた関数によって実装されていました。
当初のバイトコードインタープリターは
pure Python 関数とCで実装されていた関数やメソッドの呼び出しだけをサポートしていました。
I believe my colleague Siebren van der Zee was the first to suggest
that Python should allow class definitions similar to those in C++
so that objects could also be implemented in Python.
わたしは my colleague である Siebren van der Zee が最初に
PythonはC++で書かれたクラス定義も許容すべきであるという提案を
したと記憶しています。
これによりPythonでオブジェクトも実装できるようになったのです。

To implement user-defined objects, I settled on the simplest possible design; a scheme 
where objects were represented by a new kind of built-in object that stored a class 
reference pointing to a "class object" shared by all instances of the same 
class, and a dictionary, dubbed the "instance dictionary", that contained 
the instance variables.

ユーザー定義オブジェクトを実装するために、わたしの判断は可能なものの中で最も単純な設計
に落ち着いたのです。それはオブジェクトが新しい種類の組込みオブジェクトによって表現され
る同じクラスのすべてのインスタンス変数によって共有される“クラスオブジェクト”であるよ
うな schemeです。

In this implementation, the instance dictionary would contain the instance variables 
of each individual object whereas the class object would contain stuff shared between 
all instances of the same class--in particular, methods. In implementing class objects, 
I again chose the simplest possible design; the set of methods of a class were stored 
in a dictionary whose keys are the method names. This, I dubbed the class dictionary. 
To support inheritance, class objects would additionally store a reference to the 
class objects corresponding to the base classes. At the time, I was fairly naïve about 
classes, but I knew about multiple inheritance, which had recently been added to C++. 
I decided that as long as I was going to support inheritance, I might as well support 
a simple-minded version of multiple inheritance. Thus, every class object could have 
one or more base classes.

このような実装においては、インスタンス辞書は同じクラスに属するすべてのインスタンスがメ
ソッドのように共有する stuff を保持するクラスオブジェクトであり個々に独立したオブジェ
クトであるインスタンス変数を保持することになります。クラスオブジェクトの実装でもわたし
は simplest possible design を選択しました。あるクラスのメソッドの集合はメソッド名をキ
ーとして辞書に格納されていたのです。この、わたしがクラス辞書と名づけた継承をサポートす
るためのクラスオブジェクトはベースクラスに対応するクラスオブジェクトへの参照を追加で格
納することになりました。このときわたしはクラスについてとても naive だったのですがその
頃 C++に追加された機能である多重継承については知っていました。わたしは継承をサポートし
ようとしていたときにsimple-minded version の 多重継承もサポートしようと考えていたので、
すべてのクラスオブジェクトは一つ以上のクラスを持つことが可能になっていたのです。

In this implementation, the underlying mechanics of working with objects are actually 
very simple. Whenever changes are made to instance or class variables, those changes 
are simply reflected in the underlying dictionary object. For example, setting an 
instance variable on an instance updates its local instance dictionary. Likewise, when 
looking up the value of a instance variable of an object, one merely checks its 
instance dictionary for the existence of that variable. If the variable is not found 
there, things become a little more interesting. In that case, lookups are performed in 
the class dictionary and then in the class dictionaries of each of the base classes.

この実装ではオブジェクトと共に動作する underlying mechanics は非常に単純なものでした。
インスタンス変数やクラス変数に変更が加えられるときはいつでもその変更が underlying 
dictionary object に反映されました。たとえばあるインスタンスにインスタンス変数をセット
するとそれに対応するローカルインスタンス辞書が更新されました。同様に、あるオブジェクト
のインスタンス変数の値を検索するときにはその変数の存在に対してインスタンス辞書を一つだ
けチェックすればたいていの場合は済むのです。対象となっている変数がそこで見つけられなけ
れば
things become a little more interesting.
#ものごとはちょっとだけ面白くなります?
このケースではルックアップはクラス辞書内で行われてから、ベースクラスごとのクラス辞書それぞ
れに対して行われます。


The process of looking up attributes in the class object and base classes is most 
commonly associated with locating methods. As previously mentioned, methods are stored 
in the dictionary of a class object which is shared by all instances of the same class. 
Thus, when a method is requested, you naturally won't find it in the instance 
dictionary of each individual object. Instead, you have to look it up in the class 
dictionary, and then ask each of the base classes in turn, stopping when a hit is 
found. Each of the base classes then implements the same algorithm recursively. This 
is commonly referred to as the depth-first, left-to-right rule, and has been the 
default method resolution order (MRO) used in most versions of Python. More modern 
releases have adapted a more sophisticated MRO, but that will be discussed in a later 
blog.

クラスオブジェクトやベースクラスにある属性の検索の手順は
most commonly associated with locating methods です。
すでに述べているように、メソッドはクラスオブジェクトの辞書に格納されています
( which is shared by all instances of the same class.)。
したがって、あるメソッドがリクエストされたときに個々の独立したオブジェクトが持っている
インスタンス辞書からそれを探そうとしても見つかりません。そうではなく、クラス辞書から検
索しなければならず、必要があればそのベースクラスに対する問い合わせをメソッドが見つかる
まで行なわなければなりません。ベースクラスのそれぞれはまた同じアルゴリズムを再帰的に実
装しています。このようなやり方は通常、depth-first, left-to-right rule と呼ばれるもので、
Python の大部分のバージョンで使われているデフォルトの解決アルゴリズム(method 
resolution order → MRO) となっていました。もっと最近になってのリリースではより 
sophisticated された MROが使われていますがそれはこのblogのもっと後の回で論じることにし
ます。

In implementing classes, one of my goals was to keep things simple. Thus, Python 
performs no advanced error checking or conformance checking when locating methods. For 
example, if a class overrides a method defined in a base class, no checks are 
performed to make sure that the redefined method has the same number of arguments or 
that it can be called in the same way as the original base-class method. The above 
method resolution algorithm merely returns the first method found and calls it with 
whatever arguments the user has supplied.

クラスの実装におけるわたしの目標の一つが単純さを保つ(keep things simple)ということでし
た。したがって、Python は高度なエラーチェックもしませんしlocating methods のときに 
comformance チェックも行いません。たとえば、あるクラスがそのベースクラスでの定義をオー
バーライドしても再定義されたメソッドがオーバーライド前のものと同じ数の引数を取るのかだ
とか同じ方法で呼び出すことができるかどうかといったことのチェックは実行されません。先の
メソッド検索アルゴリズムはただ単に最初に見つかったメソッドを返しそれをユーザーが提供し
た引数をわたして呼び出します。

A number of other features also fall out of this design. For instance, even though the 
class dictionary was initially envisioned as a place to put methods, there was no 
inherent reason why other kinds of objects couldn't be placed there as well. Thus, if 
objects such as integers or strings are stored in the class dictionary, they become 
what are known as class variables- - variables shared by all instances of a given class 
instead of being stored inside each instance.

その他の数多くの機能はこの設計に fall out しました。たとえばクラス辞書でさえも当初はメ
ソッドを置く場所として envision されたものであり他の種類のオブジェクトを同様に置くとこ
とができないという(inheretした)理由はありません。したがって、整数や文字列のようなオブ
ジェクトがクラス辞書に格納されると、それらはあるクラスに属しているすべてのインスタンス
で共有される変数であるクラス変数として知られるものになりました。

Although the implementation of classes is simple, it also provides a surprisingly 
degree of flexibility. For instance, the implementation not only makes classes
“first-class objects”, which are easily introspected at run time, it also makes it 
possible to modify a class dynamically. For example, methods can be added or modified 
by simplifying updating the class dictionary after a class object has already been 
created! The dynamic nature of Python means that these changes have an immediate 
effect on all instances of that class or of any of its subclasses. Likewise, 
individual objects can be modified dynamically by adding, modifying, and deleting 
instance variables (a feature that I later learned made Python's implementation of 
objects more permissive than that found in Smalltalk which restricts the set of 
attributes to those specified at the time of object creation).


クラスの実装が単純であったにも関わらず
it also provides a surprisingly degree of flexibility.
たとえばこの実装は実行時に簡単に introspect できる
クラスを“first-class objects” にするだけでなく
クラスを動的に変更することも可能としたのです。
クラスオブジェクトが生成された後にクラス辞書を単に更新するだけで
メソッドを追加したり変更したりすることができたのです!
Python の動的な性質 (dynamic nature of Python) によって
これらの変更が即座に対象となったクラスもしくはそのサブクラスの
すべてのインスタンスに影響を及ぼすことになりました。
同様に、独立した個々のオブジェクトは
インスタンス変数を動的に追加したり変更したり削除することによって
変更することが可能になりました
( さらにあとになってわたしが学んだ機能は
Python におけるオブジェクト実装を
属性の集合がオブジェクトの生成時に指定されていたものに制限されている
Smalltalk よりもさらに permissive なものとしました)。


Development of the class Syntax (クラス構文の開発)

Having designed the run-time representations for user-defined classes and instances, 
my next task was to design the syntax for class definitions, and in particular for the 
method definitions contained therein. A major design constraint was that I didn't 
want to add syntax for methods that differed from the syntax for functions. 
Refactoring the grammar and the byte code generator to handle such similar cases 
differently felt like a huge task. However, even if I was successful in keeping the 
grammar the same, I still had to figure out some way to deal with instance variables. 
Initially, I had hoped to emulate implicit instance variables as seen in C++. For 
example, in C++, classes are defined by code like this:

ユーザー定義のクラスやインスタンスのための実行時表現を設計したので、わたしの次なる仕事
はクラス定義のための構文を設計することととりわけクラスの中に置かれるメソッド定義をどの
ようにするかを決めることになりました。大きな設計上の制約はわたしがメソッド定義のために、
通常の関数ための構文とは異なった構文を追加するようなことはしたくなかったというものでし
た。文法とバイトコードジェネレーターを
to handle such similar cases differently felt like a huge task.
のためにリファクタリングしましたが、わたしは文法を変えずに保つということには成功しまし
たが、インスタンス変数を扱うための some way を figure out しなければなりませんでした。
C++にみられるのと同じような implicit なインスタンス変数をエミュレートしなければならな
いだろうと考えていました。たとえば C++ではクラスは以下のコード片のようにして定義します:

class A {
public:
   int x;
   void spam(int y) {
        printf("%d %d\n", x, y);
   }
};


In this class, an instance variable x has been declared. In methods, references to x 
implicitly refer to the corresponding instance variable. For example, in the method 
spam(), the variable x is not declared as either function parameter or as local 
variable However, since the class has declared an instance variable with that name, 
references to x simply refer to that variable. Although I had hoped to provide 
something similar in Python, it quickly became clear that such an approach would be 
impossible because there was no way to elegantly distinguish instance variables from 
local variables in a language without variable declarations.

このクラスでは、インスタンス変数 x は宣言済みです。メソッド内でxを参照するとそれは暗黙
のうちに対応するインスタンス変数を参照します。メソッド spam() の内側では変数 xは関数の
引数としてもローカル変数としても宣言されていませんが、クラスがその名前でインスタンス変
数を宣言しているのでx に対する参照は単純にクラスのインスタンス変数に対するものになるの
です。わたしはPython でも同様なものにしたいと望んだのですが、そのようなアプローチが不
可能であることがすぐに判明しました。その理由は、変数宣言が存在していない言語ではインス
タンス変数とローカル変数とを elegantly に区別するための手段が存在していないというもの
です。

In theory, getting the value of instance variables would be easy enough. Python 
already had a search order for unqualified variable names: locals, globals, and 
built-ins. Each of these were represented as a dictionary mapping variable names to 
values. Thus, for each variable reference, a series of dictionaries would be searched 
until a hit was found. For example, when executing a function with a local variable p, 
and a global variable q, a statement like “print p, q” would look up p in the first 
dictionary in the search order, the dictionary containing local variables, and find a 
match. Next it would look up q in the first dictionary, find no match, then look it up 
in the second dictionary, the global variables, and find a match.

理論的には、インスタンス変数の値を得るということは十分に簡単なことです。Python はすで
に修飾されていない変数名に対する検索 order を持っていました。ローカル変数、グローバル
変数、そして組み込みのものという順です。これらはそれぞれが変数名を値にマッピングしてい
る辞書として表現されていました。したがって、それぞれが変数のリファレンスである辞書の 
series から該当するものが見つかるまで検索されます。たとえばローカル変数 p とグローバル
変数 q を伴った関数を実行するとき、“print p, q”のような文は検索順で最初にあるローカ
ル変数を保持している辞書を検索して pを見つけ、続いてqも同じ辞書で探しますがこれは見つ
かりません。そして検索順で二番目にあるグローバル変数のための辞書で検索を行ってそこでq
を見つけ出します。

It would have been easy to add the current object's instance dictionary in front of 
this search list when executing a method. Then, in a method of an object with an 
instance variable x and local variable y, a statement like “print x, y” would find x 
in the instance dictionary (the first dictionary on the search path) and y in the 
local variable dictionary (the second dictionary).

メソッドを実行するときにカレントオブジェクトのインスタンス辞書を検索リストの先頭に追加
することは簡単なことです。そしてインスタンス変数 x と ローカル変数 y を伴ったあるオブ
ジェクトのメソッドの中で、“print x, y”のような文はx をインスタンス辞書(検索パスの最
初の辞書)で発見し、y をローカル変数辞書 (二番目の辞書)で発見することになるでしょう。

The problem with this strategy is that it falls apart for setting instance variables. 
Python's assignment doesn’t search for the variable name in the dictionaries, but 
simply adds or replaces the variable in the first dictionary in the search order, 
normally the local variables. This has the effect that variables are always created in 
the local scope by default (although it should be noted that there is a “global 
declaration” to override this on a per-function, per-variable basis.)

この戦略に関しての問題はインスタンス変数に対する値の設定に帰着します。Python の代入文
は辞書から代入の対象となる変数の名前を検索することはしません。ただ単に検索順で最初の辞
書、通常はローカル変数用のそれにある変数を追加したり置換したりするだけです。これはデフ
ォルトでは代入によってその変数が常にローカルスコープで作られるという効果をもちます(と
はいえ、関数ごとや variable basis  ごとに上記のことをオーバーライドするために  “
global declaration”(大域的宣言)が存在するということに注意しておくべきでしょう)。

Without changing this simple-minded approach to assignment, making the instance 
dictionary the first item in the search order would make it impossible to assign to 
local variables in a method. For example, if you had a method like this

この代入に関する simple-minded なアプローチを変更することなくインスタンス辞書を辞書の
検索順で最初に持ってくることはメソッド内でのローカル変数に対する代入を不可能にしてしま
うのです。たとえば次のようなメソッドがあったとして

def spam(y):
    x = 1       
    y = 2       


The assignments to x and y would overwrite the instance variable x and create a new 
instance variable y that shadowed the local variable y. Swapping instance variables 
and local variables in the search order would merely reverse the problem, making it 
impossible to assign to instance variables.

このx と yに対する代入ではインスタンス変数 x を上書きし、
そしてローカル変数 y を shadowed してしまう新しいインスタンス変数 y を生成します
辞書の検索順でインスタンス変数のものとローカル変数のものとを
交換してもただ単に問題が裏返しになるだけで、
インスタンス変数に対する代入が不可能になってしまいます。

Changing the semantics of assignment to assign to an instance variable if one already 
existed and to a local otherwise wouldn't work either, since this would create a 
bootstrap problem: how does an instance variable get created initially? A possible 
solution might have been to require explicit declaration of instance variables as was 
the case for global variables, but I really didn’t want to add a feature like that 
given that that I had gotten this far without any variable declarations at all. Plus, 
the extra specification required for indicating a global variable was more of a 
special case that was used sparingly in most code. Requiring a special specification 
for instance variables, on the other hand, would have to be used almost everywhere in 
a class. Another possible solution would have been to make instance variables 
lexically distinct. For example, having instance variables start with a special 
character such as @ (an approach taken by Ruby) or by having some kind of special 
naming convention involving prefixes or capitalization. Neither of these appealed to 
me (and they still don't).

代入文のセマンティクスを、インスタンス変数としてすでに存在している場合にはインスタンス
変数に対する代入にし、そうでない場合にはローカル変数に対する代入のように変更してもうま
くいかず、bootstrap 問題を作り出してしまいます:インスタンス変数は最初にどうやって作る
のでしょうか?可能な解決策は、グローバル変数のそれと同様にはっきりとわかる形でのインス
タンス変数の宣言を要求するというものになるでしょう。しかしわたしは
given that that I had gotten this far without any variable declarations at all
のような機能を追加することを本当にしたくなかったのです。
それに加えて、グローバル変数を indicate するのに要求される追加仕様 (extra specification)
は大部分のコードではあまり使われないような(used sparingly in most code)、
more of a special case でした。
もう一つの解決方法としてインスタンス変数をレキシカルに区別がつくものにしてしまう
というものがありました。たとえば(Rubyがやっているように)@ のような特別な
キャラクターでインスタンス変数の名前を開始するといったものです。
あるいは接頭辞をつけるとかキャピタライズするといった
特殊な命名規則のようなものを導入するというのもあるでしょう。
こういったもののどれもがわたしには魅力あるものには映りませんでした
(これは今でも変わりません)。

Instead, I decided to give up on the idea of implicit references to instance variables. 
Languages like C++ let you write this->foo to explicitly reference the instance 
variable foo (in case there's a separate local variable foo). Thus, I decided to make 
such explicit references the only way to reference instance variables. In addition, I 
decided that rather than making the current object ("this") a special 
keyword, I would simply make "this" (or its equivalent) the first named 
argument to a method. Instance variables would just always be referenced as attributes 
of that argument.

結局のところわたしはインスタンス変数に対する暗黙の参照というアイデアをあきらめることにしました。
C++ のような言語はあなたに対してthis->foo のようにインスタンス変数 foo に対する参照
であることをはっきりとした形で記述させます。(in case there's a separate local variable 
foo)。ですから、わたしはそのような明確な形での参照がインスタンス変数を参照するための
ただひとつの方法であると決定したのです。また、カレントオブジェクトを表すために特別なキーワー
ド("this")をつくるのではなくあるメソッドの最初の引数の名前が“this”(もしくはそれと同
等のもの)であるとしたのです。インスタンス変数は単にいつもその引数の属性として参照され
ます。

With explicit references, there is no need to have a special syntax for method 
definitions nor do you have to worry about complicated semantics concerning variable 
lookup. Instead, one simply defines a function whose first argument corresponds to the 
instance, which by convention is named "self." For example:

明確な参照を伴っているので、メソッド定義のために特別な構文は必要ありませんし、また、
変数の検索に関して複雑なセマンティクスを心配するような必要もありません。その代わりに定義する関数の
最初の引数がインスタンスに対応するものにするということになります。その引数は規約により 
"self" という名前を使うようになっています。

def spam(self,y):
    print self.x, y


This approach resembles something I had seen in Modula-3, which had already provided 
me with the syntax for import and exception handling. Modula-3 doesn't have classes, 
but it lets you create record types containing fully typed function pointer members 
that are initialized by default to functions defined nearby, and adds syntactic sugar 
so that if x is such a record variable, and m is a function pointer member of that 
record, initialized to function f, then calling x.m(args) is equivalent to calling f(x, 
args). This matches the typical implementation of objects and methods, and makes it 
possible to equate instance variables with attributes of the first argument.

このアプローチは、すでにimport や例外処理のための構文を備えていた
Modula-3 でわたしが見たことがあるようなものを ressemble していました。
Modula-3 はクラスを持っていませんでしたが
完全な型付けをされた関数ポインターであるメンバーを持った
レコード型を作ることができました。
このメンバーはデフォルトでその近くで定義されている関数により初期化されました
(initialized by default to functions defined nearby)。
そして構文糖(syntactice sugar)がまぶされていたので、
レコード型変数 xがあり、m がそのレコードに含まれる関数ポインターメンバーであったとすると
そのメンバーは関数 fに初期化されます。
その後の x.m(args) という呼び出しは f(x, args)  という呼び出しと等価です。
これは典型的な実装にマッチするもので、
最初の引数に属性を伴っているインスタンス変数の equate を可能にするものです。


The remaining details of Python's class syntax follow from this design or from the 
constraints imposed by the rest of the implementation. Keeping with my desire for 
simplicity, I envisioned a class statement as a series of method definitions, which 
are syntactically identical to function definitions even though by convention, they 
are required to have a first argument named "self". In addition, rather than 
devising a new syntax for special kinds of class methods (such as initializers and 
destructors), I decided that these features could be handled by simply requiring the 
user to implement methods with special names such as __init__, __del__, and so forth. 
This naming convention was taken from C where identifiers starting with underscores 
are reserved by the compiler and often have special meaning (e.g., macros such as 
__FILE__ in the C preprocessor).

Pythonのクラス構文で残っている詳細はこの設計に従ったものであるか
or from the constraints imposed by the rest of the implementation.
単純さに対する自分の要望を保つためにわたしはクラス文を
メソッド定義の並び (series of method definitions) として envision しました。
それは構文的には関数定義と同一のものでありましたが、
クラス文では規約により最初の引数に“self”という名前のものを
要求するようになっていました。
それに加えて、(イニシャライザーやデストラクターのような)特殊なクラスメソッド
のために新しい構文を devise するのではなくユーザーに対して__init__ や __del__
のような特殊な名前を持ったメソッドを実装するようにお願いすることでこれらの機能が
handle できるようにしようとわたしは決めたのです。
この命名規則はアンダースコアから始まる識別子はコンパイラーによって予約されているものであり
しばしば特殊な意味を持っている(たとえばCのプリプロセッサマクロの __FILE__)
という Cのものを借りてきたものです。



Thus, I envisioned that a class would be defined by code that looked like this:
そのため、わたしはクラスは次に示すコードのようにして定義することを envision
(考察/予想/心に描く)したのです:

class A:
     def __init__(self,x):
         self.x = x
     def spam(self,y):
        print self.x, y


Again, I wanted to reuse as much of my earlier code as possible. Normally, a function 
definition is an executable statement that simply sets a variable in the current 
namespace referencing the function object (the variable name is the function name). 
Thus, rather than coming up with an entirely different approach for handling classes, 
it made sense to me to simply interpret the class body as a series of statements that 
were executed in a new namespace. The dictionary of this namespace would then be 
captured and used to initialize the class dictionary and create a class object. 
Underneath the covers, the specific approach taken is to turn the class body into an 
anonymous function that executes all of the statements in the class body and then 
returns the resulting dictionary of local variables. This dictionary is then passed to 
a helper function that creates a class object. Finally, this class object is then 
stored in a variable in the surrounding scope, whose name is the class name. Users are 
often surprised to learn that any sequence of valid Python statements can appear in a 
class body. This capability was really just a straightforward extension of my desire 
to keep the syntax simple as well as not artificially limiting what might possibly be 
useful.

繰り返しますが、わたしは可能な限りの量の my earlier code を再利用したいと求めていました。
関数定義は通常、カレントの名前空間で関数オブジェクトの参照している変数を単にセットする
だけの実行文です(この変数の名前が関数名になります)。
したがって、クラスを取り扱うために完全に異なったアプローチを取るのではなく、
クラスの本体をただ単純に新しい名前空間で実行される文の並びであるように解釈する
というのがわたしにとって意味のあるものだったのです。
その名前空間の辞書はクラス辞書を初期化しさらにクラスオブジェクトを生成するために
capture され使われます。
Underneath the covers,
the specific approach taken is 
クラスの本体をそれに含まれている文の全てを実行し、
その後でローカル変数のための resulting 辞書を返す
無名関数に turn into するというものです。
この辞書はそれからクラスオブジェクトを生成したヘルパー関数に渡されます。
最終的にこのクラスオブジェクトはそのクラスを囲むスコープに属する
(名前がクラス名と同じである) 変数に格納されます。
ユーザーは、正当なPython の文の任意の並びを
クラス本体に置くことができるということを学んでびっくりすることが頻繁にあります。
この能力は構文を、便利のために恣意的な制限を設けたりしないようにすると同時に
単純に保ちたいというわたしの願望を straightforward に拡張したもので


A final detail is the class instantiation (instance creation) syntax. Many languages, 
like C++ and Java, use a special operator, “new”, to create new class instances. In 
C++ this may be defensible since class names have a rather special status in the 
parser, but in Python this is not the case. I quickly realized that, since Python's 
parser doesn't care what kind of object you call, making the class object itself 
callable was the right, “minimal” solution, requiring no new syntax. I may have been 
ahead of my time here ― today, factory functions are often the preferred pattern for 
instance creation, and what I had done was simply to turn each class into its own 
factory.

A final detail はインスタンシエーション (インスタンスの生成) 構文です。
C++ や Java など多くの言語では新しいクラスインスタンスを生成するのに特殊な演算子
“new” を使っています。C++ ではクラス名がパーザーにとって特別なステータスを
持つものであるので、これはおそらく defensible (正当なものとして認められる)ですが、
Python ではこれにはあてはまりません。
I quickly realized that,
Python のパーザーがあなたが呼び出したオブジェクトの種類について注意しないので
making the class object itself callable was the right,
クラスオブジェクトそのものを呼び出し可能なものとする
“minimal” solution を採用することによって新しい構文を要求することもなかったのです。
I may have been ahead of my time here ―
今日、ファクトリ関数はしばしばインスタンス生成の preferred pattern であり、
わたしが行ったことはただ単にクラスをそれぞれ固有のファクトリに対応させただけなのです。


Special Methods(特殊メソッド)

As briefly mentioned in the last section, one of my main goals was to keep the 
implementation of classes simple. In most object oriented languages, there are a 
variety of special operators and methods that only apply to classes. For example, in 
C++, there is a special syntax for defining constructors and destructors that is 
different than the normal syntax used to define ordinary function and methods.

先のセクションで簡単に言及したように、
わたしの主目標のひとつはクラスの実装をシンプルに保つということでした。
大部分のオブジェクト指向言語では
クラスに対してのみ適用されるような多様な特別な演算子やメソッドがあります。
たとえば C++を例に取ると、
普通の関数やメソッドを定義するのに使われる通常の構文とは異なった
コンストラクターやデストラクターを定義する特別な構文がありました


I really didn't want to introduce additional syntax to handle special operations for 
objects. So instead, I handled this by simply mapping special operators to a 
predefined set of "special method" names such as __init__ and __del__. By 
defining methods with these names, users could supply code related to the construction 
and destruction of objects.

わたしは本当に
オブジェクトに対する特殊な操作を取り扱うために新しい構文を持ち込みたくはなかったのです。
わたしは新しい構文を持ち込む代わりに、単純に
__init__ や __del__ のようなあらかじめ決められていた“特殊な名前”に対して
特殊演算子をマッピングすることによって対処しました。
こういった名前を持つメソッドを定義することによって
ユーザーはオブジェクトの構築やは気に関連したコードを supply できるようになったのです。


I also used this technique to allow user classes to redefine the behavior of Python's 
operators. As previously noted, Python is implemented in C and uses tables of function 
pointers to implement various capabilities of built-in objects (e.g., “get attribute”, 
“add” and “call”). To allow these capabilities to be defined in user-defined 
classes, I mapped the various function pointers to special method names such as 
__getattr__, __add__, and __call__. There is a direct correspondence between these 
names and the tables of function pointers one has to define when implementing new 
Python objects in C.

わたしはまたこのテクニックをユーザークラスにおいて
Pythonの演算子の振る舞いを再定義できるようにするためにも使いました。
すでに述べているようにPython はCを使って実装されていて、
関数ポインターのテーブルを(“get attribute”,“add” and “call”).
のような組み込みオブジェクトの various capabilities 
を実装するために使っていました。
こういったユーザー定義クラスの中で定義が行える能力を可能とするために
こういった __getattr__, __add__, __call__ とのような名前を持った特殊メソッド名に対して
さまざな関数ポインターをマップしました。
こういった名前とCで新しいPython オブジェクトを実装するときには定義しなければならない
関数ポインターのテーブルとの間には direct correspondenceがありました。

Posted by Guido van Rossum at 11:25 AM

2009年02月18日

■_

・天才の話
同じものをみて、大部分の人が気づかないことに気がつくのが(軍事的な)天才だとかなんとか 聞いたことがあるなあと、某社の偉い人の年頭の挨拶を聴いたときにふと思い出した。 深い意味は(たぶん、おそらく、きっと)ありません。

・ふぁいなるかうんとだうん
そうか、来月は1.0リリースなんだな。 Parrot 0.9.1 "Final Countdown" Released! | Parrot VM
ちゃーちゃちゃーちゃちゃちゃちゃー♪ (誰もわかりません)

びるどはあしたやるー

■_ Modern な Perlとはなにか?

訳はあとで。

What is Modern Perl?
http://www.szabgab.com/blog/2009/02/1234765191.html

Published on 2009.02.16 at 08:19:51

Some time ago chromatic wrote about Modern Perl. I thought it to be a neat idea but 
did not follow up. Based on the first post I thought it is mostly about the use of 
high powered advanced features while now reading some of the comments I understand 
that at least in part Modern Perl is about helping beginners.

That's much more interesting to mee as I feel I understand that part more. So today I 
looked at some of the discussion on use.perl.org and on the web site of Modern Perl 
Books.

As I can understand there is a CPAN module called Modern::Perl that would enable 
strict, warnings and the features of perl 5.10.

I agree with the former two but unfortunatelly I still have an issue with 5.10. That's 
probably the main difference betwen Modern Perl and plain Perl for Beginners. The 
former can demand 5.10 on both the development and production machines, the latter has 
to live with whatever installed on the machines of the corporations.

Luckily in the past 2 years I have hardly seen any perl older than 5.6.0 at my clients 
but many are still stuck with 5.6 and nearly none of them made the change to 5.10. I 
can only assume that it is similar in the other parts of the world. That means if I 
want to give them good service I have to teach them something that will work on 5.6 or 
at least on 5.8.

That still gives plenty of improvements over most of the code out there in the 
direction of Modern Perl but it is a different type of beast.

  

use strict; use warnings; とかいくつかのこれは use しとかんといかんだろう pragma やらをまとめて宣言してくれる Modern::Perl とかいうモジュールがあったような。

■_ P6

あとで(ry


> right pointy
[ left boxy
] right boxy
{ left brace
} right brace
( left paren
) right paren
~ squiggle
+ plus
- dash
@ at
! bang
* star
| pipe
= equal
\ backslash
/ slash
_ underscore
« left french
» right french
^ hat
: colon
, comma
' tick
` backtick
; semicolon
f small f
o small o
p small p
q small q
x small x
Q big Q

In addition to a handy way to find out what an operator does, it also helps show how Perl 6 tries to allocate characters to uses that have similar or related semantics, by collecting a list of the various uses of a character in one place. Also mentioned are uses of characters from Perl5 and some other languages, so the index can also be used in a "how do I?" fashion.

Want to help build this? Make sure your favorite character, usage, or feature is documented... and that your favorite documentation is linked in. See the WITCH guidelines for some tips.

If any characters are being interperated as markup where they shouldn't be, enclose them in {{}}.


-->

■_

それを訊くのかという気もしますがw

Ruby, Python or Perl? - Stack Overflow
Ruby, Python or Perl? [closed]
I've gotten bored of hearing responses along the basic lines of eek! php! etc. when 
discussing programming. So I've decided to learn another programming language. The 
ones I'm looking at right now are Ruby, Python and Perl. Any reasons I should pick one 
over the others?

What I'm looking for (most to least important):

    * Good tutorials
    * Easily available tools to use (syntax highlighters etc.)
    * Runs on Windows
    * Easy to learn

Notes:

    * I know PHP and Java, and the basics of C++, C# and VB.NET .
    * Of these, I tried Ruby before but it just wouldn't install on my computer (Don't know why)
    * My web host supports Perl and Python but not Ruby.

It depends what you are trying to do, and why you want to learn it.

If you are just looking for an "expand my mind" type language, I would say 
go Ruby. The language focus on blocks and meta programming will push your comfort zone 
if you haven't touched anything like that before.

If you are looking for a general purpose language, go python. At this point, ruby is 
mostly "thing thing that powers rails", while python has been around for a 
very long time, and has alot of libraries written for it that ruby just doesn't have. 
It is a highly productive language with a more conservative take on things like sugar 
and monkey patching, which makes it less wacky and fun, but more practical for large 
scale development.

If you are looking for a web language, go ruby. The momentum around rails means there 
are things it is getting, or have gotten, that will not be available for python 
frameworks for awhile (kernel threads, threadsafe framework, something resembling an 
app server). I actually find Django is my favorite web platform out there, but rails 
is probably the best bet right now.

If you are looking for a scripting language, go Perl. It is ubiquitous on the UNIX 
platforms, and has been around forever, so there are tons of libraries available for 
it.
Don't just write Perl off as "a scripting language". It is a fully-featured 
programming language which has been used to write many large-scale, successful 
applications, both on and off the web. It has widely-used, mature web application 
frameworks, ORMs, etc. available via CPAN - there's just the minor problem of deciding 
which one to use, which can be tricky if you're not involved in the Perl community. 
(Coming from PHP, I'd recommend that you look at the Mason framework if you try Perl. 
Mason is based on the same general "code embedded in HTML" paradigm as PHP, 
but done right. Or at least as right as that design can be done.)

However, if your reason for leaving PHP is that you're "bored of hearing 
responses along the basic lines of eek! php! etc.", then Perl may not be the 
right choice. You'll get tired too quickly of people trying to tell you that Perl is 
dead/dying, looks like line noise, is write-only, etc. Although it's a great language 
today, it is still haunted by the ghosts of poorly-written code from long, long ago.
I recommend Python.

    * Good tutorials: official documentation is quite good. There is good free book 
      Dive Into Python. Following the links from this question you'll find a lot of other 
      books.

    * Easily available tools to use (syntax highlighters etc.): Well, you can use 
      Notepad++, powerful IPython console or PyDev for Eclipse IDE.
 
    * Runs on Windows: Easily =)

    * Easy to learn: it is a language for pleasant programming. It is really nice. It 
      is so easy to learn that some recommend it for beginners to study. But it is powerful 
       enough for real tasks as we can see from success stories.


Personally, I love Perl. I use it to get away from programming C#, and I find it 
useful when I have to drudge through text files (logs etc) and pull information. There 
are several useful books (oreilly) and sites dedicated to learning it. Besides you 
have to love a language when people have referred to PERL programmers as the 
Anarchists of the programming world (Dreaming In Code)

言語が死ぬとき。とは?

When does a language die? - Stack Overflow

As the title says, When Does a Language Die. When all Authors of the language die etc?.

With spoken languages, there are a couple definitions: (1) when no one speaks the 
language, or (2) when no one uses the language as their primary language. You could 
apply the same criteria to programming languages.
When nobody uses it. Or you think the people that started the English language are 
still around? :)
According to my Latin teacher: Never. ;-)
Old languages never die, they only fade away....

最後のやつは、only fade away ではなく、just ~ として欲しかったっw

■_ ぐぬーぱーふぇくとはっしゅ

Is gperf ASCII only?
Is gperf ASCII only?
From: 	Aharon Robbins
Subject: 	Is gperf ASCII only?
Date: 	Tue, 17 Feb 2009 21:22:02 +0200

Hi. Will gperf-generated code work correctly if the character set
for the identifiers is EBCDIC?

Thanks,

Arnold Robbins

なんで EBCIDIC やら? たぶん大丈夫なような気がするけどどうなんだろう。

■_ あとで(ry

Off The Lip » Why Not Haskell?
Why Not Haskell?

I'm going to try writing a balanced post about a programming language. Meaning that 
the words suck, shit, moron and brain dead are prohibited. Enterprisey too. And scale.

I've been mucking around with Haskell for some time now, enough to know my monad 
transformers, functors and function composition. It's all serious shit. Ooops, sorry. 
So I won't lie to you: the learning curve is steeper than for most other languages I'
ve learned before and I already have some decent functional programming skills. The 
purity of Haskell brings lots of advantages but it definitely requires more brain 
power than Java (random example). You also write at least twice less code than Java 
(another random example), in terms of terseness it's close to Ruby and can arguably 
be more expressive.

Now don't let the apparent complexity put you off, I'm just warning you a bit, you'
ll have to stay focused to learn Haskell, but it's still very reachable and most 
importantly (spoiler alert) it's worth it.

(以下略)

■_ 最初のプログラミング言語

まあどういう意味で「最初の」にもよるんですが。


A-0 System - Wikipedia, the free encyclopedia

The A-0 system, written by Grace Hopper in 1951 and 1952 for the UNIVAC I, was the 
first compiler ever developed for an electronic computer.[1] The A-0 functioned more 
as a loader or linker than the modern notion of a compiler. A program was specified as 
a sequence of subroutines and arguments. The subroutines were identified by a numeric 
code and the arguments to the subroutines were written directly after each subroutine 
code. The A-0 system converted the specification into machine code that could be fed 
into the computer a second time to execute the program.

The A-0 system was followed by the A-1, A-2, A-3 (released as ARITH-MATIC), AT-3 
(released as MATH-MATIC) and B-0 (released as FLOW-MATIC).


History of compiler writing - Wikipedia, the free encyclopediaTowards the end of 
the 1950s, machine-independent programming languages were first proposed. Subsequently, 
several experimental compilers were developed. The first compiler was written by Grace 
Hopper, in 1952, for the A-0 programming language. The FORTRAN team led by John Backus 
at IBM is generally credited as having introduced the first complete compiler, in 1957. 
COBOL was an early language to be compiled on multiple architectures, in 1960.[1]

■_ 今日のム板から

推薦図書/必読書のためのスレッド 45 
220 デフォルトの名無しさん [sage] Date:2009/02/18(水) 19:54:27  ID: Be:
    岩波講座 ソフトウェア科学 計算システム入門が350円だったから買ってきたわ 

221 デフォルトの名無しさん [sage] Date:2009/02/18(水) 20:02:54  ID: Be:
    ブックオフとかによく100円で売ってるよね 

222 デフォルトの名無しさん [sage] Date:2009/02/18(水) 20:05:06  ID: Be:
    あれはいいシリーズだから見たら買うべき。> 100円 

224 デフォルトの名無しさん [sage] Date:2009/02/18(水) 20:33:13  ID: Be:
    Code Complete いいね!
    最初の方は設計の話ばかりで概念が俺には良く分からなかったが
    コード設計に入ったあたりから知識の宝庫だわ
    幼女に乳首舐められたくらいの衝撃 

225 デフォルトの名無しさん [sage] Date:2009/02/18(水) 20:37:03  ID: Be:
    いい本なんだろうけど、さすがに高い・・ 

226 デフォルトの名無しさん [sage] Date:2009/02/18(水) 20:44:19  ID: Be:
    >>220
    それも随分過去のもんになったよな。
    どっか21世紀版のこういうシリーズを企画してくれないかな。 

229 デフォルトの名無しさん [sage] Date:2009/02/18(水) 20:57:46  ID: Be:
    それにしても>>220は凄いなw 

230   [sage] Date:2009/02/18(水) 21:18:57  ID: Be:
    Code Completeは洋書で買ったほうがはるかに安い。4000円ちょっとでかえる。
    しかも日本語版みたいに上下に分冊してない。
    でもCode Completeはソース以外の生の英語が多いから洋書を買うのをしり込みしちゃう。
    ボリュームがありすぎるし。

231 デフォルトの名無しさん [sage] Date:2009/02/18(水) 21:21:09  ID: Be:
    >>229
    鉄道忘れ物市で手に入れたんだ
    こんなの持ち歩いてる奴いたんだって思った 

232 デフォルトの名無しさん [sage] Date:2009/02/18(水) 21:47:38  ID: Be:
    >>230
    Amazon.co.jpの場合、

    日本語版 6405+6405=12810
    英語版 4258

    さすがにこれはないよなと思う。 

うーむ第二版は買ってないんだけど、これだけ違うと原書で買っとくかねえ。 初版は原書と翻訳版と両方買ったんだけどねw 北米に出張しているときに原書を見つけて、これはいい本だと買って帰ったら ちょうどその頃翻訳版が出たという。 重い思いをして持って帰ってきたのにw

推薦図書/必読書のためのスレッド 45 

173 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:01:19  ID: Be:
    私の知っている若い子は、みんな勉強熱心で、よく本を読むけど。
    自分よりも、書籍にお金かけている子は多いよ。
    会話のために話を作っているんじゃないの?

174 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:07:23  ID: Be:
    それはないな
    本当に本を読まないのが多すぎる 

175 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:09:51  ID: Be:
    まあ教科書を読んでないのは確かだな 

176 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:10:11  ID: Be:
    過度の一般化乙 

177 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:21:21  ID: Be:
    >>173が本を全然読まないやつで、>>173の知っている若い子は
    本をほとんど読まないやつなんじゃないか?単にレベルが低いというか。

    具体的な書名とか月何冊読むとかで検証してみると面白いかもね。 

178 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:29:02  ID: Be:
    本読まない奴は極端にレベルが低いか極端にレベルが高いかのどちらかだ。
    前者はただの不勉強。後者は何でも自分で確かめてしまうので本を読まなくて十分という奴。 

179 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:36:30  ID: Be:
    お前の職場の話はマ板でやれ 

180 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:39:41  ID: Be:
    Cマガジンが休刊してから読まなくなった 

181 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:40:05  ID: Be:
    本読まないやつはだめだろ。
    たとえば、C++の入門書だけよんで、あとは実践で試行錯誤して
    「EffectiveC++に書いてることって常識だよね」っていえるくらいのレベルに
    達するやつなんてそうそういるとは思えん。
    (ネットだけでもだいぶカバーできるかもしれんけど) 

182 デフォルトの名無しさん [] Date:2009/02/17(火) 23:45:34  ID: Be:
    >>178
    >本読まない奴は極端にレベルが低いか極端にレベルが高いかのどちらかだ。

    これ嘘な。 

183 デフォルトの名無しさん [sage] Date:2009/02/17(火) 23:49:36  ID: Be:
    本読まなくかつできる奴は、我流コーディングだろう

    一緒に仕事はしたくないタイプだ 

185 デフォルトの名無しさん [] Date:2009/02/18(水) 00:25:21  ID: Be:
    嘘だな。正しくは、
    「本を読まないやつは全員馬鹿。
    本を読み、理解した人が賢く、理解しなければ読んでも馬鹿のまま」だ。

    「中には本を読まなくても賢いやつはいる」というが、
    その人は媒体が本でないものから計り知れない労力を費やし身につけたわけで、
    少なくとも「前例があるから読まなくてもいい」にはならない。
    天才ならばともかく、凡人は素直に本を読み、学ぶのがいちばん。 



【入門】Common Lisp その6【質問よろず】 
1 デフォルトの名無しさん [sage] Date:2009/02/18(水) 00:22:16  ID: Be:
    lispを触ってみたい入門者のQ&A
    初心者のQ&A
    本スレでは恥ずかしくて聞けない人のQ&A
    本スレは高度すぎて割り込めない人のQ&A
    linuxでなくてwindowsでやりたいんですが・・・Q&A
    lispを使用してC#やJAVAの代替にするための方法(おまけ)

    ま、ゆっくりたりましょう。

    「いいものの本質は、いかなる時代においても変わらない」byパワーズ

    (list
    (url http://pc8.2ch.net/test/read.cgi/tech/1101386936/l50 :part 1)
    (url http://pc11.2ch.net/test/read.so/tech/1140012484/l50 :part 2)
    (url http://pc11.2ch.net/test/read.so/tech/1181479267/l50 :part 3)
    (url http://pc11.2ch.net/test/read.cgi/tech/1201402366/l50 :part 4)
    (url http://pc11.2ch.net/test/read.cgi/tech/1215834213/l50 :part 5))

    □テンプレート置き場□
    ttp://wiki.fdiary.net/lisp/ (id:guest pass:cl)

9 デフォルトの名無しさん [sage] Date:2009/02/18(水) 02:32:40  ID: Be:

             *、 *、      。*゚    *-+。・+。-*。+。*
            / ゚+、 ゚+、   *゚ ・゚    \       。*゚
           ∩    *。  *。    +゚    ∩    *
       (´・ω・`)      +。   +。   ゚*     (´・ω・`)
       と   ノ      *゚  *゚    ・     。ヽ、  つ
        と、ノ     ・゚  ・゚     +゚    *  ヽ、 ⊃
         ~∪    *゚  *゚      *    +゚    ∪~   ☆
              +′ +′      +゚   ゚+。*。・+。-*。+。*゚

10 デフォルトの名無しさん [sage] Date:2009/02/18(水) 09:42:40  ID: Be:
    こんなスレあったんですね! 

11 デフォルトの名無しさん [sage] Date:2009/02/18(水) 09:51:01  ID: Be:
    あったんですよ奥さん! 

■_本日の巡回から

2009年02月17日

■_

・マラ
小説フランス革命の第二巻、「バスティーユの陥落」を読み進めていたら、 歴史の教科書とかでは「マラー」とか書かれていることがほとんどだった人物が 「マラ」という表記だった。 そんだけ。 あ、いや、音楽の「マーラー」は違う表記があったりするんだろうか?
バスティーユの陥落 (小説フランス革命) (小説フランス革命 2)

・TOKS
まあよく言う「KIOSK」みたいな駅にある売店です。東急の。 んで、今朝のことなんですが、PASMOの読み取り機械の調子が悪いだかなんだかで 売店のおばちゃんが往生してました。 わしが高校生の頃の売店のおばちゃんの客さばきはそれこそ芸術的なものだったんだが喃。 まあ売ってるものの種類も増えてたりするんで、単純に比較は出来ませんけど。

・ONE OUTS
日テレでやってるアニメ、どこまでやるんだろう? 今対戦しているブルーマーズがらみのエピソードでは分量が足りないような気がするし、 かといってその次までは収まらない。
ONE OUTS-ワンナウツ-オリジナル・サウンドトラック
番組での次回予告にも使われている三曲目がお気に入り。

■_ 今日の巡回から

佐藤一郎: Web日記 (2009年)
2009年2月14日

Webメディアにプログラミング言語別の求人数と給与の調査データが出ていたのですが、求人情
報の条件に記載された情報からの調査だそうですが、求人数が多いのはJavaで、給与が多いのは
C#だそうです。個人的には、いいプログラミング言語とは、プログラマの給与が高い言語と考え
ております。言語設計がきれいとか、表現性が高いとかいっても、その言語で開発しても給与が
安けれやはりダメ言語ではないでしょうかね。
(略)
それにしてもMicrosoft系の言語は給与が高いですね。C#、ASP.NET、VisualBasic.NET、VBAが
上位にランキング。お金の臭いがする限りはMicrosoft系の言語の人気は続くのでしょうが、
それは金の切れ目が変の切れ目ともなります。

ふうむ。鼠を獲るのが良い猫ってやつですか(多分違う) >いいプログラミング言語 == プログラマの給与が高い言語

■_ stackoverflow から

ひとつめ。“Lerngin Perl"の次に読む本を教えてちょんまげ。 というお悩み。

What comes next after "Learning Perl" - Stack Overflow

I decided to learn Perl after realizing that most of my bash scripts were getting 
rather unwieldy in their current form and would become a maintenance nightmare if I 
continued down that path. A friend showed me a couple of examples using regular 
expressions and in-built modules in Perl and I was hooked instantly. To that effect I 
borrowed a copy of "Learning Perl" (great) and "Beginning Perl" 
(not quite), registered on PerlMonks and downloaded a copy of the perldoc which has 
become a bible of sorts for me currently.

As of this moment I fell comfortable with the basics, though topics such as building 
modules, OOP and to an extent, references, still continue to elude me. The material in 
the above mentioned books is rather sparse for these topics and since my interest now 
goes beyond just converting shell scripts I would like to delve further into the 
language. Any suggestions on which books / materials I should peruse? Are there any 
projects out there in the wild that would help my learning and give me a better grasp 
of larger programs written in Perl?

Please note that my basic day to day tasks involve system administration but I also 
like to devote time to open-source projects in any capacity whatsoever. All 
suggestions, links and tips are welcome. My next read is going to be Intermediate Perl 
but I am always open to other suggestions.
From the same series, I have Perl Cookbook, Programming Perl and Advanced Perl 
Programming. As well as being very handy, they look quite nice side-by-side on my 
bookshelf.

I'd never heard of Intermediate Perl, I went straight from Programming to Advanced 
Programming to Python :-)


Mastering Regular Expressions


Higher-Order Perl

いや、二冊目が Higher Order Perl ってのは…

二つめ。OOPでswitch文てつかってはいかんのですか? というご相談。

Does anyone disagree with the statement: "using switch is bad OOP style"? - Stack Overflow

I have seen it written in multiple threads/comments on stackoverflow that using switch 
is just bad OOP style. Personally I disagree with this.

There will be many cases where you cannot add code (i.e. methods) to enum classes you 
want to switch on because you don't control them, perhaps they are in a 3rd-party jar 
file. There will be other cases where putting the functionality on the enum itself is 
a bad idea because it violates some separation-of-concerns considerations, or it is 
actually a function of something else as well as the enumeration.

Last of all, switches are concise and clear:

boolean investable;
switch (customer.getCategory()) {
    case SUB_PRIME:
    case MID_PRIME:
        investible = customer.getSavingsAccount().getBalance() > 1e6; break;
    case PRIME:
        investible = customer.isCeo(); break;
}

I'm not defending every use of switch and I'm not saying it's always the way to go. 
But statements like "Switch is a code smell" are just wrong, in my opinion. 
Does anyone else agree?
I do believe switching on type is a code smell. However I share your concerns about 
separation-of-concerns in code. But those can be solved in many ways that allow you to 
still use polymorphism, e.g. the visitor pattern or something similar. Read up on 
"Design Patterns" by the Gang of Four.

If your core objects like Customer stays fixed most of the time but operations change 
often, then you can define operations as objects.

    interface Operation {
      void handlePrimeCustomer(PrimeCustomer customer);
      void  handleMidPrimeCustomer(MidPrimeCustomer customer);
      void  handleSubPrimeCustomer(SubPrimeCustomer customer);    
    };

    class InvestibleOperation : public Operation {
      void  handlePrimeCustomer(PrimeCustomer customer) {
        bool investible = customer.isCeo();
      }

      void  handleMidPrimeCustomer(MidPrimeCustomer customer) {
        handleSubPrimeCustomer(customer);
      }

      void  handleSubPrimeCustomer(SubPrimeCustomer customer) {
        bool investible = customer.getSavingsAccount().getBalance() > 1e6;    
      }
    };

    class SubPrimeCustomer : public Customer {
      void  doOperation(Operation op) {
        op.handleSubPrimeCustomer(this);
      }
    };

   class PrimeCustomer : public Customer {
      void  doOperation(Operation op) {
        op.handlePrimeCustomer(this);
      }
    };

This looks like overkill, but it can easily save you a lot of coding when you need to 
handle operations as collections. E.g. display all of them in a list and let user 
select one. If operations are defined as functions you easily end up with a lot of 
hard coded switch-case logic, multiple places which needs to be update each time you 
add another operation, or product as I see it referred to here.

逆方向の意見も出てました。が、わたし個人としては GoF 読めな意見に賛成かなあ。

みっつめ。「関数型言語はよく賞賛されているけど、じゃあなんで広く使われてないわけ?」 という質問。

Why functional programming is not popular - Stack Overflow
Duplicate: Why do people think functional programming will catch on?
http://stackoverflow.com/questions/411290/why-do-people-think-functional-programming-will-catch-on

I always found functional programming fascinating, and every good programmer talks 
about the benefits of it. Then why is it not popular? Of course, some languages that 
have functional programming paradigms without explicitly stating them are popular 
(like Ruby, Python etc). It is interesting that no statically typed or pure fp 
languages are mainstream. Is it because of the scary theory involved with them?


Partly it's because stored program digital computers are procedural, not functional.

Also, it's partly because we tend to think statefully, and it takes a lot of practice 
to learn to think without relying on explicit state change.


Probably, its the scary theory. But, most part of the blame also should go to the 
immediate folks- profs., teachers- in our school who teaches us programming. We always 
start with something like BASIC, move on to C/C++, Java, C# and the like. We are 
learning different languages, but only the imperative/procedural/OOP style of 
programming.

In a CS course like Data Structures, Algorithms, what we normally do in C/C++, it 
would be far better and a more learning exp. to learn to program then in a Functional 
language or a mixed language like Lisp.

ノイマン型アーキテクチャにあわない。ってのはどうなんですかねえ。

よっつめ。「静的に型検査する」「スクリプティング言語」ってあるの?

Anyone know of any staticly-typed scripting languages? - Stack Overflow
Anyone know of any staticly-typed scripting languages?

I'm about to start an LFS-based linux distro just for a hobby project. I plan on doing 
some very non-standard tasks, and most of it will involve change almost all scripts in 
the distro. (mainly init scripts, but also I'll be writing a simple set of package 
manager scripts.) Since I'm gonna be going this far off the norm, and since I have 
never been a fan of dynamic-typed languages (perl, python, bash and the rest are good, 
but just not my forte), I was wondering if anyone knew of an interpreted language that 
actually has declared variables.
Typically the statically typed languages are compiled languages. I guess the reason is, 
that statical analysis of types is rather expensive and you have to have an in depth 
look at all the code you're processing. After you've done that it feels like a waste 
to not write all that information into a file, so that you don't have to do it again 
next time. So you quickly end up with a compiled language.

On the other hand, to turn a compiled language in a "not-compiled" one is rather easy. 
You just don't store the results of the compilation anywhere but execute them directly. 
One compiler I know that provides such a wrapper is GHC, the standard Haskell compiler. 
You can add #!/usr/bin/runhaskell to your source files and then directly execute them. 
And since you're planning to be far off the norm, Haskell seems like a perfect fit ;). 
But expect some rather large startup time for your scripts, because all the "compile 
time" analysis and optimization isn't free.

Haskell isn't made for shell scripting and it's a functional language, so if you've 
never seen it before, it might take some time to get used to. But it has very little 
syntactical overhead and the strength of functional languages is abstraction, so I 
don't see why you couldn't create a library that makes shell scripting fun. There is 
even some experimental Haskell shell, but it does seem to be more a proof-of-concept 
than a real solution.

Generally I would say the overhead of all the type analysis is significant, but I 
would suggest you pick your favorite statically typed compiled language and look for a 
wrapper like runhaskell to execute scripts written in it.

■_ R

ま、ちまちまと。

> print('hello')
[1] "hello"
> x <- 'world'
> x
[1] "world"
> print('hello', x)
 以下にエラー print.default("hello", x) :  'digits' 引数が不正です 
 追加情報:  Warning message:
In print.default("hello", x) :  強制変換により NA が生成されました 
> print('hello' + x)
 以下にエラー "hello" + x :  二項演算子の引数が数値ではありません 
> print(cat('hello', x))
hello worldNULL
> cat('hello', x)
hello world> 
> cat('hello', x, "\n")
hello world 
> print(cat('hello', x, "\n"))
hello world 
NULL
> y <- cat('hello', x, "\n")
hello world 
> y
NULL
> y <- paste('hello', x, "\n")
> y
[1] "hello world \n"
> print(paste('hello', x, "\n"))
[1] "hello world \n"
> 

なんでpaste と cat と似たような動作の関数が二つあるんだ。 いやまあ、cat は出力をして戻り値はNULL だけど paste は結果が戻り値とか違うけどね。

すんません。まだこんなところをうろうろしているレベルなんです○| ̄|_

■_ わかんなくなってきた

まだ4回目なのに。

再帰とデータ型の話をしよう - @IT

第4回 再帰とデータ型の話をしよう

階段の昇り方

 もう1つ問題を考えよう。

階段を1度に1段または1段飛しで(つまり1度に2段)昇るものとする。階段の段数を与えられた
とき、その昇り方が何通りあるかを表現する関数を定義せよ

 これも前節と同じように考えると簡単に定義できる。

 何度か昇って、いまn段目にいるとすると、直前には(n-1)段目にいたか、(n-2)段目にいたか
のどちらかである。ということは、n段目に到達する昇り方の数は、(n-1)段目への昇り方の数と
(n-2)段目への昇り方の数の和になるはずだ。

 n段目への昇り方の数をstepWays nと表現すると、

stepWays n = stepWays (n-1) + stepWays (n-2)

となる。これだけでは先ほどと同じようなエラーになってしまうので、もう少し考えよう。

    * いま1段目にいるとすると、直前にいたのは0段目
    * いま0段目にいるとすると、直前というのはなく、そこにいるわけだから0段目への昇り方は
      1通りと考えるのが妥当

というわけで、stepWaysは次のように定義できる。

stepWays :: Integer -> Integer
stepWays n | n >  1    = stepWays (n-1) + stepWays (n-2)
           | n == 1    = stepWays 0
           | n == 0    = 1
           | otherwise = undefined

  

ここまではいい。 定義そのものも、効率が悪いというのもわかる。

計算の効率

 stepWaysは最初の0段目と1段目を除くと、

stepWays n = stepWays (n-1) + stepWays (n-2)

という定義になっている。右辺の+の第1オペランドの部分を1段階展開すると、

stepWays n = (stepWays (n-2) + stepWays (n-3)) + stepWays (n-2)

となっている。stepWays (n-2)の項が2カ所に現れているが、それぞれ別々に計算することにな
るので冗長で効率の悪い計算になる。実際、階段が50段もあれば待てなくなる。

 stepWays nの定義の右辺で、stepWays (n-1)とstepWays (n-2)を独立に計算しているのが敗因
なのである。少し工夫をしてみよう。

stepWays2 n ≡ (stepWays (n+1), stepWays n)

となるstepWays2という関数を考える。まず、

stepWays2 0 ≡ (stepWays 1, stepWays 0)
            ≡ (1, 1)


である。次に、stepWays2 nの右辺を考える。これはタプルの1番目の要素と2番目の要素に計算
が分岐しているので改善されるわけではない。そこで、タプルの第1要素を1段展開する。

stepWays2 n ≡ (stepWays (n+1), stepWays n)
            ≡ (stepWays n + stepWays (n-1), stepWays n)

 ここで、1つ前の段階stepWays2 (n-1)を考えると、

stepWays2 (n-1) ≡ (stepWay n, stepWay (n-1))

である。そうすると、stepWays nは以下のように定義できる。

stepWays2 n = (a+b, a) where (a,b) = stepWays2 (n-1)

 これで計算の分岐がなくなった。あらためて、stepWaysをstepWays2を使って定義すると、

stepWays = snd . stepWays2

となる。.は関数合成であり、sndはタプルの第2要素を取り出す関数である。これなら、100段の
階段でもあっさり求められる。

 もともとの素朴な定義は、重複があるにもかかわらず複数独立に再帰計算が行われるために、
非効率であった。このような再帰関数を、タプルを使って複雑な問題にしてから解くと効率が改
善されるというと、なんだか少しだまされたような感じはする。しかし、確かに速くなっている。

  

ダメだ。公式の証明見ているようで(実際そっちも大の苦手)、 どう変形してそうなったのかがイメージできない。 そして、 = (a+b, a) ってなにもの~~~っ!? あー、これが「戻り値」か? んでその値は where 以下を使って…

■_

軍オタが好きな名言、名ゼリフ Ausf

146 名無し三等兵 [sage] Date:2009/02/16(月) 22:45:24 ID:??? Be:

    「我々はまだ戦えます」
    「だから話し合いのテーブルにつくのだ。」

    マンネルヘイム元帥 

マンネルハイム は「雪中の奇跡」のエピソードで出てくる人ですね。 たしか、やる夫シリーズにあったんじゃなかったかな>雪中の奇跡 冬戦争 - アンサイクロペディア

Pythonのお勉強 Part31 
930 デフォルトの名無しさん [sage] Date:2009/02/15(日) 23:37:57  ID: Be:
    RubyやるくらいならPerlの方がまだマシだなぁ 

931 デフォルトの名無しさん [sage] Date:2009/02/16(月) 00:26:20  ID: Be:
    >>930
    一度しかない人生。自分を大切に。

932 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:04:40  ID: Be:
    いやPerlの後にPythonとRubyを実際に触ってみての感想なんだが 

933 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:06:22  ID: Be:
    まあ無人島に二人きりになるとしたらLarryだよな。 

935 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:27:05  ID: Be:
    日本語通じるMatzだろ 

936 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:28:25  ID: Be:
    断然Larryだな 

937 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:31:24  ID: Be:
    何故か候補にすら上がらないGuido 

938 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:36:21  ID: Be:
    キャラが薄すぎるんだよな・・・ 

941 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:41:14  ID: Be:
    RMSだと人生が変わってしまうかもしれん。 

942 デフォルトの名無しさん [sage] Date:2009/02/16(月) 01:41:34  ID: Be:
    たまにはGuidoのことも思い出してあげてください>< 

958 デフォルトの名無しさん [] Date:2009/02/16(月) 18:41:15  ID: Be:
    >>935
    日本語通じるかなあwww 

959 デフォルトの名無しさん [sage] Date:2009/02/16(月) 22:42:22  ID: Be:
    俺もそれは思ったw 

推薦図書/必読書のためのスレッド 45 
156 デフォルトの名無しさん [sage] Date:2009/02/17(火) 20:05:06  ID: Be:
    新人のコードがひどすぎてバグだらけなので、せめてEffective C++くらい読めと薦めた
    「3800円もするじゃないですかwwwww 本なのにwwww」
    とか言ってた・・・。 

157 デフォルトの名無しさん [sage] Date:2009/02/17(火) 20:07:51  ID: Be:
    今まで専門書の類を買ったことないんだな・・ 

160 デフォルトの名無しさん [sage] Date:2009/02/17(火) 20:35:28  ID: Be:
    >>156
    本読まない文化と遭遇か・・乙 

161 デフォルトの名無しさん [sage] Date:2009/02/17(火) 20:36:42  ID: Be:
    >>156
    面接の時に最近読んだ本を尋ねるのは大事だなw 

162 デフォルトの名無しさん [sage] Date:2009/02/17(火) 20:49:10  ID: Be:
    >>156
    会社にねーのかよw 

170 デフォルトの名無しさん [sage] Date:2009/02/17(火) 21:45:46  ID: Be:
    今の若者ってほんと本読まないのな
    「文字ばっかなんですか?」とか聞いてくる 

2009年02月16日

■_

・DVD mixiの某コミュで知ったのですが、「電子立国日本の自叙伝」のDVDがついに出るようです。 すでにAmazonでは予約を受け付けている模様。
NHKスペシャル 電子立国 日本の自叙伝 DVD- BOX 全6枚セット
NHKスペシャル 電子立国 日本の自叙伝 DVD- BOX 全6枚セット

BOX だけではなく各話ごとのバラ売りもあるようです。 ワタクシのオススメは、第4話(電卓戦争)と第5話(8ミリ角のコンピューター)です。


  NHKスペシャル 電子立国 日本の自叙伝 第1回 新・石器時代 驚異の半導体産業 [DVD]
NHKスペシャル 電子立国 日本の自叙伝 第1回 新・石器時代 驚異の半導体産業 [DVD] NHKスペシャル 電子立国 日本の自叙伝 第2回 トランジスタの誕生 [DVD]
NHKスペシャル 電子立国 日本の自叙伝 第2回 トランジスタの誕生 [DVD] NHKスペシャル 電子立国 日本の自叙伝 第3回 石になった電気回路 [DVD]
NHKスペシャル 電子立国 日本の自叙伝 第3回 石になった電気回路 [DVD] NHKスペシャル 電子立国 日本の自叙伝 第4回 電卓戦争 [DVD]
NHKスペシャル 電子立国 日本の自叙伝 第4回 電卓戦争 [DVD] NHKスペシャル 電子立国 日本の自叙伝 第5回 8ミリ角のコンピューター [DVD]
NHKスペシャル 電子立国 日本の自叙伝 第5回 8ミリ角のコンピューター [DVD] NHKスペシャル 電子立国 日本の自叙伝 第6回 ミクロン世界の技術大国 [DVD]
NHKスペシャル 電子立国 日本の自叙伝 第6回 ミクロン世界の技術大国 [DVD]

■_ 今日のロストテクノロジー

まあイマドキのプロセッサーじゃあたぶんこの手の「最適化」はほとんど意味がないと思う。 元記事の筆者もネタで書いたんだろうなあ(でないとむしろ怖いw)。

Retro Programming: Optimising Assembly Like an 80's Hacker

Optimising Assembly Like an 80's Hacker (1980年代のハッカーのようにアセンブリ言語を最適化する)

Forget about fancy algorithms and data structures. If you want respect as an 80's 
hacker, follow these simple tips.

Never get caught setting a register to zero without using xor:
レジスターにゼロをロードしないでxorを使う

Z80 Code

ld a,0           ; bad, 2 bytes / 7 cycles

xor a            ; good, 1 byte / 4 cycles


8088 Code

mov ax,0         ; bad, 3 bytes / 4 cycles

xor ax,ax        ; good, 2 bytes / 3 cycles


Never set two 8 bit register independently. Code readability is not required:
(レジスタペアを構成する) 8ビットレジスターに別々にロードしない。

Z80 Code

ld b,10          ; bad, 4 bytes / 14 cycles
ld c,32

ld bc,10*256+32  ; good, 3 bytes / 11 cycles


8088 Code

mov ch,10        ; bad, 4 bytes / 8 cycles
mov cl,32

mov cx,10*256+32 ; good, 3 bytes / 4 cycles


Never compare to zero:
ゼロと比較しない

Z80 Code

cp 0             ; bad, 2 bytes / 7 cycles

or a             ; good, 1 byte / 4 cycles


8088 Code

cmp ax,0         ; bad, 3 bytes / 4 cycles

test ax,ax       ; good, 2 bytes / 3 cycles


Remember, you don't need to worry about code alignment, order of instructions or 
processor penalties. Follow these simple tips and your super-optimised bubble sort 
will demand the utmost respect!

Posted by John

  

■_ 今日の巡回から

Next Wave:セキュリティの専門家が語る「不思議の国、日本」 (1/2) - ITmedia エンタープライズ
http://www.itmedia.co.jp/enterprise/articles/0902/13/news075.html

HDDのインターフェースの歴史 PC用は「ST-506」から始まる:WinPC Labs 小箱に詰まった先端技術を知る 
http://pc.nikkeibp.co.jp/article/trend/20090115/1011349/?set=rss

急上昇する記憶容量,進化するストレージ(後編):ITpro
http://itpro.nikkeibp.co.jp/article/COLUMN/20081225/322031/

変わるプロセッサ(2)AMD Opteronがもたらしたもの:ITpro
http://itpro.nikkeibp.co.jp/article/COLUMN/20081217/321655/

■_ それは楽しみな

http://arton.no-ip.info/diary/20090216.html#p01

L'eclat des jours
_ DRY

WEB+DBにt-wadaさんやkwachさんとDRYの記事を書きました(書影がアマゾンに出ているくらいだ
から、もう書いてもいいだろうと思うので書いている)。

WEB+DB PRESS Vol.49 WEB+DB PRESS Vol.49

もしかしたら、相当かあるいはちょっと、衝撃的あるいは挑発的な、内容かも知れません。少な
くとも、おれが読んだら、これ書いたやつは(ちゃんと読まなければ)ばかじゃないかと感じる
かも(特にパート2と4)。ある意味、そう読まれたら、それはそれで成功だし、そこで、なぜ、
これを書いたやつはばかだと感じるのか自答できれば、それは良いことだし、そうでなく、そこ
から何かしらの教訓なり考え方なりを得られれば、もちろん、それこそ望むところです。それで
も、考察しているのはおれだけど、必ずしもおれがその事象に賛同しているわけではないという
のは読めるようには書いているつもりだけど。

(略)

それから、Go to statement considered harmfulと、MANAGING THE DEVELOPMENT OF LARGE 
SOFTWARE SYSTEMS。(これまたDRYの文脈からは訳がわからない参照のはずだと思うけど、どう
かなぁ)

→ http://www.cs.ubbcluj.ro/~adriana/FP/Requirements/dijkstra68goto.pdf
→ http://www.cs.umd.edu/class/spring2003/cmsc838p/Process/waterfall.pdf

少なくとも、ダイクストラの「GOTOステートメントは有害と考えられる」(ステートメントが付
いているのがすごく重要なんだけど、わかっているのかな?)については、俗流解釈が多くてう
んざり、というのもあるかも。これはプログラミング言語の設計に関する考察なんだけど、プロ
グラムの書き方についての説教だと受け取っている人がいるように感じることとか。現物を読ま
なければ、そう思うのはしょうがないけど。

(以下略)

これは楽しみだ。 大事なことなので2回目。

■_ おぶざいやー

http://www.python.org/ なんか 2008年の Programming Langugge of the Year にPythonが選ばれたとか何とか。 Programming Language of the Year - LinuxQuestions.org

Programming Language of the Year - LinuxQuestions.org
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the 
ability to post topics, receive our newsletter, use the advanced search, subscribe to 
threads and access many other special features. Registration is quick, simple and 
absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled 
once you log in.

Are you new to LinuxQuestions.org? Visit the following links:

Site Howto | Site FAQ | Sitemap | Register Now

If you have any problems with the registration process or your account login, please 
contact us. If you need to reset your password, click here. 

投票でか。まあそれはそれで。

言語名得票数
PHP11513.36%
Perl728.36%
Python22626.25%
Ruby465.34%
C11413.24%
C++12914.98%
Java10612.31%
Lisp91.05%
Erlang40.46%
Smalltalk10.12%
Haskell111.28%
C#192.21%
Lua40.46%
COBOL30.35%
Scheme20.23%
OCaml00%

元記事のページではグラフになってますがそこはそれ。

■_ ラウンドトリップ

mb_check_encodingは何をチェックするのか(その1 SJIS編) - hnwの日記
t_komura 2009/02/15 19:52
歴史的経緯というのはよく分かりませんが、
mb_check_encoding( "\x81\x3A", "SJIS" )
が true になるのはおそらくバグです。
PHP のソースコード ext/mbstring/libmbfl/filters/mbfilter_sjis.c の 170行目あたりの
Shift_JIS の2バイト目の判定が以下のようになっています。

if (c > 0x39 && c < 0xfd && c != 0x7f) {
...
}

0x39 の部分が 0x3f の間違いのように思います(mbfilter_cp932.c も同様でした)。
また、0x82 0x3A と 0x82 0x3F が false になるのは偶然のようです。

あと、mb_check_encoding() が重複文字を不正とみなしているというよりは、実装の問題のような気がします。

mb_check_encoding() は文字列を一旦ユニコードに変換してから、第2引数の文字エンコーディ
ングに逆変換し、元の文字列と同じバイト列になっているかで true/false を判定しています。
このため、ユニコードに変換した後、元のエンコーディングに戻した時にバイト列が変化する場
合は false と判定されてしまいます。

例として、0x8790(≒)の場合だと、ユニコード変換で U+2252 になり、再度 SJIS-win に戻すと 
0x81e0 になるため、false となります。

個人的には、文字列が文字エンコーディングの有効範囲に入っているかどうかをチェックするだ
けで良いと思うのですが、現在はそのような実装にはなっていません。そのようなチェックを行
いたい場合は、正規表現でチェックした方が良いと思います。

hnw 2009/02/15 20:54
なるほど、私もバグだろうとは思っていたのですが、動きが不規則に見えたので何か意味がある
のかと考えてしまいました。ソースを見ると確かにバグっぽいですね。

重複文字の件についても理解できました。ありがとうございます。どうやらquick hackで解決す
るような話じゃなさそうですね。

範囲のバグはfixされたのかな? php.cvs: cvs: php-src(PHP_5_2) / NEWS /ext/mbstring/libmbfl/filters mbfilter_cp932.c mbfilter_sjis.c もうひとつの方は、ラウンドトリップ問題(でいいんだっけ?)なので、 基本的にはどうしようもないのかな。 エンコーディングの有効範囲に入っていれば、という意見があるけれども それはサポートする全てのエンコーディングに対してその情報を持たないといけない (少なくとも建前上は)し、 OSに問い合わせてそういった範囲の情報を取れる一般的な手段があるかというと これも多分ないと思う(あったらすまん)。 Windowsでは先頭の1バイトの範囲だけは取れるAPIがあるけどね。 ただこれも「コードページ」で問い合わせるので面倒っちゃ面倒。

きっと i18n のえらいひとが補足してくれる…といいなあ。

■_

Schrade.Blog : Living In A Post Rails World
Living In A Post Rails World 11

Posted by Kurt Schrader Sat, 14 Feb 2009 11:50:00 GMT

    The hardest thing to see is what is in front of your eyes. -Goethe

It's been about 6 or 7 months since I've done any Rails work.

I'm in a post-Rails world.
僕は今、「Rails 後の世界」(post-Rails world) にいる。

After working in Rails for 3 years, I was burnt out. I took some time off to try to 
learn the finer points of marketing and running a business, and then attempted to 
start a new business just before the market cratered. Not a great idea.
三年ばかり Rails を使って仕事をしてきて、僕は燃え尽きた (I was burnt out)。
I took some time off to try to 
finer points of marketing と running a business とを学び
市場が形成される直前に新しいビジネスを始めようと企んだのだった。
大したアイデアではなかった。


Now I'm back writing code all day and it's great. My days now consist of coming up 
with test cases to solve problems and then solving them.
今、僕はコード書きの日々に戻ってきていてそしてそれはとても great だ。
テストケースとともにやってくる問題を解決するための日々で、その問題を解決している。

Something is different though.
でも何かが違うんだ。

I used to write a ton of test cases in the context of my Rails apps.
僕はかつて、自分のRails アプリケーションの context で山ほどのテストケースを
書いていた。

Now I write high level test cases and then write code and pick and choose technologies 
to solve them.
今僕はhigh level なテストケースを書き、それからコードを書いて
問題を解決するための技術を取り上げて選択するということをしている。

I feel like this is a natural progression for those of us that practice TDD.
これがテスト駆動開発 (TDD) を実践するための
自然な手順 (natural progression) じゃないかと僕は感じている。

Take one more step back, use something at an even higher level to write tests (I'm 
using some Cucumber and some rSpec), and then implement a bunch of little apps to make 
what you want to happen, happen.
もう一歩戻ってみると、
高レベルな所にあってさえテストケースを書くために何かを使い
(僕はsome Cucumber and some rSpec を使っている)、
そして you want to happen, happen
のために小さなアプリをたくさん実装する (implement a bunch of little apps)。

It keeps things simple, and keeps the problem from growing too large.
それはものごとを単純にし続けることであり、問題が大きくなり過ぎないように
し続けるということだ。

In my current project I've got a cluster of Nanite agents up and running with a couple 
of Merb apps talking to them on the front end. It's something that I never could have 
done if I was trapped inside of the Rails box.
自分の現在のプロジェクトで僕はNanite エージェントのクラスターと直面し、
それらのエージェントと対話するフロントエンドとしての
Merb アプリを幾つか実行するといったことをしている。
それは僕がRails boxの中に囚われたままであったなら決して経験することのなかったなにかだ。

Hell, it's probably something that I never even would have thought of.

I think that the Ruby world is eventually going to end up in a model like this, 
writing small simple apps that all talk to each other, and can be replaced or upgraded 
at any time.
僕は、Ruby 世界そのものがこのモデルのような所を目指していっているのだと考えている。
いつでも置き換えたりアップグレードできるような
小さくて、単純でお互いがやり取りするようなアプリケーションを書く。
そんなものに。

By writing a lot of tiny apps, I've been able to solve problems now in days that used 
to take weeks or months.
数多くの小さなアプリを書くことで、
僕は今数週間から数ヶ月の期間で問題を解決できるようになっている

Plus I'm not getting locked in to anything. If I want to replace my Merb app with a 
Sinatra app next month, it's not a huge project. If I want to swap in some code 
running on the Maglev Alpha that I'm playing with or deploy some components written in 
Clojure, I can do that too, without being intimately tied to anything.
それに加えて、僕はなにものにもロックされていない。
もし僕の Merbアプリを Sinatra アプリに来月リプレースしたいとしたら
それは大掛かりなプロジェクトにはならない。
もし僕が Maglev Alpha 上で動いているなんらかのコードを
あるいはClojure で書かれた何かのコンポーネントを deploy したいとして、
I can do that too, without being intimately tied to anything.

All of my hard/long running logic is well tested, encapsulated, and most likely 
running in little agents on the wire.
僕が実行しているロジックというのは、十分テストされていて、
カプセルに閉じ込められたwire の上の小さなエージェントのようなものだ。

I guess what I'm saying is that if you've been writing Rails code for a long time, 
perhaps now is a good time to step outside of the rules that Rails imposes upon you 
and look at things from a different angle.

Rails がキミに impose しているルールの外側に出てみる良いチャンスであり、
また、異なる視点から物事を見るいい機会になるだろうと思う。

You might find it refreshing and helpful.

I certainly did.

■_


推薦図書/必読書のためのスレッド 45 
98 デフォルトの名無しさん [sage] Date:2009/02/16(月) 00:45:01  ID: Be:
    案外 C++ で始めるのが流行るかもしれないぞ
    Stroustrup のプログラミング本、翔泳社で和訳中らしい 

まじっすか? はやいとこ読み進めないと(^^;



スレを勃てるまでもないC/C++の質問はここで 7 
678 デフォルトの名無しさん [] Date:2009/02/16(月) 10:22:58  ID: Be:
    日本語の配列の作り方がわからないのでお教え願います。
    たとえば
    はる、あき、なつ、ふゆ、さくら
    というひらがなの配列を作りたいとき
    char [6][7] = {"はる","あき","なつ","ふゆ","さくら"};
    と宣言しているのですがgccでコンパイルしたときに
    warning: initializer-string for array of chars is too long
    という警告が出てしまいます。
    どのようにすれば良いのでしょうか? 

679 678 [] Date:2009/02/16(月) 10:24:03  ID: Be:
    sed 's/char /char foo/' 678
    でお願いします。 

680 デフォルトの名無しさん [sage] Date:2009/02/16(月) 10:39:41  ID: Be:
    >>678
    ソースの文字コードがUTF-8になってない?
    "さくら"はUTF-8だと末端のヌル文字を含めて10バイトだよ。 

681 678 [] Date:2009/02/16(月) 10:42:45  ID: Be:
    >>680
    ありがとう御座います。
    実は例題用にだした適当な配列だったのでできれば
    UTF-8でのバイト数の計算方法を教えて頂けると幸いです。

682 678 [] Date:2009/02/16(月) 10:45:33  ID: Be:
    自決しました。
    一文字が3または4バイトなんですね.

683 デフォルトの名無しさん [sage] Date:2009/02/16(月) 11:12:45  ID: Be:
    自決しちゃったのかよ! 

684 デフォルトの名無しさん [sage] Date:2009/02/16(月) 15:14:10  ID: Be:
    自決フイタwwww 

2009年02月15日

■_

・にょろーん
ちゅるやさん視聴。

・忘れた
なんか書こうと思ってたことがあったんだけど、風呂入ってくつろいでいる間に忘れたっぽいw

・例の本
2の方もあわせてみているところなんですが、1でこれはと思ったところの フォローが2で入ってたりするものの、そのフォローの内容も微妙だったり。 まあぼちぼち書きます。 disる気はあまりありませんが、ちょっと残念な出来。

■_

昨日アサマシ貼っといた本をもうちょっと詳しく。 紀伊国屋書店にあった本の紹介と目次(の一部)と、目次の足りない分を手打ちで。



数と計算の歩み: 紀伊國屋書店BookWeb詳細

有史以前から今日のサイバー社会に至るまで、人類は数と計算に関してどのような工夫を重ねて
きたか、またそれらをどのように役立ててきたかを平易に記述。
テーマ毎にまとめた30章を、年代順に配列している。
各章の終わりに演習問題を用意し、すべての演習問題の解答を巻末につけた。

数えることの始まり
数字と位取りによる数の表示
有理数と無理数
素数
ユークリッドのアルゴリズム
ディオファンタスの「算術」
古代暗号
そろばん
フィボナッチの計算書
小数記法と対数〔ほか〕

上の小数記法と対数が第10章で、全部で30章まであるので11章以降を

計算機械
 初期の計算器
 ジャカード織機
 バベッジの計算機械
 ホラーリスの表作成機

代数方程式の解法

実数と複素数
 実数の連続性
 複素数

集合の濃度

ブール代数とその応用

計算可能性
 ゲーデルの不完全性定理
 チューリング機械
 チャーチ・チューリングの定立

中世から近代までの暗号
 多アルファベット換字式暗号
 エニグマ暗号機
 エニグマの暗号
 パープル暗号

電子計算機
 ENIACの誕生
 プログラム内蔵の電子計算機

数値計算と数値解析

剰余計算の世界

情報理論
 シャノンの情報理論
 情報の符号化

符号理論
 パリティチェック
 代数的符号

オートマトンと言語
 自動機械
 計算モデルとしてのオートマトン
 形式言語

人工知能
 チューリングの知能機械
 ダートマス会議
 チェスプログラム
 計算器制御のロボット
 人工知能の発展

プログラミング言語
 機械語とアセンブリ言語
 手続き型プログラミング言語
 関数型プログラミング言語
 論理型プログラミング言語
 オブジェクト指向プログラミング言語

アルゴリズムと計算量

計算機アルゴリズムの設計
 ソーティング・探索
 グラフアルゴリズム
 データ構造
 確率的アルゴリズム

並列・分散計算
 並列計算機
 並列アルゴリズム
 分散アルゴリズム

計算機ネットワーク
 パケット交換網
 インターネットへの発展
 ワールド・ワイド・ウェブ
 ユビキタス計算

公開鍵暗号
 公開鍵誕生までの背景
 公開鍵誕生
 RSA暗号
 デジタル署名
 隠蔽されていた公開鍵暗号
 量子計算

本のタイトルで検索しても上位に出てこなかったのだけど、 出版社名でぐぐるとちゃんと出版社のページもあった。 牧野書店本文ページ とはいえ2009年の情報がまだなかったりする? 過去の情報科学関連の出版物を見ても結構面白そうなものを出しているみたいだからがんばって欲しい。

■_



Lisp Scheme Part25 
274 デフォルトの名無しさん [] Date:2009/02/14(土) 18:38:38  ID: Be:
    Seasoned Schemer ってどうですか? 

275 デフォルトの名無しさん [] Date:2009/02/14(土) 18:39:22  ID: Be:
    Let Over the Lambda ってどうですか? 

276 デフォルトの名無しさん [sage] Date:2009/02/14(土) 22:52:52  ID: Be:
    海は死にますか? 

277 デフォルトの名無しさん [sage] Date:2009/02/14(土) 23:11:19  ID: Be:
    nilもそうですか? 

278 デフォルトの名無しさん [sage] Date:2009/02/14(土) 23:18:17  ID: Be:
    水曜どうですか? 

279 デフォルトの名無しさん [sage] Date:2009/02/15(日) 00:06:17  ID: Be:
    明日来てくれるかな? 

280 デフォルトの名無しさん [sage] Date:2009/02/15(日) 00:43:26  ID: Be:
    このスレのネタの応酬はハイレベル過ぎて 

281 デフォルトの名無しさん [sage] Date:2009/02/15(日) 00:50:07  ID: Be:
    終いますか~? 

282 デフォルトの名無しさん [sage] Date:2009/02/15(日) 00:58:25  ID: Be:
    括弧の山を愛する連中の嗜好が平凡なわけがなかった・・・・ 

283 デフォルトの名無しさん [sage] Date:2009/02/15(日) 01:02:23  ID: Be:
    別に愛してるわけじゃないけど、無いと不安になるというか不安定に感じる。 

284 デフォルトの名無しさん [sage] Date:2009/02/15(日) 01:44:31  ID: Be:
    十分平凡でないです! 

Let Over Lambda なつたんから借りそこなったんだよな。 今調べたら5000円しないし買うか?
Let Over Lambda



英語は、訳さずに読もう with 英英辞典 
80 デフォルトの名無しさん [sage] Date:2009/02/15(日) 12:59:41  ID: Be:
    文法がわからないのと、単語の意味がわからないのでは
    「わからない」の種類が違うよな。当たり前だけど

    でも単語の意味さえ知っていれば、文法とか細かく分析しなくても
    文章として書かれていることは何となくのレベルでわかる気がする 

簡単な「単語」を組み合わせた「イディオム」でいっっつも苦労するんですが 80はそんな経験ないのかなあ。 それもふくめて「単語」って表現をしているのかもしれないけど


推薦図書/必読書のためのスレッド 44 
924 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:35:29  ID: Be:
    ピアソンはもう少し頻繁に版を更新して欲しいと思わない?
    Accelerated C++は本国では第4版くらいだったと思ったけど
    相変わらず第1版でバグだらけっすよ…。
    (一番気になったのはデストラクタをバーチャルにしてない) 

925 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:36:55  ID: Be:
    デストラクタをバーチャルにしなくてもいい場合もあるからだろ 

926 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:41:46  ID: Be:
    多くはない。 

927 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:42:31  ID: Be:
    そうでもない。
    しかし、そういう場合でも癖でvirtualつけちゃう。 

928 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:47:25  ID: Be:
    デストラクタにvirtual付けないのはバグの元になるだけだろ。 付けなさい。

    virtualを付けないべき状況ってどんなときよ?

929 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:50:24  ID: Be:
    継承しないとき 

930 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:51:00  ID: Be:
    どうしてもサイズケチりたいとき 

931 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:51:47  ID: Be:
    facade クラスは大抵不要 

932 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:52:18  ID: Be:
    C++から離れて久しいのだが、(ソース上)継承されないことを
    保障できる手段あるんだっけ? Javaのfinal Classみたいな。

933 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:52:46  ID: Be:
    >>929はだけ的外れ 

934 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:55:42  ID: Be:
    >>932
    無いね 

935 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:55:42  ID: Be:
    そうでもない 

936 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:56:00  ID: Be:
    >>925
    ありゃ、説明が足りなかったかな。

    >相変わらず第1版でバグだらけっすよ…。

    「バグとして」バーチャルにしてないっていう意味で
    まさに、基底クラスのデストラクタをバーチャルにし忘れてる。
    ついでに private にしちゃってる。p.276
    (もしくは protected 非仮想にするべき)

    もちろん、本書は仮想デストラクタなる項があるくらいだから
    どういう場合にデストラクタをバーチャルにしなくちゃいけないかは
    ちゃんと論じられてる。

    最初の話に戻って、後の版では直されているので、
    日本語版もちゃんと版を更新して欲しいなってこと。 

940 デフォルトの名無しさん [sage] Date:2009/02/13(金) 00:01:49  ID: Be:
    >>932
    コンストラクタを private にすることで、
    継承できなくさせることは可能と言えば可能。
    必ず new しないといけないんで微妙だが。

    class A {
    public:
     static A* create() { return new A; }
     static A* create(const A* a) { return new A(*a); }
    private:
     A();
     A(const A&\1);
    }; 

941 デフォルトの名無しさん [sage] Date:2009/02/13(金) 00:06:17  ID: Be:
    >>940
    実際にそれやるときはシングルトンやるときくらいか?

    やっぱjavaみたくfinal修飾子欲しいよなぁ。 

943 デフォルトの名無しさん [sage] Date:2009/02/13(金) 00:07:12  ID: Be:
    >>941
    シングルトンならインスタンス1個でいいから
    static ローカル変数にしちゃって new しなくて済むね。 

948 デフォルトの名無しさん [sage] Date:2009/02/13(金) 00:53:31  ID: Be:
    継承を禁止して、具象クラスとして使って欲しい時はデストラクタを
    virtualにしないのが当たり前だと思っていた
    どこかの本にデストラクタは絶対virtualにしなさいとでも書いてあるのか?
    いや、文句をつけてくる人が時々いるんで 

949 デフォルトの名無しさん [sage] Date:2009/02/13(金) 00:56:24  ID: Be:
    つまり、英語もできないやつはカスプログラマである、と。orz 

950 デフォルトの名無しさん [sage] Date:2009/02/13(金) 00:57:02  ID: Be:
    >>948
    あまり浸透してないからじゃない?

    と言う俺も知らなかったしw

    どの本に載ってる? 

951 デフォルトの名無しさん [sage] Date:2009/02/13(金) 01:01:08  ID: Be:
    継承する可能性がないのに、デストラクタをvirtualにするなんてどこの馬鹿だよ。 

952 デフォルトの名無しさん [sage] Date:2009/02/13(金) 01:07:20  ID: Be:
    >> 950
    ぱっとみeffective C++には載ってた
    他でも見たような気がする

    >> 951
    933とか
    まあ、俺は馬鹿とは思わないけどこっちのメッセージは受け取って欲しいぜw 

953 デフォルトの名無しさん [sage] Date:2009/02/13(金) 01:08:01  ID: Be:
    >>951
    継承する可能性が0だと言い切れるならいいんじゃない? 0なら。

954 デフォルトの名無しさん [sage] Date:2009/02/13(金) 01:14:14  ID: Be:
    つか、継承するかどうかは利用者側の問題じゃないのかい?
    C++は明確に継承を禁止する術はないんだから
    設計者は「継承しないでねナムナム」くらいの気持ちでいいんじゃないか、と。

    利用者側の問題についてはハーブサッターもスコットメイヤーズもはっきり書いてるね。
    基底クラスとして意図されていないクラスを継承するな(合成を使え)って。 

956 デフォルトの名無しさん [sage] Date:2009/02/13(金) 01:21:48  ID: Be:
    >>954
    まあそうなんだが、virtualになってないので継承できない!!!!!!!!!11111
    といわれるとちょっと萎える 

957 デフォルトの名無しさん [sage] Date:2009/02/13(金) 02:19:49  ID: Be:
    そのクラスの使い方を決めるのは、クラスの設計者だろ。
    可能性とか、利用者の問題とか言ってる奴はプログラマに
    向いてないから、今すぐ廃業しろ。 

958 デフォルトの名無しさん [sage] Date:2009/02/13(金) 02:41:26  ID: Be:
    だから、C++の仕様上、無理なんだって。
    おまえこそ、ハーブサッターやスコットメイヤーズの本読んでこいよw 

963 デフォルトの名無しさん [sage] Date:2009/02/13(金) 07:29:52  ID: Be:
    仮想デストラクタでない vector や string を継承したがる人は後を絶たないのを見ると、
    ユーザが信用できないという意見は分からなくもない。 

965 デフォルトの名無しさん [sage] Date:2009/02/13(金) 07:33:40  ID: Be:
    new して基底クラスへのポインタに入れて
    そのまま delete する機会が0なら、
    継承する事自体は問題ない。
    だが、これこそ使っちゃう人が現れると恐いんだな。 

967 デフォルトの名無しさん [sage] Date:2009/02/13(金) 11:22:28  ID: Be:
    Exceptional C++ や Effective C++、C++ Coding Standards では
    継承を利用者の問題として扱っているな

    「利用者の問題とか言ってる奴はプログラマに向いてないから、今すぐ廃業しろ」
    というなら、ハーブもスコットも廃業だw 

969 デフォルトの名無しさん [sage] Date:2009/02/13(金) 13:01:33  ID: Be:
    みんなC++大好きなんだな… 

970 デフォルトの名無しさん [sage] Date:2009/02/13(金) 13:11:42  ID: Be:
    全部俺の自作自演 

975 デフォルトの名無しさん [sage] Date:2009/02/13(金) 20:16:33  ID: Be:
    >>928
    >virtualを付けないべき状況ってどんなときよ?
    お前らこの話してたわけじゃないのか?

    「付けないべき状況」だぞ?

    付けなくてもいい、じゃない。 付けちゃ駄目なときだ。

    反論できなかったら以後この話はここですんな。 開いたスレ間違えたと思った。 

976 デフォルトの名無しさん [sage] Date:2009/02/13(金) 20:18:19  ID: Be:
    ないべき の違和感は異常 

977 デフォルトの名無しさん [sage] Date:2009/02/13(金) 20:26:40  ID: Be:
    付けざるべき状況、だな。 

984 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:07:22  ID: Be:
    一言で言えば>>928の一人相撲

    禁止はない。つけないほうがいい時しかない。
    C++ Coding Standards と Effective C++ で
    継承におけるデストラクタを非仮想( protected 非仮想)にするべき
    積極的理由について論じている。

    もちろん、そのくらいは読んで発言しているだろうけど。
    もし読んでなかったら首くくって死ぬしか・・・

985 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:11:54  ID: Be:
    Effective C++
    Effective STL
    C++ Cording Standards
    C++やるならこの3冊は必読。同僚で読んでないやつ多すぎ・・・ 

986 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:25:47  ID: Be:
    >>984
    マジレスすると、付けてはいけない時はある。
    例えば MFC の CPoint には付けてはいけない。
    CDC::PolyDraw の実装などに困るからだ。 

987 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:28:32  ID: Be:
    CPointはPOINTとの互換性が要求されてるから
    互換性を満たすには仮想デストラクタはどうしても作れないね。 

C++はすぐに濃い話になるなあ

xyzzy Part16
229 名無し~3.EXE [sage] Date:2009/02/15(日) 00:41:36 ID:xX2c5sxB Be:
    今、xyzzyのソースをチラ見しましたが、普通ソースに対するコメントって
    あんな感じなんですか?ほとんどなかったように感じましたが・・・

    仕事では、大体1行ごとに何かしらのコメントを入れていますし、
    他のみなさんも大体1行ごとにコメントを入れています。
    仕事は組込み関係です(ECUのファームウェアを作ってます)

    みなさんも、コメントはほとんど書かない派ですかね・・・? 

230 名無し~3.EXE [sage] Date:2009/02/15(日) 01:18:13 ID:ijSWB/oG Be:
    別に仕事でやってるわけじゃないんだから作者の自由じゃない?

    仕事なら20%~40%くらいはコメント入れてほしいなぁ。

231 名無し~3.EXE [sage] Date:2009/02/15(日) 01:26:20 ID:i2p8Fgrp Be:
    オープンソースを念頭に置いてたわけじゃないだろうしな。公開してたのも単に善意だっただけだろうし。 

232 名無し~3.EXE [] Date:2009/02/15(日) 02:33:08 ID:BeDp5XLt Be:
    一行ごとにコメントなんてアセンブリ言語でもなきゃやらんだろう。
    大体そんなに何をか書くんだ?

    関数の直前にその関数の大まかな機能の説明と、込み入った部分に解説くらいでいいしょ。 

233 名無し~3.EXE [sage] Date:2009/02/15(日) 02:42:43 ID:/HC2Zb8l Be:
    俺も大体一行ごとってのは多すぎると思う
    コードそのものの説明はするなって教わったけど、違うところも多いのかな
    自分だけでC++の時だと、Google C++ Style Guideで書くように今はしてる 

234 名無し~3.EXE [sage for使えという突っ込みは無しで] Date:2009/02/15(日) 04:23:31 ID:vP0ofuqG Be:
    一行ごととか正気の沙汰とは思えないな。
    まさかこんなんじゃないよね。

    // エントリーポイント。ここから始まる
    int main(){
      // 変数iを0で初期化
      int i=0;
      // iが256より小さい間、ループ
      while(i<256){
        // iを表示
        printf("%d\n",i);
        // iを1増やす
        ++i;
      // ループここまで
      }
      // 0を返す
      return 0;
    }// おわり

    書かないほうがマシ。
    普通はせいぜいこれくらい?
    int main(){
      int i=0; // ループ用変数
      // 0から255まで表示
      while(i<256){
        printf("%d\n",i);
        ++i;
      }
      // 正常終了(0)
      return 0;
    }

C/C++ (xyzzyはC++で書かれている)で一行ごとにコメント入れろって?

■_

後で読む

λ Tony's blog λ ≫ Blog Archive ≫ Funky Scala Bifunctor
http://blog.tmorris.net/funky-scala-bifunctor/

Fun with Folds - Matthew Podwysocki
http://codebetter.com/blogs/matthew.podwysocki/archive/2009/02/14/fun-with-folds.aspx

日本Rubyの会 公式Wiki - Ruby1.9.1NEWS日本語訳
http://jp.rubyist.net/?Ruby1.9.1NEWS%C6%FC%CB%DC%B8%EC%CC%F5

Unix's Magical Moment, as Foretold by Tom Christiansen - O'Reilly Broadcast
http://broadcast.oreilly.com/2009/02/unixs-magical-moment-as-foreto.html

Rants, Raves and Ridicule: How should traits in Scala be used?
http://suereth.blogspot.com/2009/02/how-should-traits-in-scala-be-used.html

PLT Scheme Blog: New Contract-Related Features
http://blog.plt-scheme.org/2009/02/new-contract-related-features.html

Who can write the smallest/tidiest/cleverest Morse Code translator? Challenge! : programming
http://www.reddit.com/r/programming/comments/7xjqb/who_can_write_the_smallesttidiestcleverest_morse/

A Neighborhood of Infinity: Beyond Monads
http://blog.sigfpe.com/2009/02/beyond-monads.html

WITCH rpointy / Perl 6
http://www.perlfoundation.org/perl6/index.cgi?witch_rpointy

WITCH lpointy / Perl 6
http://www.perlfoundation.org/perl6/index.cgi?witch_lpointy

WITCH littleo / Perl 6
http://www.perlfoundation.org/perl6/index.cgi?witch_littleo

2009年02月14日

■_

・ONE OUTS
自分が好きだと以前書いたエピソードが掲載されているのが13巻だというのを 確認して13巻を追加で購入。
ONE OUTS 13 (13) (ヤングジャンプコミックス)
甲斐谷 忍
4088767470

なんだよこの巻だけ書影なしかい

・今日のオススメ

数と計算の歩み
200ページちょっとで細部にいたるまで掘り下げてという本ではありませんが、 古代からコンピューターが登場して以後まで、 そろばんやブール代数、情報理論、公開鍵暗号等々 この分野の入門者には良いんじゃないかと思います。 RSAより前に公開鍵暗号の開発にいたった人たちが存在していたとは知らなかった (暗号は最近まで国家機密扱いな部分もあった)。

・APL
まつもとさんの講演でAPLがどうとか言う話が出たみたいだけど、 APLのあの記号ってUnicode (4.0とか5.0)に全部入っているのかなあ? YouTube - Conway's Game Of Life in APL

■_ cygwin

実験段階とはいえどのくらいのものか試してみたいな。



[1.7] Updated: cygwin-1.7.0-40
====================================================================
THIS IS STILL A TEST RELEASE.  DON'T USE IN PRODUCTION ENVIRONMENTS.
====================================================================

What's new in contrast to 1.7.0-39:
===================================

- New Linux-like virtual files /proc/$PID/mounts, /proc/mounts.  The
  base-cygwin package now creates a /etc/mtab entry which is a symlink
  to /proc/mounts.

- The code which produces default ACL entries for directories has been
  disabled.  They are not necessary and actually a non-POSIXism only
  marginally useful for native Win32 applications.  So far you could see
  them by the fact that `ls -ld dir' always showed a trailing '+' in the
  permission entry.

- Export wcstok().


- PATH_MAX is now 4096.  Internally, path names can be as long as the
  underlying OS can handle (32K).
  
- UTF-8 filenames are supported now.  So far, this requires to set
  the environment variable CYGWIN to contain "codepage:utf8". but this
  will likely disappear at one point.  The setting of $LANG or $LC_CTYPE
  will be used instead.

- Detect when a stdin/stdout which looks like a pipe is really a tty.
  Among other things, this allows a debugged application to recognize that
  it is using the same tty as the debugger.

- Support UTF-8 in console window.

- New APIs: asnprintf, dprintf, _Exit, vasnprintf, vdprintf, confstr,
  posix_madvise, posix_memalign, exp10, exp10f, pow10, pow10f, lrint,
  lrintf, rint, rintf, llrint, llrintf, llrintl, lrintl, rintl, insque,
  remque, sys_sigabbrev, strcasestr, stpcpy, stpncpy, wcpcpy, wcpncpy,
  wcstok, wcstol, wcstoll, wcstoul, wcstoull, wcsxfrm, cfmakeraw, fgetwc,
  fgetws, fputwc, fputws, fwide, getwc, getwchar, putwc, putwchar, ungetwc.


wide character 関連が結構あるな。 多少なりともまともに動くようになったのか? asnprintfねえ。dprintf ってFILE* じゃなく file discriptor を取るやつだっけ?

■_ 本日のム板より

推薦図書/必読書のためのスレッド 44 
994 デフォルトの名無しさん [sage] Date:2009/02/13(金) 23:53:50  ID: Be:
    暇つぶしにC++の勉強をしようと思い、明日本屋さんへ行くつもりなのですが、
    C++プライマーとロベールのC++を買ったら有意義な週末にできますか 

995 デフォルトの名無しさん [sage] Date:2009/02/13(金) 23:56:09  ID: Be:
    少なくともダンベルの代わりにはなるぞ 

996 デフォルトの名無しさん [sage] Date:2009/02/14(土) 00:03:41  ID: Be:
    有意義な週末になるかもしれないが、
    多分週末だけじゃ読み終わらんぞw 

997 デフォルトの名無しさん [sage] Date:2009/02/14(土) 01:10:51  ID: Be:
    これならわかるを一気に読むのがお勧め 

998 デフォルトの名無しさん [sage] Date:2009/02/14(土) 01:17:49  ID: Be:
    1000なら高橋麻奈のやさしいシリーズ完全制覇 

999 デフォルトの名無しさん [sage] Date:2009/02/14(土) 01:19:41  ID: Be:
    うめこ 

1000 デフォルトの名無しさん [sage] Date:2009/02/14(土) 01:20:23  ID: Be:
    じゃあ、俺、夏帆と結婚するわ 

1001 1001 [] Date:Over 1000 Thread ID: Be:
    このスレッドは1000を超えました。
    もう書けないので、新しいスレッドを立ててくださいです。。。 

誰? 夏帆って。

【Perl,PHP】LLバトルロワイヤル3【Ruby,Python】
963 デフォルトの名無しさん [sage] Date:2009/02/14(土) 17:57:06  ID: Be:
    LLの定義がよく分からないからなぁ。
    tclもLLで良いのか? 

964 デフォルトの名無しさん [sage] Date:2009/02/14(土) 18:15:34  ID: Be:
    PHPが言語の仲間に入れてもらえるのなら、TclはLLでもいいんじゃない? 

965 デフォルトの名無しさん [sage] Date:2009/02/14(土) 18:52:13  ID: Be:
    とりあえず >>546からの議論が全く活かされていないのはよくわかった。
    まあこのスレってそんなも(ry

    でもよそに派生してこんなのあったのを見つけた
    ttp://d.hatena.ne.jp/minekoa/20090122/1232634141

    Matzの定義が元になってるのかな?知らんかった 

966 デフォルトの名無しさん [sage] Date:2009/02/14(土) 19:01:42  ID: Be:
    つまり(matzに言わせると)「抽象度が高く」「記述が簡潔である」
    もっと言うならモダンな言語だと
    まあ、どのみち厳密な定義のある用語ではないってことか 

967 デフォルトの名無しさん [sage] Date:2009/02/14(土) 19:38:23  ID: Be:
    >>963
    ラリー、Matz、spamの人などによって作られた3つの宗教。
    (そう思っているヤツは、世の中に少なくとも1人は存在する)
    まずまずよく出来ているPHPは、その教義が不明確であり、
    より一層できは良いのに見過ごされたか、人気を失いかけている他宗派の信者たちに
    ディスられる恰好の的となっている。
    tclに関していえば、末尾再帰の不在についてRMSの怒りを買ったので
    オープンソース界隈にて、標準になるといった野望を打ち砕かれた。
    その後任に、guileが置かれたことは、
    今日に数多のスクリプト言語が生み出されることとなった元凶であろう。
    既に標準の座につくことのなくなったtclは、LLに含まれていない。
    若い衆たちの興味を引かないからだ。

    これらのLLは規格化されておらず、
    書いてしまったものが数年後にも動く保証がされていないため、
    今だにC,C++,shのポストは安泰である。 

968 デフォルトの名無しさん [sage] Date:2009/02/14(土) 19:45:51  ID: Be:
    TCLはないだろ。
    あれはshと同じ系統の言語だから、
    大規模なアプリには向かない。 

969 デフォルトの名無しさん [sage] Date:2009/02/14(土) 19:47:47  ID: Be:
    >>968
    シムシティ作られてなかった? 

970 デフォルトの名無しさん [sage] Date:2009/02/14(土) 20:08:40  ID: Be:
    定義なんてどうでも良いだろ
    LL自体がどうでもいい言葉なのだから 

971 デフォルトの名無しさん [sage] Date:2009/02/14(土) 20:46:18  ID: Be:
    BtoBだCGMだSNSだ怪用語が乱れ飛ぶこんな世の中で、
    なぜそんなに「LL」を嫌がるのかがよくわからん 

972 デフォルトの名無しさん [sage] Date:2009/02/14(土) 20:57:57  ID: Be:
    LLではアジャイルにBPに最適化されたBIがCGMでorzされた形でSOAでき、
    まさにITによるクラウド時代のBiz2.0とでもいうべきパラダイムシフトといえよう。 

973 デフォルトの名無しさん [sage] Date:2009/02/14(土) 22:11:30  ID: Be:
    >>965
    定義したの Matzだったのか wwwww
    ワロタ

    >>972
    背中かゆくなってきた 

974 デフォルトの名無しさん [sage] Date:2009/02/14(土) 22:44:56  ID: Be:
    LLなんてバズワードの一種でしょ? 

975 デフォルトの名無しさん [sage] Date:2009/02/14(土) 23:19:12  ID: Be:
    振り出しに戻る 

spamの人て…

Rubyについて Part 34 
281 デフォルトの名無しさん [sage] Date:2009/02/14(土) 03:04:26  ID: Be:
    railsを一からじっくり勉強し直したいんだけど良い書籍が見つからない。

    ●RailsによるアジャイルWebアプリケーション開発 第2版
    これはいくら内容良くてもバージョンが1.2だから論外
    ●Railsレシピブック
    これは使い方は分かってもRailsの勉強にはならない…もっと実装の奥を知りたい
    ●実践Rails(オライリー)
    本屋で立ち読みしたけど、これは既にRailsを良く分かってる人が読む本だと思うので除外

    他にも色々見たけど見つからない。皆どうやって勉強してるの? 

282 デフォルトの名無しさん [sage] Date:2009/02/14(土) 05:10:59  ID: Be:
    >>281
    > もっと実装の奥を知りたい
    つ ソース

283 デフォルトの名無しさん [sage] Date:2009/02/14(土) 07:03:04  ID: Be:
    意味わからん。
    フレームワークは使ってナンボ。
    実装の中身を知る必要はない。 

284 デフォルトの名無しさん [sage] Date:2009/02/14(土) 07:16:14  ID: Be:
    >>283
    実装の奥と実装の中身の違いを説明してくれ 

285 デフォルトの名無しさん [sage] Date:2009/02/14(土) 07:52:15  ID: Be:
    つまらんこと聞くな。
    とにかく>>281は言っていることがおかしい。
    Railsの使い方を勉強してるヤツはゴマンといるが、
    実装を勉強してるヤツなんかいない。 

286 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:04:48  ID: Be:
    言い切ったw 

287 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:12:40  ID: Be:
    それこそ個人でソース読めソース読めないような人間は要らんで終了ではある
    研究してる人間がいないとは言わないが、他人向けに解説するような人がいるとは思えないし、
    Railsに限っては解説を受けたからってよりうまく使えるようになるとも思えねー 

288 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:39:54  ID: Be:
    実装を知りたいんじゃなく、実装のその奥を知りたいんだろ。
    つまり思想だな。
    Matzの啓蒙書でも呼んどけ。 

289 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:41:26  ID: Be:
    DHHじゃないの? 

290 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:41:49  ID: Be:
    Railsはまつもとゆきは無関係だな 

291 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:43:26  ID: Be:
    そうでした。 

292 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:44:14  ID: Be:
    >>290
    ホントは嫌いなんじゃないかと思うことはある 

293 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:45:19  ID: Be:
    >>292
    Rails を好きな Rubist なんていません!!! 

294 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:56:07  ID: Be:
    Railsのコピーを作りたいとか 

295 デフォルトの名無しさん [sage] Date:2009/02/14(土) 08:56:32  ID: Be:
    まあ、DSLの勉強をしたいのかなとはちょっと思った 

296 デフォルトの名無しさん [sage] Date:2009/02/14(土) 10:59:09  ID: Be:
    Ruby開発陣がほとんどRails使ってないのは常識。

297 デフォルトの名無しさん [sage] Date:2009/02/14(土) 11:41:04  ID: Be:
    ちょっとMatzに会ってくる 

298 デフォルトの名無しさん [sage] Date:2009/02/14(土) 11:42:32  ID: Be:
    いってらっしゃい 
Squeakでマターリ語りましょうや 
519 デフォルトの名無しさん [sage] Date:2009/02/10(火) 21:19:58  ID: Be:
    smalltalkerは一匹見かけると100人はいるんだぜ。 

Squeakでマターリ語りましょうや 
525 デフォルトの名無しさん [] Date:2009/02/12(木) 19:13:10  ID: Be:
    上で出てきたScratchというのもSamlltalkらしいですが、それでもSmalltalkの勉強できますか?

526 デフォルトの名無しさん [sage] Date:2009/02/12(木) 19:47:22  ID: Be:
    VWの非商用版がフリーだからそっちでやった方がいいんじゃないか? 

527 デフォルトの名無しさん [sage] Date:2009/02/12(木) 21:30:33  ID: Be:
    見てみたら最近更新してないみたいだけど
    もうsqueak自体は放置なの? 

528 デフォルトの名無しさん [sage] Date:2009/02/12(木) 22:16:02  ID: Be:
    >>525
    >>6の言う通りVisualWorksやったほうがいい。
    出来ることがまるで違うから。 

529 デフォルトの名無しさん [sage] Date:2009/02/12(木) 22:59:57  ID: Be:
    >>527
    どこですか?

    >>525
    Smalltalkで組まれているだけでScratch自体はSmalltalkではないです。
    似たような話でeToysというのもやはりSmalltalkではないです。

    Smalltalk処理系は、正統派のVisualWorks、機能は古いままでUIも特殊ですが
    ユーザーが多めのSqueak、Smalltalkにつきものの独自GUIが苦手な人向きの
    GNU Smalltalk、Win専用ですがIDEの完成度の高いDolphinなどがあります。

    GNU Smalltalkを除けば、どれから始めても他に応用が利くと思いますが
    身近の教えてくれる人か、使いたい教科書があればその人or文書が使っている
    処理系を選ぶのがベターです。>>523でも言われていますができるだけ
    バージョンも合わせた方がよいです。がんばってください。 

530 デフォルトの名無しさん [sage] Date:2009/02/12(木) 23:52:07  ID: Be:
    > 身近の教えてくれる人

    これがもっとも得難い。 

531 デフォルトの名無しさん [sage] Date:2009/02/13(金) 04:27:10  ID: Be:
    >>519
    日本にSmalltalkerが100人もいたら、もうちょっとマシな状況になっていると思われ。 

532 デフォルトの名無しさん [sage] Date:2009/02/13(金) 10:43:58  ID: Be:
    100人のSmalltalker村とかあったら嫌ですね。 

533 デフォルトの名無しさん [sage] Date:2009/02/13(金) 12:41:38  ID: Be:
    急に盛り上がり始めたな
    なんかあったのか?w 

534 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:10:19  ID: Be:
    ついに時代が来たとか。 

535 デフォルトの名無しさん [sage] Date:2009/02/14(土) 09:32:57  ID: Be:
    もう終わってるかと思ったわ 

536 デフォルトの名無しさん [sage] Date:2009/02/14(土) 10:49:57  ID: Be:
    馬鹿者。
    始まってもいない物が、終わったりせぬ。 

537 デフォルトの名無しさん [sage] Date:2009/02/14(土) 11:06:27  ID: Be:
    Lisp飽きた
    はやく始まってくれSmalltalk 

Lisp Scheme Part25
243 デフォルトの名無しさん [sage] Date:2009/02/13(金) 20:28:13  ID: Be:
    SICP未読で許されるのは小学生までだよね! 

244 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:31:02  ID: Be:
    ちょっと待ってくれ。「人生に必要な知恵はぜんぶ幼稚園の砂場で学んだ」とあるように、
    幼稚園のうちに読んでおくべきものではないだろうか? 

245 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:34:17  ID: Be:
    なんてこったい/(^o^)\ 

246 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:52:02  ID: Be:
    人生に必要な知恵はぜんぶサンドボックで学んだ。

247 デフォルトの名無しさん [sage] Date:2009/02/13(金) 22:55:25  ID: Be:
    俺、人生に必要な知恵はぜんぶ死後の世界で学ぶんだ… 

249 デフォルトの名無しさん [sage] Date:2009/02/13(金) 23:07:08  ID: Be:
    おれも人生に必要なことは幼稚園で一通り学んだ覚えがあるな 

252 デフォルトの名無しさん [sage] Date:2009/02/14(土) 00:48:59  ID: Be:
    SICP以外誇れるものはないのか 

253 デフォルトの名無しさん [sage] Date:2009/02/14(土) 00:54:55  ID: Be:
    essential of なんたらとかreasoned schemerとかもいいかも 

261 デフォルトの名無しさん [sage] Date:2009/02/14(土) 05:43:57  ID: Be:
    ()とか幼稚園じゃ習わなかった 

262 デフォルトの名無しさん [sage] Date:2009/02/14(土) 09:40:03  ID: Be:
    幼稚園の時、世の中はすべてnilだと習った。 

263 デフォルトの名無しさん [sage] Date:2009/02/14(土) 09:44:22  ID: Be:
    うちの幼稚園ではnil派と()派が闘争を繰り返していた。 

264 デフォルトの名無しさん [sage] Date:2009/02/14(土) 10:01:49  ID: Be:
    little schemerって幼稚園児でも理解できるように書かれたんだっけ 

265 デフォルトの名無しさん [sage] Date:2009/02/14(土) 11:41:33  ID: Be:
    誰が象のラムダ君役をするかで喧嘩になってみっちゃんが泣いた。 

266 デフォルトの名無しさん [sage] Date:2009/02/14(土) 11:43:25  ID: Be:
    ここは幼稚園で人生のすべてが再帰的だと悟ったみなさんが集まるスレですかね。 

267 デフォルトの名無しさん [sage] Date:2009/02/14(土) 11:45:16  ID: Be:
    継続渡しスタイルで幼稚園ドロップアウトした。 


ゲームプログラマの人に聞きたい 33問目
172 仕様書無しさん [sage] Date:2009/02/13(金) 22:16:09  ID: Be:
    プログラムって半分以上調べる時間だよな
    APIの使い方とか、環境とか 

173 仕様書無しさん [sage] Date:2009/02/13(金) 22:35:17  ID: Be:
    残り半分でバグ取りだよな 

え?

■_ ませまちか

日本でも変えるようにならんか喃>廉価版



Mathematica No Longer World's Most Expensive Calculator? : programming

I used Mathematica for over a decade, and I think it's an amazing work of mathematics, 
engineering, and software craft. About five years ago, however, I stopped using it 
because I was concerned about having too much of my life's work invested in a 
proprietary system. I soon discovered that open-source alternatives were good enough, 
and I haven't looked back since.

I still hold out hope that Mathematica will go open source one day. It's an amazing 
tool, and if everybody could use it -- without constraints, that is -- the benefit to 
society would be profound.

Until then, Mathematica will be doomed to realize only the smallest part of its 
potential, most of which lies in the long tail. Lowering the price to $300 allows 
Wolfram Research to reach into the long tail, but only an inch or two. If Wolfram 
really wants to change the world, he ought to set the price to $0.

Note to billionaires: If you want to give a long-lasting gift to humankind, (1) buy 
Wolfram Research, (2) open-source Mathematica, and (3) set up a foundation to fund 
continued work on Mathematica (which ain't cheap).

It could be rather difficult to buy Wolfram Research at any price, since it's not a 
publicly-traded company.


    If Wolfram really wants to change the world, he ought to set the price to $0.

.. and then this ...

    Note to billionaires: [...] (3) set up a foundation to fund continued work on 
    Mathematica (which ain't cheap).

Hint, hint, Mark Shuttleworth.
Even Shuttleworth will run dry at some point.

Shuttleworth needs urgent support from other open-source billionaires.

    I soon discovered that open-source alternatives were good enough, and I haven't 
    looked back since.

Mathematica is awesome (although I have difficulty getting to use it).

What open source system is 'good enough'? Maxima leaves a hell of a lot to be desired 
- it is miles away from Mathematica (or Maple).

It is surely better than nothing, but still.

■_

一人に絞れるわけねえw というのはおいといてこれは面白いな。

あなたが考える「コンピュータ界に最も貢献した人」は?
真実 (スコア: 0)
Anonymous Coward : 2009年02月13日 17時40分 (#1512901)

・ノイマンが報告したノイマン型コンピュータの発明者はモークリーとエッカート
・マイクロプロセッサの発明者はRay HoltとSteve Geller。軍用品なので長らく知られなかった。
  次いでTI TMS1000、i4004、シヤープ=NECのビルペット用チップ。いずれにしろ嶋は発明者ではない。
・スタック
> The stack method of expression evaluation was first proposed in 1955 and then patented
> in 1957 by early German computer scientist Friedrich L. Bauer, who received the IEEE
> Computer Society Pioneer Award in 1988 for his work on Computer Stacks. Apparently the
> same concept was introduced independently by the Australian scientist Charles Leonard Hamblin.
・バートランド・ラッセルの業績はほとんどコンピュータとは関係がない
・オブジェクト指向の最初の貢献者はダールとニゴール(ニガード)であるとIEEEおよびACMが認定している
・バベッジやツーゼは独創的な先駆者だったが後世に与えた影響となると微妙
・バグ
> こうした最初の虫を発見した人として、よく(誤って)挙げられるのが、グレース・ホッパーによる、
> Mark II および Mark III の中に入っている虫を発見したという逸話[2]だが、実際にはこれは誤り
> である。Mark II の中で虫を発見したのはホッパーではなく別の技術者であった。彼はすでに技術者
> 仲間で使われていた「バグ」という用語を知っており、コンピュータの中に本当に虫が見つかったと
> いう事実を面白がって「本物の『バグ』が発見された」と報告したのが真相のようである[3]。彼は
> リレーの間にはさまっていた虫(蛾の一種であった)を取り除き、それを作業日誌にテープで貼りつ
> けて「除バグ (de-bug) した」と書きつけた。こうして「デバッグ」という言葉が生まれた。この
> 日誌は米海軍歴史博物館に保管されている。
・インカの王様はみんな大好き
・チョムスキー
> ジョン・バッカスは ALGOLの文法を表現するためにこの記法を考案した。1959年、パリで世界初の
> 国際コンピュータ大会議(World Computer Congress)が開催された際、バッカスは "The
> syntax and semantics of the proposed international algebraic language of the Zurich
> ACM-GAMM Conference" を発表した。これは後にALGOL 58と呼ばれる IAL の形式記述であった。彼が発表した形式言語は、Emil Post の生成システムに基づいたものであった。形式文法は数学における研究課題のひとつであり、例えばノーム・チョムスキーは自然言語の文法への適用を研究していた[1] [2]。
・エミール・ポストは他にもあちこちで出てくるよ
・プログラムカウンタは少なくともマンチェスターBabyや後期ENIACには存在した
・LISPはFORTRANのライブラリとして作られた(Fortran List Processing Language)
・コッドは俺もコンピュータ史上最大の貢献者の一人だと思う。知名度低すぎ。

特にオブジェクト指向のやつ。 sumim さんに確認とりたいなあ。IEEEとACMが認定しているとかなんとか。

2009年02月13日

■_

・あー大変だなあ([お察しください])

・今日は本のチェックが進みませんでした
おかしいな。時間はそれなりにあったはずなんだが…

■_ Stack Overflowで訊いてみた: プログラミングに関するあなたの問題発言求む (What's your most controversial programming opinion?)

かなりボリュームがあるのでわたしの目に止まったのを幾つか。

What's your most controversial programming opinion? - Stack Overflow

This is definitely subjective, but I'd like to try to avoid it becoming argumentative. 
If comments turn into flame wars, I will certainly be ruthless about deleting them - 
and I hope others will too. I think it could be an interesting question if people 
treat it appropriately though.

The idea for this question came from the comment thread from my answer to the 
"What are five things you hate about your favorite language?" question. I 
contended that classes in C# should be sealed by default - I won't put my reasoning in 
the question, but I might write a fuller explanation as an answer to this question. I 
was surprised at the heat of the discussion in the comments (25 comments currently).

So, what contentious opinions do you hold? I'd rather avoid the kind of thing which 
ends up being pretty religious with relatively little basis (e.g. brace placing) but 
examples might include things like "unit testing isn't actually terribly 
helpful" or "public fields are okay really". The important thing (to me, 
anyway) is that you've got reasons behind your opinions.

Please present your opinion and reasoning - I would encourage people to vote for 
opinions which are well-argued and interesting, whether or not you happen to agree 
with them.


The only "best practice" you should be using all the time is "Use Your Brain".

Too many people jumping on too many bandwagons and trying to force methods, patterns, 
frameworks etc onto things that don't warrant them. Just because something is new, or 
because someone respected has an opinion, doesn't mean it fits all :)

EDIT: Just to clarify - I don't think people should ignore best practices, valued 
opinions etc. Just that people shouldn't just blindly jump on something without 
thinking about WHY this "thing" is so great, IS it applicable to what I'm 
doing, and WHAT benefits/drawbacks does it bring?


Performance does matter.
(パフォーマンス重要)


Opinion: SQL is code. Treat it as such
主張: SQLは“コード”だ。コードであるように扱え。

That is, just like your C#, Java, or other favorite object/procedure language, develop 
a formatting style that is readable and maintainable.

C#やJava,あるいはそのほかお好みのオブジェクト指向言語や手続き型言語と同じように
読みやすさと保守しやすさを考慮した整形スタイルを決めろ

I hate when I see sloppy free-formatted SQL code or code. If you scream when you see 
both styles of curly braces on a page, why or why don't you scream when you see free 
formatted SQL or SQL that obscures or obfuscates the JOIN condition?

#整形フォーマットがなっちゃいない“プログラム”を見たら気分悪いだろう?
#free-format なSQLなんてオレはキライだ云々

Programmers who don't code in their spare time for fun, will never become as good as 
those that do
余暇の時間に楽しみのためにコードを書かないようなやつは
それをしている連中には金輪際敵わない。

I think even the smartest and most talented people will never become truly good 
programmers unless they treat it as more than a job. Meaning that they do little 
projects on the side, or just mess with lots of different languages and ideas in their 
spare time.

Readability is the most important aspect of your code.
読みやすさチョー重要

Even more so than correctness. If it's readable, it's easy to fix. It's also easy to 
optimize, easy to change, easy to understand. And hopefully other developers can learn 
something from it too.
読みやすさは正確さよりもずっと重要である。
読みやすさが確保されていれば、修正は容易にできる。最適化も簡単である。
変更や理解も難しくはない。そしてほかの開発者がそこから何かを学び取ることも
期待できる。


Every developer should be familiar with the basic architecture of modern computers. 
This also applies to developers who target a virtual machine (maybe even more so, 
because they have been told time and time again that they don't need to worry 
themselves with memory management etc.)

すべての開発者は近代的コンピューターの基本的なアーキテクチャに親しんでおくべきである。
これは仮想マシンをターゲットとする開発者にもいえることだ。



The world needs more GOTOs.

GOTOs are avoided religiously often with no reasoning beyond "my professor told 
me GOTOs are bad." They have a purpose and would greatly simplify production code 
in many places.

That said, they aren't really necessary in 99% of the code you'll ever write.

■_ Tour de Lisp: What kind of lisp should I learn?

なんか良くわからん言い回しが多くて往生しました○| ̄|_

Tour de Lisp: What kind of lisp should I learn?
http://tourdelisp.blogspot.com/2009/02/what-kind-of-lisp-should-i-learn.html

Monday, February 9, 2009

What kind of lisp should I learn?

So you decided to learn lisp and you are confused with all those choices.

There's something called Common Lisp (is that for common people only?), than Scheme 
(Would I become a Schemer?), than Arc, Clojure, NewLisp, Qi and who knows what. So 
before your head is going to blow your are going to comp.lang.lisp newsgroup and 
asking for a recommendation. Then the hell opens and your honest question erupted into 
an ugly flamewar with otherwise mostly good people accusing each other and calling 
other people ugly names. So while your asking yourself what have you done in your past 
life to deserve such faith let me explain you a few things. The name lisp is a general 
name for the lisp family of languages as per John McCarthy wish, the inventor of lisp, 
lisp should be used as label for the whole family of lisp languages instead of 
describing just one language. Something like c, c++, c# and java are family of c 
language & its descendants. That wouldn't be such a huge problem if the ruling 
patriarch of lisp family, common lisp had it's own newsgroup. Something like 
comp.lang.common-lisp , but (for unknown reasons) it doesn't. So all the common lisp 
users, the majority of lispers, dwell on comp.lang.lisp which is generic groups for 
all lisp family of languages. So your action was like going to generic group for c and 
c language descendants and asking what language should you learn. Hypothetically you 
would heard discussion like this :


c-user: Learn c it's the right real thing.
c++-user: No learn c++, c is too low level.
Java-user: No learn Java, it runs everywhere.
c#-user: No learn c#, it has best ide and tail call elimination.
d-user: No learn d, it has the latest and greatest staff.

And then everything will go to hell like:

c-user: c++ is ugly as sin.
c++-user: Java is dog slow.
java-user: c# is microsoftware
c#-user: Java is sunware

...duscussion continues with people calling each other ugly names

So after you understand what happened let me give you my not so neutral advice about 
most popular lisps so you could decide for yourself which lisp to learn.

1.Common Lisp - It's an industrial strength, multi platform, specified by ANSI standard
  lisp. It has the largest active community, many high quality implementations, huge
  number of libraries, and enormous amount of material to learn it even compared with
  mainstream languages.

工業的強みを持ち、マルチプラットフォームに対応、ANSI標準Lispによって規定されているもの。
最大規模のアクティブなコミュニティを持ち、多数の高品質な実装があり、
数え切れないほどのライブラリと、メインストリームの言語と比肩するほどの
enormous amount of material to learn it を持つ。

2. Scheme is the language that started to be minimalistic but it abandoned that way 
   with advent of latest standard. It is more aimed at functional style,and has full 
   blown continuations, something that common lisp lacks. Though it has 2nd only to 
   common lisp community, scheme community is fragmented across implementations. Scheme 
   has too many high quality implementtaions but the problem is that there is many 
   incompabilities between them since its standard R5Rs is very small. I hope that R6Rs 
   will smooth many differences. Scheme also has huge amount of learning material. The 
   famous sicp is a must read for every serious lisper, not just schemers.

Schemeは minimalistic な言語として始まったが、後の標準においてその指針は放棄された。
より関数型のスタイルを指向し、Common Lisp には欠けているような機能、
full blown continuations を持っている。
Though it has 2nd only to common lisp community,
Scheme のコミュニティは fragmented across implementations である。
#実装ごとにコミュニティが固まっているとかいうこと?
Scheme には多すぎるほどのレベルの高い実装があるが、
標準となる R5Rs が小規模すぎるので実装ごとの非互換性が数多く存在しているという
問題がある。
わたしはR6Rs が多くの相違点を解決してくれることを期待している。
Scheme にはまた膨大ともいえる learning material が存在している。
有名な SICP は、Schemerに限らずすべての serious Lisper 必読の書である。
#ひょっとしてこのページが書かれたの結構前の話?

3. Qi - is a product of Mark Tarver, it introduces powerful static typing system, adapts
   pattern matching, embedded prolog etc.There is one excellent book by Mark Tarver,
   Functional Programming in Qi. Little learning material. The community is small.Very few
   libraries, though you could use common lisp ones. Single implementation that runs on
   top of common lisp.

Qi は Mark Tarver の product である。強力な静的型システムを導入し、
パターンマッチに適応し、Prologを組み込む等のことを行っている。
Mark Tarver によるすばらしい書籍 Functional Programming in Qi. がある。
learning material は小さく、コミュニティは小規模である。
ライブラリはCommon Lispのそれを使うことができるとしてもごく少数があるだけである。
Common Lispの上で動作する実装がひとつある。


4. Clojure - Runs on top of JVM. Aimed at functional programming and introduces many 
   novel ideas to support SMP and concurrency. One book, Programming Clojure, spartan 
   reference manual. Little learning material. Small community and libraries, though you 
   could use Java libraries. And a single implementation.

JVM上で動作する。関数型プログラミングを指向しつつ多くの novel ideas  を
SMPや並列性のために導入している。
スパルタ的 (spartan) リファレンスマニュアルである Programming Clojure がある。
Javaライブラリを使うことができるが、コミュニティとライブラリは小規模である。
実装はひとつだけある。

5. NewLisp- simple lisp aimed at scripting. No books but pretty good reference manual. 
   Little learning material. Small community and libraries.Single implementation.

スクリプティングを指向した単純なLisp。
書籍はないが、よくできたリファレンスマニュアルがある。
Little learning material.
小規模なコミュニティとライブラリ。
ひとつの実装。

If above descriptions of some of the lisps that I more of less tried didn't helped you 
to make your mind, than my recommendation is to go with common lisp, and then switch 
if you find other lisp more to your needs. Some lisps offer some new blood, but they 
all have much to learn to compete with a battle proven beast as common lisp. Though 
some lisps are better in some areas they are usually far worse in many other areas. In 
the end It's up to you. And yes I am a common lisper.

  

■_ チェックしておくべき10の言語(その2)

関係代名詞使われると弱い喃。

H3RALD : 10 programming languages worth checking out
H3RALD

10 programming languages worth checking out
Sunday, December 21st 2008 @ 03:01 PM
Tags: programming Comments: 14

    * Haskell
    * Erlang
    * Io
    * PLT Scheme
    * Clojure
    * Squeak
    * OCaml
    * Factor
    * Lua
    * Scala

PLT Scheme

I stumbled upon the PLT Scheme web site while browsing for different Lisp flavors 
about a year ago. At the time, I was determined to learn the rudiments of Lisp and I 
started reading a few articles and books on this old and yet still popular language. 
Although I was originally put off by certain Common Lisp literature, which dismissed 
Scheme as an almost-heretic attempt to revitalize an venerable language, I soon found 
out that Scheme - and PLT Scheme in particular - is definitely worthy of attention and 
interest.

一年ほど前に別の Lisp flavorsを求めてさまよっているときに
わたしは PLT Scheme のweb サイトを偶然に発見しました。
そのときわたしはこの rudiments of Lisp を学ぶことを決意し、
この古いけれども今でも popular であるこの言語に関する
いくつかのアーティクルや本を読み始めたのです。
わたしは元々ある種の Common Lisp literature に興味がなかったのですが、
すぐにScheme、中でも特に PLT Scheme が definitely worthy of attention である
と同時に面白いものであると理解しました。


Being a technical writer, I immediately became fond of the PLT Scheme Guide, one of 
the clearest and most well-organized examples of documentation available for a 
programming language I've ever come across. The manual is exquisitely crafted as a 
Getting Started Manual and a Reference Book at the same time, though remaining 
pleasant to read sequentially: a rare trait in technical documentation. Best of all, 
it's free: you simply have no real excuse not to read it.

Being a technical writer,
わたしは即座にfond of the PLT Scheme Guide となりました。
それはそれまでわたしが出会ったプログラミング言語に関するドキュメントの中でも
最も明快で最もwell-organized examples であったのです。
そのマニュアルは入門マニュアルであると同時にリファレンス本であるよう仕上げられたもので
though remaining pleasant to read sequentially: a rare trait in technical documentation. 
最も良かったのはそれが無料であったということです。
誰に断る必要もなく読むことができたのです。

Besides its excellent documentation, PLT Scheme feels like a fresh and modern 
implementation of one of the two most important dialects of Lisp. It's cross-platform, 
it has an extensive collection of packages and a very active community behind it. 
After my first attempt to learn Haskell, I felt compelled to try out PLT Scheme and it 
immediately felt much easier and more user friendly to learn, partly because of 
DrScheme a dedicated IDE/learning tool optimized to get you started and feel 
comfortable with the language. Caveats? None, unless you have an adversion for 
parenthesis, that is.

素晴らしいドキュメントに加えて、PLT Schemeは Lisp の diarects の中の一、二番目に重要なとして
新鮮かつ近代的な実装であるように感じられました。
PLT Scheme はクロスプラットフォームで、extensive collection of packages を持ち
非常に活発なコミュニティがあります。
最初にHaskell を学ぼうとしたあとで、わたしは PLT Scheme を試してみることにしました。
そうしてすぐにより学びやすく、かつよりユーザーフレンドリであると感じました。
それは部分的には DrScheme にはIDEや学習ツールがあり、他の言語に比べたときに
言語の学習を始めるための最適化が行われていたからです。
Caveats ですか?
あなたがカッコに対する adversion を持っていなければそんなものは存在しません。

To get you started…

    * Official PLT Scheme Web Site
http://plt-scheme.org/
    * PLT Scheme Guide
http://docs.plt-scheme.org/guide/index.html
    * PLaneT
http://planet.plt-scheme.org/
    * Quick: An Introduction to PLT Scheme with Pictures
http://docs.plt-scheme.org/quick/
    * More: Systems Programming with PLT Scheme
http://docs.plt-scheme.org/more/

Clojure

Clojure is the most recent and notable attempt to bring Lisp back to life and ready to 
face the challenges posed to IT systems by the new century: concurrency and scalability. 
Because it runs on the Java Virtual Machine, you also get Java interoperability for free, 
in a more Lispy flavour. Although I'm a bit reluctant to deal with anything related to 
Java nowadays, Clojure's approach makes it more appealing.

Clojureは最も新しく、notable attempt to bring Lisp back to life 
かつ並列性とスケーラビリティという
the challenges posed to IT systems by the new century
に ready to face するものです。
ClojureはJava仮想機械上で動作するので無条件で
Javaの interoperability がよりLisp風味な形で得られます。
Although I'm a bit reluctant to deal with anything related to Java nowadays,
Clojureのアプローチの仕方がより appealing となるでしょう。


Unlike other Lisps (and Schemes) you may have encountered before, Clojure comes with 
some interesting additions:

あなたがこれまで出会ってきたであろうLispやSchemeとは異なり
Clojureにはいくつかの興味深い追加項目があります。

    * Multimethods
      マルチメソッド
    * Agents asynchronous actions
      エージェントの非同期(asynchronous)アクション
    * Some interestings special forms
      いくつかの興味深い特殊フォーム
    * Many pre-built data structures, like Vectors, Maps, Sets, Collections, …
     ベクターやマップ、集合、コレクションなどなど
      多くの pre-built されているデータ構造。

Despite all this, Rich Hickey became increasingly popular both in the Lisp and Java 
world for creating such an interesting and well-designed language. Unlike with many 
new (and old) programming languages, I have yet to find a single blog post or article 
which is seriously criticizing Clojure in any way.

こういったことにも関わらず、Rich Hickey は
Lisp 世界と Java世界の両方でその名前が広く知れ渡ることとなりました。
名前が知られるようになりました。
多くの新しい(古いものもですが)プログラミング言語とは異なり
I have yet to find a single blog post or article 
which is seriously criticizing Clojure in any way.


To get you started…

    * Official Clojure Web Site
http://clojure.org/
    * Clojure User Group
http://groups.google.com/group/clojure
    * Clojure presentation on InfoQ
http://www.infoq.com/presentations/hickey-clojure
    * Trying Clojure
http://netzhansa.blogspot.com/2008/10/trying-clojure.html
    * My first look at Clojure
http://groups.google.com/group/clojure/msg/f038decc18c7da37
    * Enclojure
http://enclojure.net/Index.html

これで半分。

■_ 今日のAA



推薦図書/必読書のためのスレッド 44
981 デフォルトの名無しさん [sage] Date:2009/02/13(金) 21:43:21  ID: Be:
                           _ / \ _
                         / /    {┳ }
                         >{、     ,>-<
                        // -\__/ -ヽ \     、_、-‐     1
        1   i_工7     ┐    .  {  |⊂⊃ i  ⊂⊃|  }       }  、   T¨Τ
        _」-  L.L/   {_ノ―、     \ヽ 「 ̄ ̄ フ  / /     、-7 ̄   г¨Τ二7
        ノ   ー|フ  /∨   }   r─\ ゝ ─ '  厶二⊃       / \    ΓΤ J
       ー'⌒ 、-┴‐、 ヽハ _ノ      ̄`|  ̄ ̄ ̄ ̄  `ーァ    /    ヽ、    |
                           \       /
                            >、___ イ
                            し′  し′ 

うめせんせいw

■_

初心者のためのプログラミング言語ガイド Part13
462 デフォルトの名無しさん [sage] Date:2009/02/12(木) 22:03:42  ID: Be:
    >>443
    Cの文字列処理って不毛だよね
    それで投げたわ
    最終的には、日本語関係の文字コードは、Cっぽく、チマチマやらないといけないらしいけど

    あとライブリ群とか、ドキュメント群とか、こじんまりとまとまっていない感じがして
    かなりの強制力がないとやる気しない感じ

    自分のそういうのが不満をかなえてくれるのがPythonだったな
    プロトタイプとして組むのにもつかえるし 

463 デフォルトの名無しさん [sage] Date:2009/02/12(木) 22:03:56  ID: Be:
    (1)初心者がいきなりCは難しいからやめたほうがいい
    (2)Schemeは難しいし、勉強しても何も作れないのでやめたほうがいい
    (3)ハスケルは難しいし、勉強しても何も作れないのでやめたほうがいい

    ↑これらの、(1)、(2)、(3)を勧めてくるのは
    初心者を挫折させるためのトラップなので
    まともに話を聞いてはいけない。

    なんで初心者をわざわざ挫折させないといけないかというと
    プログラミングなんて誰でもできるので親切に教えると
    ゆくゆくは自分のライバルになると恐れているのである。 

464 デフォルトの名無しさん [sage] Date:2009/02/12(木) 22:24:04  ID: Be:
    最終的には、>>1の動機・用途に限るよね

    ・プログラミングってゲームつくれるんだろ?
    ・今、無職なんですが、今から必死こいて勉強して、プログラマになりたいんですが、
      なんの言語をやったほうがいいですか?
    ・Webでなんかやりたい
    ・ハッカーになりたい 

465 デフォルトの名無しさん [sage] Date:2009/02/13(金) 02:27:04  ID: Be:
    perl飽きたからC++やろうと思ってます
    D言語に越されるとか色々言われてるけど
    今から学ぶ価値ありますよね?

    これにしといた方が良い、って言語ありますか?
    使用用途はゲームで 

466 デフォルトの名無しさん [sage] Date:2009/02/13(金) 03:28:00  ID: Be:
    C++ 本格的にやりたくて自信のある人向け
    C# 楽したい人向け。わりと良い

    おすすめ本
    ゲームプログラマになる前に覚えておきたい技術
    http://www.amazon.co.jp/dp/4798021180
    ある程度C++が出来る人向け

    D言語がC++に追いつくには10年はかかりそう 

467 デフォルトの名無しさん [sage] Date:2009/02/13(金) 07:11:10  ID: Be:
    >>463
     (1)は正しいこともある。作りたい何かがある初心者にとって、Cの道のりは長い。逆に、
    プログラミングそのものに興味がある初心者にとって、Cは意外に良い選択になるかもしれ
    ない。(2)と(3)も同様。 

500 デフォルトの名無しさん [sage] Date:2009/02/13(金) 21:01:43  ID: Be:
    市場価値の高い言語はどれだ?
    求人数はJava、年収はC#がトップ――ワークポートが調査 - @IT
    http://www.atmarkit.co.jp/news/200902/13/wp.html

    求人数で見ると、やはりJava・Cの2強は揺ぎ無いな。
    そこからはC++、PHPと続いて・・C#、VB、Perl、JavaScript、"COBOL"、VB.NET

    C#よりVBの方が少なくてあれ?と思ったら、VB.NET分は別集計で合わせればVBの方が多い・・なるほど
    しっかし、未だにCOBOLが10位内に入ってるなんて・・まだまだ絶滅しそうにないな。 

501 デフォルトの名無しさん [sage] Date:2009/02/13(金) 21:26:07  ID: Be:
    何故COBOLだけ絶滅云々言ってんだ?アホか。 

■_

以下後でチェック。

未来の言語は「APL」? Rubyのまつもと氏が講演 - @IT
def euler(x); cos(x) + i*sin(x); end—euler(PI) # => -1
On Ruby: Stackful Rubinius Interview
TinyRB: A Young, Tiny Ruby VM for Us to Play With
tinyrb - macournoyer's blog

2009年02月12日

■_

・ネタ振りしてそれに反応がないと○| ̄|_ (T/O)

・トークイベント@ジュンク堂新宿店
行ってきました。 事前の申し込みで満席ということだったはずなのに、 ちらほら空席が。ドタキャン? ネクタイ率は先週の池袋よりは低い? 以下メモから適当に

・島根の方から来ました(まつもとさん)
・東京の方から~(卜部さん)
・大阪よりバージョンアップしたものをお届けします
・大阪での反省を踏まえてます
・ASCIIからのRuby本。書くのに3年かかってます。
・英訳という話もあったのですがいろいろあるうちに時機を逸したようです
・今回の「フラ本」は出世魚のような変遷をたどってきた本です。
・始まりは2000年刊行のデスクトップリファレンス(1.6対応)
・表紙の話 (なぜヤギになったのか)
・羊かハチドリという希望を出していたのですがCVSに負けました
・日本語書籍が英訳された例はほとんどない
・例がない→難しい
・Ruby IN a NUTSHELL デスクトップリファレンスが分量的に中途半端だったので加筆されている
・訳者(デビッド・レイノルズ)はネイティブなEnglish Speeker かつ日本語も達者な「レアもの」
・実はフランス語版もあります
・ロシア語版の話もあったんですがどうなったんだろう
・2008年1月に The Ruby Programming Language 刊行
・「Programming Ruby」は実はほかに取られてました
・まつもとさんが英語の本を丸々書くのは辛かろうとオライリーがヘルプにつけたのがフラナガン。
・ゆるやかに「K&R」の体裁を真似てみた
・斜め読みした後でリファレンスに使える本
・チュートリアルではありません
・2009年1月23日 日本語版刊行
・章の頭についている「引用」の訳が大変でした
・銀河ヒッチハイクの訳本を買って調べたり
・why the lucky stiff はすごいやつです
・チャンキーベーコン!
・第三章「データ型とオブジェクト」でM17Nの話を詳しく書いてます
・文と制御構造のドラフトを見てささださんの顔色が変わりました
・Fiberの実装が既成事実にされてたから。
・proc と lambda って実は違うんですよ
・リフレクションとメタプログラミングとか
・コミュニティは鮫
・1.9での非互換の話(ブロックパラメータとか)
・ブロックパラメータについて
・実はあれば、ループの制御変数を燃したものでした
・だから、グローバル変数も使えたし、メソッドやら配列要素やらも使えました
・でも1.9ではローカル変数のみになりました
・2.0へ向けて
  キーワード引数
  Selecotor Namespace
  Eignenclass
  Perl的引数($,や$/やら)の削除
・1÷2 を
  0   にしたい人
  1/2 にしたい人
  0.5 にしたい人
・やろうと思えば手をつけられるけど、効率よく実装したい。しかし手段が思いつかない
・一日一ハックを心がけています
・gem をもっと restrict なものにして欲しいというリクエストに対して
  別個の人たちがやっているので直接は
・1.8のメンテ終了について
  使いやすくしたい
  完成形が見えてきて欲しい
・1.9.2 ではパフォーマンスの改善
・2.0について
・2.0ブランチをどうきるか
・「一から作り直したい症候群」にかかってましたがあきらめました
・Ruby3000は? まあのんびりと
・MVM
・マルチコアと相性良いかも?
・でもプロセスやスレッドを1コアに効率よく割り当てるとか考えないとね
・VM間の通信とか
・ライブラリそのものにはあまり興味はないです

こんな感じでしょうか。 つか、みんなもっと積極的に質問しようよw (まあわしがしょーもない質問させてもらいましたがw)

■_

Stack Overflow から。

How can I become a better C# programmer? - Stack Overflow
http://stackoverflow.com/questions/518609/how-can-i-become-a-better-c-programmer

When you can create classes and do the simple stuff (GUI, reading text files, etc...), 
where do I go from here? I've started reading Code Complete 2nd Edition which is great 
but is more of a general programming book. What topics should I learn next?"

  
Young people using Emacs? - Stack Overflow
http://stackoverflow.com/questions/518669/young-people-using-emacs

I am a college student that has fallen in love with Emacs. I have used IDE's in the 
past, and although features like Intellisense made the switch to Emacs very hard, I 
now think that Emacs is much more powerful, and features like Intellisense can be 
pretty closely matched by various modes depending on language (and I am not referring 
to M-/). I am happily writing Elisp code for everything that I need that isn't 
provided by modes or by Emacs itself and I love the way that it adapts and molds to my 
needs.

However, I do think that its main disadvantage is the fact that it has a pretty steep 
learning curve and that most new programmers will not even begin to learn it out of 
many common misconceptions.

So, I want to know the opinions of young people (or any person who didn't start using 
Emacs before there were IDE's) that are Emacs users. Just to get some reassurance that 
Emacs is not dead within our Eclipse-loving generation =). (Opinions of users of any 
other highly extensible editor like Jedit are also welcome)

  

IDEもエディタに含めたとして、シェアはどうなってんですかね。

■_ 例の本

C言語改訂版1 はじめてのプログラミング (CD-ROM付)

ちゃんとタイトルにありますが「改訂版」なんですね。これ。 ぱらぱらとチェックしながら見ていますが、ところどころ「残念」なところがあります。 たとえば、ユーザーが入力したソースコードがどのように実行されるのかという 説明はあるのですが、(わたしが見落としていなければ)機械語の説明はでてきていません。 実行ファイルへの変換といった文章はあるのですけど。 あと、スタックの説明はないっぽいですねw

■_ Pythonのソースコードを読んでみた(その2?)

とりあえずインタープリターの入り口を覗いてみた。 Modules というディレクトリに python.c というファイルがあって、 これが main (windows用では wmain?)を抱えている。 ファイル全体で80行弱。

/* Minimal main program -- everything is loaded from the library */

#include "Python.h"
#include <locale.h>

#ifdef __FreeBSD__
#include <floatingpoint.h>
#endif

#ifdef MS_WINDOWS
int
wmain(int argc, wchar_t **argv)
{
	return Py_Main(argc, argv);
}
#else
int
main(int argc, char **argv)
{
	wchar_t **argv_copy = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*argc);
	/* We need a second copies, as Python might modify the first one. */
	wchar_t **argv_copy2 = (wchar_t **)PyMem_Malloc(sizeof(wchar_t*)*argc);
	int i, res;
	char *oldloc;
	/* 754 requires that FP exceptions run in "no stop" mode by default,
	 * and until C vendors implement C99's ways to control FP exceptions,
	 * Python requires non-stop mode.  Alas, some platforms enable FP
	 * exceptions by default.  Here we disable them.
	 */
#ifdef __FreeBSD__
	fp_except_t m;

	m = fpgetmask();
	fpsetmask(m & ~FP_X_OFL);
#endif
	if (!argv_copy || !argv_copy2) {
		fprintf(stderr, "out of memory\n");
		return 1;
	}
	oldloc = setlocale(LC_ALL, NULL);
	setlocale(LC_ALL, "");
	for (i = 0; i < argc; i++) {
(略)
		argv_copy[i] = (wchar_t *)PyMem_Malloc((argsize+1)*sizeof(wchar_t));
		argv_copy2[i] = argv_copy[i];
(略)
	}
	setlocale(LC_ALL, oldloc);
	res = Py_Main(argc, argv_copy);
	for (i = 0; i < argc; i++) {
		PyMem_Free(argv_copy2[i]);
	}
	PyMem_Free(argv_copy);
	PyMem_Free(argv_copy2);
	return res;
}
#endif

3.0で「文字列」はUnicodeで表現ということになったので、 Windows版であれば wmain、そうでなければ main の中でUnicodeへの変換を行う (って、wchar_t へ。であってUnicodeとは限らんだろうというツッコミはご遠慮願いたくw)。 メモリ確保はPyMem_Malloc()で。 そしてホンモノの入り口は Py_Main() ぽいのでそちらへ (Python-3.0/Modules/main.c)

■_

Parrot: Readers Needed!
Tuesday, February 10, 2009
Readers Needed!

One of our key requirements for the release next Tuesday is improved documentation. 
Documentation is key, because it's the doorway through which new users will enter the 
world of Parrot. I've been doing a lot of work on documentation recently, along with 
several of the other developers. The problem is that from inside the project we can't 
always see where the holes are, and what the confusing bits are going to be. So, I'm 
asking for a little help from people who aren't current Parrot users or developers:

We need you!

We need people to read over the documentation and find the problem spots. What parts 
are confusing? What material isn't well covered, or isn't covered at all? What do you 
wish we talked about more? What information do you need in order to get started 
working with Parrot?

You can check out the source repository using SVN from 
https://svn.parrot.org/parrot/trunk/, you can find our documentation in the docs/ 
directory. Many of the files here, although not all of them, are used to populate our 
online documentation too (the online documentation has it's own problems too). We have 
a comprehensive book in development in the directory docs/book/, which contains a lot 
of material arranged in a linear narrative. All these things need some help.

We need suggestions, comments, even questions. Because answering your questions will 
help us to identify the information that is missing from our docs. We need patches, if 
you're able and want to contribute. Leave comments here on this blog with ideas, open 
a ticket at trac, or post a message to our mailinglist. It doesn't matter how you send 
us your reviews and your fixes, so long as you send a lot of them! We need help from 
readers and reviewers, especially people who aren't current Parrot users or developers, 
people who don't already have the answers. We need your help.

わたしたちは提案、コメント、質問でさえも必要としています。
なぜなら、あなた方から寄せられた質問に回答することによって、
わたしたちが
to identify the information that is missing from our docs.
する助けになるからです。

2009年02月11日

■_

・紀伊國屋書店新宿南店
久しぶりに洋書売り場に。 programming for dumies (タイトルは正確でないかも)とかあって笑いました。 言語ごとの for Dumies はあったと思うんですが(Railsもあったな)、 プログラミングそのものとは。 何冊か気になるタイトルがあったのですが、ちょっと余裕がないので一冊だけで我慢。 んで、ジュンク堂新宿店にはなかった例のC入門書が1, 2の両方ともこちらにはあったので購入。 書評? はおって。パラパラと眺めたけど、gets を使ってたのは減点対象だなあ。 あとがきとかは結構いいこと書いていると思ったし、付属のCD-ROMで本に書いてあるそのまま 試せるようになっていそうなのは良いだけにちと残念。
C言語改訂版1 はじめてのプログラミング (CD-ROM付) C言語改訂版2 はじめて学ぶCの仕組み (CD-ROM付)

・ギレンの野望
機動戦士ガンダム ギレンの野望 アクシズの脅威V(特典なし)
を買ったんですが、このパッケージ絵、安彦さんではないですよね。 シリーズずっと安彦さんだったと思うんですが今回から?

■_ Ada Hackathon 開催記念

ということはありませんが、Adaの三文字が目立っていたので



Embedded.com - Why aren't developers interested in Ada?

Why aren't developers interested in Ada?
(なぜ開発者たちはAdaに興味を示さないのだろうか?)


By Jack Ganssle

Poll after poll shows that even after a quarter-century Ada has failed to garner a 
significant market share in the embedded space. Yet the data is stark: programs 
written in Ada have fewer bugs and are delivered faster than those written in C.

But wait, there's more!

Ada compilers work (see my soon to be published article on this site which reports 
that many C tools miscompile code that uses the "volatile" keyword). Ada 
compilers are checked against the exhaustive Ada Conformity Assessment Test Suite 
(ACATS).

But wait, there's more!

The most popular Ada compiler, GNAT, is free and is available under the GPL.

Ada was designed from the ground up for high reliability embedded applications. 
Neither C nor C++ can claim that distinction. The Ravenscar Profile even more finely 
targets real time embedded systems. Tasking is a built-in feature, not a bolt-on 
requiring expensive dalliances with RTOS vendors.

You'd think "faster, better and free tools" would be a pretty compelling 
argument, but it has failed to persuade most of us. Why?

It's probably not due to any inefficiencies. Robert Dewar, president of AdaCore, tells 
me that even with all of the runtime checks enabled expect no more than a 20% 
performance hit compared to C, though he said 10% is more likely.

Maybe I should define "runtime checks," as that concept is alien to the C 
community. Ada looks for error conditions like divide by zero. You can even define 
legal ranges for integers. But in C we can write:

num_doses=0;
morphine=patient_pain/num_doses;
dispense_morphine(morphine);

We can't blame a lack of compilers. AdaCore has ported GNAT to most mainstream 16 and 
32 bit CPUs.

In my experience new Ada developers typically hate the language. It makes one work 
very hard to get a compileable source file. The old saying is "if you can make 
the damn thing compile at all, it will work." But after about three Ada projects 
most programmers learn to love the language. Sure, they put more effort into getting 
the code right (which is surely a Good Thing), but they save mounds of time in debug.

わたしの経験からすると、新規のAda 開発者はこの言語を嫌うのが典型でした。
It makes one work very hard to get a compileable source file.
The old saying is 
"if you can make the damn thing compile at all, it will work." 
しかし三つぐらいのAdaプロジェクトをこなした後になると、大部分のプログラマーは
learn to love the language.
もちろん、
they put more effort into gettingthe code right (which is surely a Good Thing), 
彼らはコードを正しいものにするためにより一層の努力を必要としましたが(そのこと自体は Good
Thingです)、彼らはデバッグに要する大量の時間を節約したのです。


What's your take on Ada? Leave your comments here at the end of this column and/or go 
to the Embedded.com Home Page and participate in the poll on this question.

As correspondent Rich Ries wrote to me: "Maybe Ada's lack of success is like a 
healthy life-style -- something we all know we should have, but few actually employ it!! 

redditでも100以上のコメントがついています。


Why aren't developers interested in Ada? : programming
They lost their window. Both Ada and Smalltalk screwed the pooch with unconscionable 
licensing when they were first developed.

In the 1990s, validated Ada compilers were going for $60,000 a seat. That is not a way 
to generate popular interest in a language. It all went downhill from there.

■_ The History of Python: Python's Use of Dynamic Typing

ぐは。思い切り途中。



The History of Python: Python's Use of Dynamic Typing
Python's Use of Dynamic Typing

An important difference between ABC and Python is the general flavor of the type 
system. ABC is statically typed which meant that the ABC compiler analyzes the use of 
types in a program and decides whether they are used consistently. If not, the program 
is rejected and its execution cannot be started. Unlike most statically typed 
languages of its days, ABC used type inference (not unlike Haskell) instead of 
explicit type declarations as you find in languages such as in C. In contrast, Python 
is dynamically typed. The Python compiler is blissfully unaware of the types used in a 
program, and all type checking is done at run time.

ABCとPythonとの間の重要な違いは型システムの general flavor です。ABCは静的に型付けを行います。
これはABCコンパイラーがプログラムの中での変数の使用を解析しそれが一貫性ある使い方をされてい
るかどうか決定するのです。もし一貫性にかけていれば、そのプログラムは reject されてしまい実行
が開始されることはありません。
同時期の静的型付けを行う言語の大部分とは異なり、ABCではCなどの言語に見られるような明示的な
型宣言ではなく(Haskellとはまた違った形の)型推論 (type inference) を使っていました。対照的に
Pythonは動的に型付けを行います。Pythonコンパイラーはプログラムの中で使われている型に対して
blissfully unaware であり、型検査は実行時に行われます。

Although this might seem like a large departure from ABC, it is not as different as 
you might imagine. Unlike other statically typed languages, ABC doesn't (didn't? it's 
pretty much purely historic now :-) exclusively rely on static type checking to keep 
the program from crashing, but has a run-time library that checks the argument types 
for all operations again each time they are executed. This was done in part as a 
sanity check for the compiler's type-checking algorithms, which were not fully 
implemented in the initial prototype implementation of the language. The runtime 
library was also useful as a debugging aid since explicit run time type checking could 
produce nice error messages (aimed at the implementation team), instead of the core 
dumps that would ensue if the interpreter were to blindly go ahead with an operation 
without checking if the arguments make sense.

このことについてABCとは大きく異なるものと感じられるかもしれませんが、あなたが想像するよりは
そう異なるものでもないのです。ほかの静的型付けを行う言語とは違って、ABC はプログラムを
クラッシュから守るために静的型検査だけには頼らず全ての操作が行われるたびにその引数の型に
対する型検査をチェックする実行時ライブラリを備えていたのです。
この、言語の initial prototype implementation の段階では fully implemented ではなかった
型検査はコンパイラーの型検査アルゴリズムに対する sanity check の一部として行われていました。
実行時に明確に行われる型検査は引数が正当なものであるかどうかの検査なしになんらかの操作を
blindly に行おうとしたかどうかを ensure するコアダンプを引き起こすのではなく、
わかりやすいエラーメッセージ(aimed at the implementation team)を生成することが可能であったので、
ランタイムライブラリはデバッグにも有用でした。
#ここのifのつかいかたよくわかんねー


However, the most important reason why ABC has run time type checking in addition to 
static type checking is that it is interactive. In an interactive session, the user 
types ABC statements and definitions which are executed as soon as they are completed. 
In an interactive session, it is possible to create a variable as a number, delete it, 
and then to recreate it (in other words, create another variable with the same name) 
as a string. Inside a single procedure, it would be a static typing error to use the 
same variable name first as a number and then as a string, but it would not be 
reasonable to enforce such type checking across different statements entered in an 
interactive session, as the accidental creation of a variable named x as a number 
would forever forbid the creation of a variable x with a different type! So as a 
compromise, ABC uses dynamic type checking for global variables, but static type 
checking for local variables. To simplify the implementation, local variables are 
dynamically type checked as well.

しかしながら、ABCが静的型検査に加えて実行時型検査機能を持っている最重要な理由とは
それが対話的(interactive)であるからなのです。対話的なセッションにおいて
ユーザーが ABC のステートメントをタイプするとステートメント全体が入力されたところで
即座に実行されます。対話的セッションでは数値として変数を生成することができ、また
それを削除することもできます。さらにその変数を文字列として再度生成することも可能なのです
(言い換えると、同じ名前を持った別の変数を作るということです)。
一つの手続きの中であればそういった操作は、同じ変数名で最初は数値だったのに
文字列となってしまったということで static typing error となります。
しかし、別々に入力されたステートメントを跨いでの型検査を強制することは
resonable ではないでしょう。一旦間違って数値として変数 x を生成してしまうと、
それとは異なる型を持った変数 xの生成が以後ずっと拒絶されてしまうのです!
So as a compromise, ABC はグローバル変数に対しては動的型検査を行いますが、
その一方でローカル変数に対しては静的型検査を行うのです。
実装を単純にするために、ローカル変数は動的型検査も行われていました。


Thus, it is only a small step from ABC's implementation approach to type checking to 
Python's approach--Python simply drops the compile-time type checking completely. 
This is entirely in line with Python's “corner-cutting” philosophy as it's a 
simplification of the implementation that does not affect the eventual safety, since 
all type errors are caught at run time before they can cause the Python interpreter to 
malfunction.

つまりそれは ABCの型検査のための実装アプローチからPythonのそれへの単なる small step 
だったのです。Pythonではただ単にコンパイル時の型検査を完全に取り除いてしまったということです。
すべての型エラーがそれがPythonインタープリターを誤動作させるよりも前に
実行時に捕捉されるということであるので、これはまさに
安全性に影響を及ぼすことのない実装の単純化 (simplification of the implementation)
という Python の “corner-cutting” 哲学です。

However, once you decide on dynamic typing, there is no way to go back. ABC's 
built-in operations were carefully designed so that the type of the arguments could be 
deduced from the form of the operation. For example, from the expression “x^y” the 
compiler would deduce that variables x and y were strings, as well as the expression 
result. In Python, such deductions cannot generally be made. For example, the 
expression “x+y” could be a string concatenation, a numeric addition, or an 
overloaded operation on user-defined types. 

しかしながら、一旦動的型検査に決めてしまったらもう元には戻れません。
ABCの組み込みの演算子は慎重に設計されていましたから
その引数の型は操作の形式(form of operation)から deduce することができたのです。
たとえば、“x^y”という式があったとき、コンパイラーは式の中で使われている変数
xとyの両方ともが文字列であり、また、式の結果も文字列であると deduce できます。
Pythonではそのようなdeducationsは一般的には行えません。
例を挙げると
“x+y” という式があったときに、これが文字列の連結である可能性もありますし、
数値の加算でもありえますし、
はたまたユーザー定義の型に対してオーバーロードされた操作の可能性もあるのです。

■_



On Ruby: Real World Haskell: Pre-Reading Survey
Monday, February 09, 2009

Real World Haskell: Pre-Reading Survey

A long time ago, I was an aficionado of a language that told me that the three traits 
of a great programmer are laziness, impatience, and hubris. Then I discovered Ruby, 
which taught me about the Principle Of Least Surprise and that programming should be 
fun. Now, in Real World Haskell, Bryan O'Sullivan, John Goerzen, and Don Stewart 
promise me three things as I read their book to learn about Haskell: novelty, power, 
and enjoyment. That sounds like a pretty good deal to me.

昔々、わたしはとある、プログラマーの三大美徳 laziness (怠惰), impatience (短気),
hubris (傲慢) を教えてくれた言語の大ファンでした。
その後わたしは自分に Principle Of Least Surprise (驚き最小の原則)と、
プログラミングは楽しいものであるべきだということを考えさせた Rubyに出会いました。
今、Real World Haskell において Bryan O'Sullivan, John Goerzen, Don Stewart は
Haskellについて学ぶためにわたしが彼らの本を読んだときの
三つのことがらをわたしに約束しています。
novelty,
power, 
enjoyment
がそれです。
それはわたしにとってとても素晴らしいもののように感じられたのです。

After conducting an interview with Bryan, John, and Don I kept looking for a break in 
my reading list where I could put RWH, and I finally decided to make the room instead 
of waiting for it to occur on its own. Yesterday, my copy arrived.

I was immediately struck by the size of the book. Programming in Haskell (which I 
wrote about, briefly, here ) is a relatively modest 155 pages while RWH weighs in at 
640 — and what I've read so far is very approachable.

わたしはまず本の厚さに衝撃を受けました。
Programming in Haskell がおおよそ155ページであるのに対して、
この Real World Haskell は640ページもあるのです。



Reading through the ToC and Introduction, I've built the following list of questions I 
want to keep in mind as I read:

ToC と Introduction を読んでみて、わたしは自分がこの本を読んでいる間心に留めつづけて
起きたいと思った疑問のリストを作りました。

    * What value do I gain from strict, static typing? How does this compare to the 
      value I gain from strict, dynamic typing?
      厳格な静的型付けからわたしが得られる価値とは何か?
      それは厳格で動的な型付けから得られるものと比較してどうか?

    * What about Lazy Evaluation?
      遅延評価について

    * What about Polymorphism?
      多態について

    * Why bother with whitespace?
      なぜ空白にやかましいのか?

    * How do I think in Haskell?
      Haskellでどのように考えるのか?

    * What about Composition and code re-use? (How does it conpare to Factor/Forth?)
      集成 (Composition) とコードの再利用について
      (Factor/Forthと比較してどうか?)

    * How do I keep code readable? How is this different than in Ruby?
      コードの可読性をどのようにして保つのか?
      Rubyとどのくらい違うのか?

    * How does the FFI work? How does this compare to Ruby's?
      FFI はどのように動作しているのか?
      Rubyのそれと比較してどうか?

    * How does concurrent programming work? How does this compare with Erlang? With Ruby?
      並行プログラミングはどのように行われているのか?
      Erlang と比較してどうか? Rubyとは?
      
    * How does STM fit into things? What should this teach me about threads? About Actors?
      STM が fit することとは?
      これがスレッドについてわたしに教えてくれるべきことは?
      Actor については?

    * How do I profile, benchmark, and optimize?
      プロファイルやベンチマーク、最適化はどのように行うのか?

And of course, the biggest question of them all: When should I be reaching for haskell 
instead of Ruby, bash, or C?

そしてもちろん最大の疑問:
いつ(Ruby, bash, Cではなく)Haskellに手を出すべきなのか?

I've also put together three little goals for myself. By the time I finish the book, I 
want to use haskell to write:

わたしはまた、自分自身に三つのちょっとしたゴールも一緒に設定しました。
本を読み終わったときに、三つのものをHaskellで書いてみたいと思っています。

    * a wiki
    * a twitter scanner
    * a log analyzer

I'll try to write about my progress through the book, insights into the questions 
above, and progress toward my three goals. Feel free to share your thoughts as well.

訳すのがおっつかないでござるよ○| ̄|_

■_ Welcome Back Delphi

blogの写真を見たら、ちょっと前にDelphiにサヨナラした彼じゃないか(自分でも書いてるけど)w

Welcome Back Delphi
Welcome Back Delphi

Several years ago I said goodbye to the programming language in which I took my first 
stumbeling steps as a coder. I had moved on and there were no reasons to believe I'd 
ever go back. I was wrong. A reason emerged and Delphi 2009 now has a place, both in 
my computer - and in my heart.

何年か前にわたしはこの
I took my first stumbeling steps as a coder
であった言語にさよならを告げました。
わたしは戻ってくる理由は存在しないだろうと確信していました。
しかしわたしは間違っていました。
戻ってくる理由が emerge して、
Delphi 2009 は今、わたしのコンピューターとわたしの心の両方に居場所を得たのです。

Delphi 2009 comes with a great IDE
Delphi 2009 が偉大なIDEと共にやってきた

A sort of homecoming

Firing up the new IDE from CodeGear with Delphi for Win32 felt a lot like coming home. 
The outstanding graphical editor was there as was the lightning fast compiler. Visual 
Studio is great in many ways but it can't compete with CodeGear's RAD Studio when it 
comes to speed and rapid application development.

CodeGearから Delphi for Win32 と共に firing up した新しいIDEは felt a lot like coming home.
outstanding なグラフィカルエディターはかつての光速コンパイラのようです。
Visual Studio は多くの点で great ですが、その速度とアプリケーション開発のすばやさにおいては
CodeGearの RAD Studioと比較することはできません。


Not only that, the language (Object Pascal) has finally woken from its stagnated state 
and is getting increasingly modern. It now implements, for instance, closures 
(anonymous methods) which is quite rare for a non garbage collected language.

それだけではなく、Object Pascal という言語そのものもようやく停滞した状態から抜け出して
より近代的な言語となりました。
たとえば今回、ガーベジコレクションを行わない言語では非常に珍しい
クロージャ (名前を持たないメソッド)が新たに実装されました。

type
  TClosureProc = reference to procedure(AMsg: string);

function CreatePrefixedWriter(APrefix: string): TClosureProc;
begin
  Result := procedure(AMsg: string)
  begin
    WriteLn(APrefix + AMsg);
  end;
end;

var
  Log: TClosureProc;

begin
  Log := CreatePrefixedWriter('Closure Test: ');
  Log('Write this');
  Log('And this');
end.

The above program should produce the following output.
上記のプログラムは以下のような出力をします。

Closure Test: Write this
Closure Test: And this

I gotta wear shades

I am not the only one being thrilled with the rebirth of Delphi. A look at the TIOBE 
Programming Community Index for February shows that Delphi is the 9th most popular 
programming language, with a steady increase. That is a lot better than the 15th 
position a year and a half ago. At that time Delphi felt like a marginalized language 
with little promises for the future; Now it feels alive and vibrant.

わたしは、Delphi の復活に興奮している唯一の人間というわけではありません。
TIOBE Programming Community Index の二月の分を見ると、
Delphi は上位から9番目の popular programming language であり、
with a steady increase.
これは一年半前の15位という位置に比べると非常に良いものであります。
At that time Delphi felt like a marginalized language with little promises for the future;
Now it feels alive and vibrant.


Since the magic is back, I think I'll stick around for a while.
魔法は帰ってきました。
I think I'll stick around for a while.

Cheers

ちょっと試すには高いんだよなあ。ってDelphiだけにしとけば?

■_

Kite 1.0.1 Released - PLNews: Programming Language News
"Kite 1.0.1 has been released. Kite is a small, object-oriented language.

This release includes: a syntax for specifying regular expressions; "
http://plnews.org/posts/kite_101_released_20090210_074314.html

■_



Pythonのお勉強 Part31 
829 デフォルトの名無しさん [sage] Date:2009/02/11(水) 18:57:47  ID: Be:
    みんなインデントの幅って深さ1つあたりスペースいくつぶんにしてる?
    深くなってきたらインデント1つの幅を変えたりとかする? 

831 デフォルトの名無しさん [sage] Date:2009/02/11(水) 19:17:32  ID: Be:
    >>829
    Pythonの中の人は基本4つ分で、グーグルの仕事の時だけ2つ分にしてるらしい
    一週間前から勉強し始めた俺は4つ分 

832 デフォルトの名無しさん [sage] Date:2009/02/11(水) 19:20:01  ID: Be:
    >>829
    4幅。
    PEPに書いてなかったっけ?

    コードは基本、ネストレベルが深くなりすぎないように気をつけてる。
    気になるほど横に広がらざるを得ないって状況は少ない。

833 デフォルトの名無しさん [sage] Date:2009/02/11(水) 19:25:13  ID: Be:
    >>829
    公式では4が推奨されているし、pythonライブラリはほぼ全部indent=4。

834 デフォルトの名無しさん [sage] Date:2009/02/11(水) 20:05:09  ID: Be:
    スルー力お勉強スレ 

835 デフォルトの名無しさん [sage] Date:2009/02/11(水) 20:28:55  ID: Be:
    Rubyもやってたときに2にしてしっくりきてるから
    Pythonでも2で書いてる
    特に苦情ないよ 

836 デフォルトの名無しさん [sage] Date:2009/02/11(水) 21:00:16  ID: Be:
    >>835
    今直ぐ止めろw 

837 デフォルトの名無しさん [sage] Date:2009/02/11(水) 21:04:54  ID: Be:
    あいだとって3にすれば文句あるまい 

838 デフォルトの名無しさん [sage] Date:2009/02/11(水) 21:16:04  ID: Be:
    俺はエイトマン 

839 デフォルトの名無しさん [sage] Date:2009/02/11(水) 21:28:08  ID: Be:
    >>835
    Rubyの力は雄大だな 

840 デフォルトの名無しさん [sage] Date:2009/02/11(水) 21:59:15  ID: Be:
    インデント=2に慣れると4は広すぎると感じる。
    4に慣れると2が窮屈に感じる。 

841 デフォルトの名無しさん [sage] Date:2009/02/11(水) 22:03:19  ID: Be:
    1spaceでいいだろ
    馬鹿かお前ら 

3タブ同盟…(って何人くらいわかるんだ)

推薦図書/必読書のためのスレッド 44 

867 デフォルトの名無しさん [sage] Date:2009/02/11(水) 06:22:30  ID: Be:
    スコットメイヤーズにC#の本を書いてもらいたい。
    訳者は小林さんで。 

873 デフォルトの名無しさん [sage] Date:2009/02/11(水) 12:58:23  ID: Be:
    >>867
    メイヤーズさんは今年度もC++の予定でいっぱいで、
    http://www.aristeia.com/seminars.html
    C#の本を書いているような余裕はまったくないのですが、
    Effectiveシリーズという新しいシリーズの監修(consulting editor)を
    やることになっていて、「Effective C#」が含まれてます。著者ではないですが。
    http://www.informit.com/imprint/series_detail.aspx?st=61267

    >>872
    OS設計に興味がある人ならそれなりにおもしろいと思うが。 

874 デフォルトの名無しさん [sage] Date:2009/02/11(水) 13:17:29  ID: Be:
    >>873
    メイヤーズ氏はメールで質問したら忙しい中きちんと返してくれた。
    好印象。もうC++やめてC#に来て欲しいよ。 

875 デフォルトの名無しさん [sage] Date:2009/02/11(水) 13:23:13  ID: Be:
    講演のリストを見てもらえば分かるように、
    組み込み、主に携帯デバイスが多いと思われますが、
    の下位レイヤー実装言語としてC++が大人気なので、
    まだまだC++を続けていくと思いますよ。
    次は独自allocator周りをやってほしいね。
    // 携帯デバイスでは例外的にC++でないiPhone/iPodさえ、デバドラはC++だからね。

876 デフォルトの名無しさん [sage] Date:2009/02/11(水) 13:31:12  ID: Be:
    C#人気だなぁ。
    おまえらお勧めのC#の本はなに? 


Ruby 初心者スレッド Part 25
383 デフォルトの名無しさん [sage] Date:2009/02/11(水) 18:09:08  ID: Be:
    [[1,2,3],[4,5,6],[7,8,9],…]
    を
    [[1,4,7],[1,4,8],[1,4,9],[1,5,7],[1,5,8],[1,5,9],[1,6,7]…]
    見たいに再帰的にお手軽に展開する方法ってありますか? 

384 デフォルトの名無しさん [sage] Date:2009/02/11(水) 18:25:25  ID: Be:
    > x = [[1,2,3],[4,5,6],[7,8,9]]
    => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    > x.inject(&:product).map(&:flatten)
    => [[1, 4, 7], [1, 4, 8], [1, 4, 9], [1, 5, 7], [1, 5, 8], [1, 5, 9],
    [1, 6, 7], [1, 6, 8], [1, 6, 9], [2, 4, 7], [2, 4, 8], [2, 4, 9],
    [2, 5, 7], [2, 5, 8], [2, 5, 9], [2, 6, 7], [2, 6, 8], [2, 6, 9],
    [3, 4, 7], [3, 4, 8], [3, 4, 9], [3, 5, 7], [3, 5, 8], [3, 5, 9],
    [3, 6, 7], [3, 6, 8], [3, 6, 9]]

    あってる?

385 383 [sage] Date:2009/02/11(水) 18:39:12  ID: Be:
    >>384
    この動作であっています
    ひたすらループ回すようかと思っていました
    非常に助かりました。ありがとうございました 

387 デフォルトの名無しさん [sage] Date:2009/02/11(水) 20:23:38  ID: Be:
    >>384
    すごーい!つーか>>383の1行目の最後の",…"余分だよな?
    あと、みんな普通に1.8.7とか1.9系を使ってるんだ。面倒でまだ入れかえてない 

わかんねーw>384 product ってどういう動作するんだっけ?

■_ grepだし

【Grep】複数ファイル文字列検索ソフト【置換】 
439 438 [sage] Date:2009/02/11(水) 16:42:58 ID:Vi23trh40 Be:
    (?:\r)? はないな。\r?だ

    yagrep なら
    yagrep -P "ab(?:.|\n)cd" FILE ...
    のようにしないといけないみたい

    -p で Keysが表示されるけれど、
    /pattern/m の複数行モードが有効じゃないようだ 

一部には、「レコードのセパレーター」のようなものが指定できて それ単位でマッチを実行する grepもあるけど、yagrep(というかそのもとの GNU grep)は古式ゆかしい grep なんで、対象はあくまで「行」であるから 改行を含んだ検索はできないんだけど(だから複数行モードがオンになってない)。

その辺まで改造しようとなると結構大変なのねん。


一つ前へ 2009年2月(上旬)
一つ後へ 2009年2月(下旬)

ホームへ


Copyright (C) 2009 KIMURA Koichi (木村浩一)
この文書の無断転載はご遠慮ください(リンクはご自由にどうぞ)。

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