ときどきの雑記帖 再起編

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

一つ前へ 2012年4月(上旬)
一つ後へ 2012年4月(下旬)

ホームへ

2012年04月20日

■_

観てきた

最終日にようやく。前回調べたときは 18:30 からの上映回があって、 それに行こうと思っていたのだけど再度調べると 18:10 からに。 その次は20時台なのでどうしようかと悩みつつ、定時の鐘とともに退勤ダッシュw

んでまあ無事間に合いました。 満席とまでは行ってませんでしたが9割くらいは埋まっていた? ざっとの印象ですが、男性客はそこそこの年齢、女性客はわりに若い人が多かったように感じました。

画はきれいでした。うん。 さらば~以降で出てきたあの人とかあの人とかあの人が出てくるのは良かったかな。 割と有名なあのセリフがなかったような気がするんですが、削っちゃったんですかね。 なんでだろう。リメイクとはいえなにからなにまで同じでなきゃいけないことはないので 削ったこと自体はまあ理由があるんだろうねえですむんですが、 気になるといえば気になる。

ただなんというかなああ、 観ていてマクロスかトップをねらえを観ているんじゃなかろうかと思った瞬間が何回か。

■_ Clay

新言語いろいろ。その1。

Clay Programming Language

Clay Programming Language

a language designed for generic programming
ジェネリックプログラミングのために設計された言語

What is Generic Programming?

Generic Programming is the art of writing highly reusable code that is also highly efficient.
ジェネリックプログラミングとは、高効率であると同時に高度に再利用可能なコードを記述するための技法です。

Why Clay?

Clay is concise.
Clay には一貫性があります

If you've written generic programs with C++ templates, you know how verbose it is. This is
because type names are longer in generic code. Clay solves this problem elegantly by providing
whole program type propagation. Generic programming, when combined with whole program type
propagation lets you write high-level code rivaling scripting languages in conciseness.

もしあなたが C++ のテンプレートを使ってジェネリックプログラムを書いているのなら、
あなたはそれがとても冗長 (verbose) なものだということを理解しているでしょう。
冗長なのは型の名前がジェネリックコードの中では長くなっているからです。
Clay はこの問題を、プログラム全体に type propagation を提供することによって
エレガントに解決しました。ジェネリックプログラミングをプログラム全体の type propagation
を組み合わせることで、あなたは簡潔さにおいてスクリプティング言語に匹敵するような
high-level なコードが書けるのです。

Clay is fast.
Clay は高速です

Efficient type-specialized code is generated during compilation. This type-specialized code is
low-level and is equivalent to C in performance. Clay uses LLVM to optimize the generated
low-level code.

効率の良い type-specialized code はコンパイル中に生成されます。
この type-specialized code は low-level かつ、C に匹敵する性能です。
Clay は生成された low-level code の最適化に LLVM を使っています。

Clay is a systems programming language.
Clay はシステムプログラミング言語です

Clay has the same memory footprint and runtime overhead as C. It is suitable for writing
garbage collectors, embedded systems, database servers, games etc.

Clay には C と同程度のメモリーフットプリントとランタイムオーバーヘッドしかありません。
ガーベジコレクションや組み込みシステム、データベースサーバー、ゲームといったものを
記述するのにも suitable なものです。

Clay design philosophy.

Efficient, concise, generic - Pick any three.

News

Jan 18, 2012: Clay 0.1 is released. See the announcement.

Highlights

    Machine memory model
    Value semantics
    Whole program type propagation
    Module system
    Extensible variant types
    Multiple dispatch
    Powerful compile time meta-programming
    Interoperability with C
    No garbage collection
    LLVM backend

Contact

    Join the discussion group.
    Check out the wiki.
    Join #clay on Freenode.
    Email me directly.

© Clay Labs 2012.

■_ cicra

その2.

circa - Introduction

Introduction

Circa is a language designed for live coding. We've built the language from scratch to be a
fun, productive language that allows the coder to see the effects of their code in realtime.
The runtime takes inspiration from Lisp and Smalltalk, where code is mutable data and the
interpreter is heavily introspectable. The syntax is similar to Python and Ruby, but under the
familiar syntax is a language with static typing, tamed side effects, and a few interesting
tricks. We hope that Circa will be a language of choice for the creative coder.

Cicra はライブコーディングのために設計された言語です。
わたしたちはこの言語を、coder が自分のコードの効果をリアルタイムで見ることができるような
楽しく、生産的な言語とするようゼロから作り上げました。
ランタイムは Lisp や Smalltalk からインスピレーションを受けていて、
コードは mutable なデータでありインタープリターは heaviliy introspectable です。
構文は Python や Ruby に似ていますが、

わたしたちは Crica が creative coder のための language of choice となることを望んでいます。


Current status

It's important to note that Circa is currently alpha-level, and the implementation has known
issues. There aren't any downloadable binaries ready yet, but we're working on that. Read more
about the current status.

Features

Reload code, preserve state

Most interpreted languages can already support the loading of new code at runtime, but one
common problem is how to preserve the program's current state. In some existing solutions, the
only code that can be reloaded is stateless. Circa solves the problem by making state a
first-class entity in the language, and it knows how to preserve it across a reload. Often one
can write an entire program without ever restarting. See the article on inlined state for more
information.

大部分のインタープリター型言語は実行時の新規コードのローディングをすでにサポートしています。
しかし、プログラムの current state をどのように preserve するかは one common problem です。
いくつかの existing solution ではリロードできるコードは stateless なものだけです。
Crica はこの問題を、state を言語における first-class entity として
リロードを跨いで preserve できるようにすることで解決しました。
Often one can write an entire program without ever restarting.
See the article on inlined state for moreinformation.


Metaprogramming and reflection

Compiled code is stored in a simple and normalized format, making reflection and code 
modification easy. A rich reflection API is built-in. Automatic code generation and 
refactoring is encouraged.

コンパイルされたコードは単純で正規化されたフォーマットで格納され、
リフレクションやコードの修正は簡単にできます。
rich なリフレクション API が組み込まれています。
自動コード生成とリファクタリングが encorage されています。

Introspectable

The interpreter is designed to be heavily introspectable, so you can poke at the internals and
understand what it's doing, why it's doing it, and what it will do next.

Hybrid textual and visual programming

Code can be edited as text, or edited as a structured AST graph. Changes to the AST can be
saved back to source text with no loss of comments or whitespace.

Designed for productivity

Here's a laundry list of design decisions:

    C-like code semantics
    Runtime typing with optional static type inferrence
    Eager evaluation
    Values are immutable
    Code is stored as a data-flow graph
    Pluggable type system
    Written in C++

Embeddable

Accessible with a clean C API, one of the goals is to be Almost As Embeddable As Lua.

Open source

Source is available on Github, under the liberal MIT license.

Author

This project is a labor of love by Andrew Fischer, who has written C++ for so many 
years that he never wants to stop to recompile ever again. Found on Github as 
paulhodge and on Twitter as hodgepaul.

Logo designed by Kurt Schafer.

■_

■_ どうしよう

いい加減後継機を決めんとなあ…

2012年04月19日

■_

誤用?
時代の流れに棹さして、今こそあえてフルスクラッチ:前編
んが、こういう話もあって 「流れに棹さす」の意味は変わった?! - 言語郎-B級「高等遊民」の妄言 流れに棹さす とは - コトバンク 流れに棹をさして水の勢いに乗るように、物事が思いどおりに進行する。誤って、時流・大勢に逆らう意に用いることがある。 from scratchの意味 - 英和辞典 Weblio辞書

■_ 最悪な変数名とは

こっちで盛り上がった話。 The world's two worst variable names : programming

The world's two worst variable names | Andy Lester

The world's two worst variable names

April 18, 2012 by Andy | 60 Comments

As programmers, assigning names makes up a big part of our jobs. Phil Karlton said “There are
only two hard things in Computer Science: cache invalidation and naming things.” It's a hard
problem, and it's something we deal with every time we write a line of code. Whether it's a
variable or a table or a column in that table or a file on the filesystem, or what we call our
projects and products, naming is a big deal.

Bad variable naming is everywhere. Maybe you'll find variables that are too short to be
adequately descriptive. The programmer might as well have been working in TRS-80 BASIC, where
only the first two characters of variable names were significant, and we had to keep a
handwritten lookup chart of names in a spiral notebook next to the keyboard.

以下略

ワタクシ個人は xxflag というパターンの変数名が大嫌いです :)

■_

2012年04月18日

■_

耳鼻科で喉に塗ってもらった薬効いた感じ。 まあ飲み薬も処方されたんだけども。

■_

最近 InfoQ の日本語訳を追いかけている余裕がなっしんぐなんですが これもまあ訳されるでしょう

channel9 だかで Hurb Sutter が JIT コンパイルと従来型(なんていうんだか度忘れ)を 比較してどうこう言ってたと思うんですがその流れでしょうか

InfoQ: Modern C++ vs Managed Code: Performance vs Productivity


Modern C++ vs Managed Code: Performance vs Productivity

Posted by Jeff Martin on Apr 18, 2012


An interesting discussion about the merits of native code versus Just-In-Time based systems has
recently taken place with Herb Sutter of Microsoft and Miguel de Icaza of Mono both providing
insightful commentary. Taken together they have provided an informative look at the current
state-of-the-art in between native and managed code.

Herb Sutter began by answering the question, "When will better JITs save managed code?"
Sutter summarizes his position with the statement that "C++ and managed languages make
different fundamental tradeoffs that opt for either performance or productivity when they are
in tension."

Sutter views C++ as settling the tradeoff by opting for performance whereas managed languages
(which he defines as Java/NET) opt for programmer productivity. Providing more depth, Sutter
goes on to say:

    "First, JIT compilation isn't the main issue. The root cause is much more fundamental:
    Managed languages made deliberate design tradeoffs to optimize for programmer productivity
    even when that was fundamentally in tension with, and at the expense of, performance
    efficiency."

以下略

■_

2012年04月17日

■_

ニャル子さんを観ずに寝る

■_

■_ TIPS

新参Haskellプログラマーに贈る4つのTips

Software Simply: Four Tips for New Haskell Programmers

Sunday, April 15, 2012

Four Tips for New Haskell Programmers

The Haskell programming language is widely considered to have a fairly steep learning curve--at
least compared with mainstream languages.  In my experience with Haskell and specifically
helping newcomers I've noticed a few common issues that seem to come up again and again.  Some
of these issues might be more avoidable if the Haskell community did a better job communicating
them.  Four points I have noticed are:

    Read Haddock API docs
    Pay attention to type class instances
    Learn about kinds
    Learn monad transformers

略

それぞれの tips の詳しい解説は原文を。つーことで。

Haskell とモナドについてはいろんな人がいろんな主張をしているので正直よくわかりません

2012年04月16日

■_

ということで耳鼻科に行って診てもらったところ、 中耳炎になってると診断されました。

■_

2012年04月15日

■_

だいぶ楽になりましたが、まだ立ち上がったときにふらついたりすることがw

紙の駱駝本第四版、現物を見ましたがやはり分厚い。 アレを買うことはたぶんないだろうなあ。 理由はいろいろ。

僕と日本が震えた日 (リュウコミックス)
発売日に買ってたのをようやく読んだ。 経済学の先生の話が面白かった(といいつつある意味背筋が寒くなる内容なんだけど)。 が、どうしたもんなんでしょうねえ、いろいろと。

■_

Decorators compared to Strategies, Composites, and Presenters

■_ R

R's continued growth in academia | (R news & tutorials)

R's continued growth in academia | (R news & tutorials)

Amongst the software packages showing growth in academia (i.e. all those except SAS and SPSS),
R is has the largest "market share" of citations, and continues to grow rapidly:

SAS や SPSS が下り坂になったのはリーマンショック以後かなーと思ってチャートを見たのだけど それよりちょっと前っぽい。なんだろ。

■_ ~は有害と思われる

リスト内包 (List Comprehension) 編。

要するにほかの関数の組み合わせで表現できるけど…と。

Computer Language Design: What's List Comprehension and Why is It Harmful?


This page explains what is List Comprehension, with examples from several languages, with my
opinion on why the jargon and concept of “list comprehension” are unnecessary, and harmful to
functional programing.

What is List Comprehension?

Here's a example of List Comprehension (LC) in python:

S = [2*n for n in range(0,9) if ( (n % 2) == 0)]
print S
# prints [0, 4, 8, 12, 16]

It generates a list from 0 to 8 by range(0,9), then remove the odd numbers by ( (n % 2) == 0),
then multiply each element by 2 in 2*n, then returns a list.

これは range(0,9) によって0から8のリストを生成し、そこから (n % 2) == 0 によって奇数を
取り除き、2*n で残った要素にそれぞれ 2 を乗じたもののリストを返します。

Python's LC syntax has this form:

  [myExpression for myVar in myList if myPredicateExpression]

In summary, it is a special syntax for generating a list, and allows programers to also filter
and apply a function to the list, but all done using expressions.

簡単にまとめると、これはリストを生成する特別な構文で、
プログラマーはそのリストに対するフィルターや関数の適用を式を使ってできるというものです。

In functional notation, list comprehension is doing this:
関数的な表記ではリスト内包は次のようになります:

  map( f, filter(list, predicate))

If you read a lot here, please donate a few bucks, or buy something from amazon. Thank you for support!

Other languages's LC are similiar. Here are some examples from Wikipedia. In the following, the
filter used is x^2 > 3, and the 2*x is applied to the result.

Python 以外の言語でのリスト内包も同様です。

Haskell

s = [ 2*x | x <- [0..], x^2 > 3 ]

F#

seq { for x in 0..100 do if x*x > 3 then yield 2*x } ;;

OCaml

[? 2 * x | x <- 0 -- max_int ; x * x > 3 ?];;

Clojure

(take 20 (for [x (iterate inc 0) :when (> (* x x) 3)] (* 2 x)))

Common Lisp

(loop for x from 1 to 20 when (> (* x x) 3) collect (* 2 x))

Erlang

S = [2*X || X <- lists:seq(0,100), X*X > 3].

Scala

val s = for (x <- Stream.from(0); if x*x > 3) yield 2*x

Here's how Wikipedia explains List comprehension. Quote:

    A list comprehension is a syntactic construct available in some programming languages for
    creating a list based on existing lists.

The following features makes up LC:
リスト内包が持つ機能は以下の通りです

    ① A flat list generator, with the ability to do filtering and applying a function.
       フィルタリングや関数適用の能力を持ったフラットなリストジェネレーター

    ② A special syntax in the language.
       その言語における特別な構文

    ③ The syntax is one single expression, not made of separate functions.
       その構文は単一の式であって、複数の関数からなるものではない

Why is List Comprehension Harmful?
なぜリスト内包が有害なのか?

• List Comprehension is a opaque jargon; It hampers communication, and encourage misunderstanding.

• List Comprehension is a redundant concept in programing. It is a very simple list generator.
  It can be easily expressed in existing functional form map(func, filter(list, predicate)) or
  imperative form e.g. perl: for (0..9) { if ( ($_ % 2) == 0) {push @result, $_*2 }}.

• The special syntax of List Comprehension as it exists in many langs, are not necessary. If a
  special purpose function is preferred, then it can simply be a plain function,
  e.g LC(function, list, predicate).

Map + Filter = List Comprehension Semantics

以下略

■_ 戦艦

あーバトルシップ観に行きてえw

【デビュー】横山信義総合スレ23【20周年】

323 忍法帖【Lv=40,xxxPT】 [sage] 2012/04/13(金) 18:36:28.48 ID:??? Be:
    ノビーはそろそろ超大和型戦艦か大和型戦艦4番艦が出てくる話書こうぜ 

324 名無し三等兵 [sage] 2012/04/13(金) 19:00:01.23 ID:??? Be:
    お前がバカにしすぎるから悪いんだよ。

    魚雷発射管がーーーって言い続けてそのネタが封印され、
    軽巡無双wwwでネタが潰れて
    大和は沈まないんですwwwで大和が沈み、
    もう追い詰めすぎ。 

326 名無し三等兵 [sage] 2012/04/13(金) 21:34:02.09 ID:??? Be:
    大和不沈はそのままでいいのにね 

327 名無し三等兵 [sage] 2012/04/13(金) 22:03:13.19 ID:??? Be:
    大和不沈はいいけど、仕方ないとはいえその分武蔵が割食うからなw 

328 名無し三等兵 [sage] 2012/04/13(金) 22:16:45.92 ID:??? Be:
    大和が沈まんと、イスカンダルまでいけないからなあ 

330 名無し三等兵 [sage] 2012/04/13(金) 23:49:22.02 ID:??? Be:
    Shared Worldで、大輔のRSBCを書き継ぐとか 

342 名無し三等兵 [sage] 2012/04/14(土) 14:15:35.35 ID:??? Be:
    ある意味で、ノビーが出した最強のバトルシップとしての答えが
    浅間の最終巻に出てきたヒトラー専用のアレだと思う。

    次点でケンタッキー級。
    一回り小さい大和に敗れたドイツの巨大戦艦もなかなk。 

343 忍法帖【Lv=40,xxxPT】 [sage] 2012/04/14(土) 17:40:32.91 ID:??? Be:
    やっぱりノビーは大和を越える日本戦艦を出す気ってねぇのかなあ? 

344 名無し三等兵 [sage] 2012/04/14(土) 18:17:43.33 ID:??? Be:
    >>342
    ヴァツーチン…
    ノビーのデビュー作なんだから忘れないであげて
    プレジデント級とか 

345 名無し三等兵 [sage] 2012/04/14(土) 19:22:55.12 ID:??? Be:
    忘れてないけど時代設定が未来すぎて、
    それを出したら勝てる物がないからなw 

347 忍法帖【Lv=40,xxxPT】 [sage] 2012/04/14(土) 19:33:30.61 ID:??? Be:
    大ちゃんのRSBCの播磨でもヴァツーチンにゃ勝てないだろうなあ 

351 名無し三等兵 [sage] 2012/04/15(日) 01:25:16.12 ID:??? Be:
    >>344
    あれ最初に読んだときは、「バーバヤーガの眼」照準に感動してたが・・・
    ありゃ、巡航ミサイル・グラニート(当時のSS-N-19)の「レゲンダ・システム」からの
    インスパイアだったんだよなー。 

352 名無し三等兵 [sage] 2012/04/15(日) 04:06:46.18 ID:??? Be:
    トハチェフスキー級のスペック忘れてしまったな
    基準排水量約25万tで50口径62センチ×9だっけ 


353 名無し三等兵 [sage] 2012/04/15(日) 16:10:28.42 ID:??? Be:
    文庫版によると 全長400m 全幅50m 基準排水量21万8000t 主砲58口径25in(≒63.5㎝)砲九門 

播磨の主砲やらどんなんだったっけか。

艦艇データ集 軍艦「播磨」 によると 全長 380m 全幅 67m 基準排水量 21万7000トン 55口径58cm砲12門とな。 幅は播磨の方があるのね。

なんかこんなのひっかかった スーパーSF大戦避難所@ ウィキ - アバンタイトル 戦乙女達の約束~播磨とヴァツーチン~

■_

2012年04月14日

■_

完全にダウンしてます

2012年04月13日

■_

予習がーっ

■_

Forth インタープリター/コンパイラーはいっぺん作ってみたいとは思ってるのよね。 簡単に済まそうと思えばかなりお手軽に実装できる言語とは思うし、 ある程度は仕事でも以前ごにょごにょ

Retro Programming: Itsy-Forth: the Dictionary and Inner Interpreter

Retro Programming

Tuesday, 3 April 2012

Itsy-Forth: the Dictionary and Inner Interpreter

Itsy Forth is a minimal Forth compiler implemented in under 1kB. Earlier we examined Itsy's
outer interpreter. Now we take a closer look at the dictionary and inner interpreter.


Forth Dictionary
Forth の辞書

Itsy's dictionary is a linked list holding the name and code for each word (subroutine). 
Each entry in the list has a header containing a link, counted string and XT (execution token).
For example here's the dictionary entry for nip:

Itsy の辞書はワードごとにその名前とコードを保持している linked list です。
リスト中の各エントリにはリンクと、counted string および
XT を保持しているヘッダーがあります。例として nip の辞書エントリを示します

          ; header
          dw link_to_previous_word
          db 3, 'nip'
  xt_nip  dw docolon
          ; body
          dw xt_swap
          dw xt_drop
          dw xt_exit

The first line of the header links to the previous word in the dictionary. The second 
line holds the word's name preceded by its length. The final line contains the XT, a 
pointer to the routine which performs the actual operation of the word. Itsy uses four 
different XTs:

ヘッダーの最初の行は辞書中で前のワードへのリンクです。
二行目はその長さを前置したワードの名前を保持しています。
ヘッダーの最後の行にはXTがあります。
これはワードを実際に実行するときに呼び出されるルーチンへのポインターです。
Itsy は四種類のXTを使用しています

    docolon - The word is a list of pointers to XTs. Call each in turn.
    doconst - The word is a constant. Place its value on the data stack.
    dovar - The word is a variable. Place its address on the data stack.
    pointer to body - The word is a primitive (machine code). Execute it.

Macros
マクロ

I'm not a big fan of macros. They're ugly and lock the code to a particular assembler. 
On the other hand they can add flexibility and make the code less prone to errors. 
Compare the definition of + with and without macros:

わたしはマクロの大ファンというわけではありません。
マクロは ugly だし特定のアセンブラーにコードを lockしてしまいます。
その一方で、マクロはコードに柔軟性を付加しますしエラーが入りこみにくくします。
+というワードの定義を例にとってマクロの有り無しでどうなるか比較してみましょう

Without macros:
マクロなしではこうですが

          dw link_to_previous_word
          db 1, '+'
  xt_plus dw mc_plus
  mc_plus pop ax
          add bx,ax
          jmp next

With macros:
マクロを使うとこうです

          primitive '+',plus
          pop ax
          add bx,ax
          jmp next

The NASM macros to set up headers and maintain the linked list are pretty simple:

        %define link 0
        %define immediate 080h

        %macro head 4
        %%link dw link
        %define link %%link
        %strlen %%count %1
        db %3 + %%count,%1
        xt_ %+ %2 dw %4
        %endmacro

        %macro primitive 2-3 0
        head %1,%2,%3,$+2
        %endmacro

        %macro colon 2-3 0
        head %1,%2,%3,docolon
        %endmacro

        %macro constant 3
        head %1,%2,0,doconst
        val_ %+ %2 dw %3
        %endmacro

        %macro variable 3
        head %1,%2,0,dovar
        val_ %+ %2 dw %3
        %endmacro

Macro Examples

constant is used to define a Forth constant. E.g. to define false = 0:

        constant 'false',false,0

variable creates a Forth variable. E.g. to create base and initialise to 10:

        variable 'base',base,10

primitive sets up an assembly language word. E.g. to create drop:

        primitive 'drop',drop
        pop bx
        jmp next

colon defines a compiled Forth word. E.g. to define nip:

        colon 'nip',nip
        dw xt_swap
        dw xt_drop
        dw xt_exit

Register Allocation
レジスター割り当て

Itsy's use of the registers is similar to most 8086 Forths. The system stack is used for
the data stack while a register is used for the return stack. Note the top element of the
data stack is kept in a register to enhance performance:

Itsy が使用しているレジスターは8086用Forthの大部分と同様です。
システムスタックはデータスタックに使われ、リターンスタックにはレジスターを使います。
性能向上のためにスタックのトップ要素はレジスターに保持されている点に注意してください

    sp - data stack pointer
    bp - return stack pointer
    si - Forth instruction pointer
    di - pointer to current XT
    bx - TOS (top of data stack)

Itsy's Inner Interpreter
Itsyの内部インタープリター

The Forth inner interpreter needs only three simple routines:
Forth の内部インタープリターはたった三つの単純なルーチンしか必要としません

    docolon - the XT to enter a Forth word. Save the Forth IP on the return stack then point it
              to the word being entered.

              Forth ワードへ enter するためのXT。
              Forth IP を、リターンスタックに保存し、そのあとで実行するワードの指すように変更します

    exit    - return from a compiled Forth word. exit recovers the Forth IP from the return stack.
              コンパイル済み Forth ワードから復帰します。
              exit はリターンスタックから Forth IPを recover します

    next    - return from a primitive (machine code) word and call the next XT.
              プリミティブワード(機械語)から復帰し、次の XTを呼び出します

docolon dec bp
        dec bp
        mov word[bp],si
        lea si,[di+2]

next    lodsw
        xchg di,ax
        jmp word[di]

        primitive 'exit',exit
        mov si,word[bp]
        inc bp
        inc bp
        jmp next

Next we'll define approx 30 words and finally get the interpreter up and running. In the
meantime I'd love to hear any comments on the code so far :-)

Posted by John Metcalf

PDPだかVAX用のForthインタープリターの この docolon だとか next ってとんでもなく簡潔に書けるんだよねえ。 って上の86用のでも命令数少ないけど。

■_

■_ but

blog | Perlgeek.de :: Rakudo Hack: Dynamic Export Lists

Rakudo Hack: Dynamic Export Lists

Rakudo's meta programming capabilities are very good when it comes to objects, classes and
methods. But sometimes people want to generate subroutines on the fly and use them, and can't
seem to find a way to do it.

The problem is that subroutines are usually stored (and looked up from) in the lexical pad
(ie the same as my-variables), and those lexpads are immutable at run time.

Today I found a solution that lets you dynamically install subroutines with a computed name
into a module, and you can then use that module from elsewhere, and have all the generated
subroutines available.

module A {
    BEGIN {
        my $name = 'foo';
        my $x = sub { say 'OH HAI from &foo' }
                but role { method name { $name } };
        trait_mod:<is>(:export, $x);
    }
}

略

but ってナニ?

2012年04月12日

■_

数学セミナー、通勤途中にある書店では扱ってないのよねえ

■_

O'Reilly のコンピュータ本売り上げ解析と比較すると 興味深いものがある。ような気がする。 TIOBE : C overtakes Java as the No.1 programming language | Pixelstech.net

C overtakes Java as the No. 1 programming language in the TIOBE index. : programming

C overtakes Java as the No. 1 programming language in the TIOBE index. (pixelstech.net)


The stats are kind of irrelevant and the question is irrelevant. Is there a question?

For whatever reason, the TIOBE index seems to match our impressions of how the top programming
languages match up in terms of use. Most consider Java/C/C++/Python a top programming language,
e.g. used by a lot of people. And one could find more relevant data if they matched up book
sales and/or business interviews and surveys vs job hiring statistics, etc.

One could get a better look at what languages and how they are used. And most don't need the
stats because TIOBE seems to give an OK look at how the languages stack up.

For example, no one will believe that APL is the most popular language or Strongtalk. It won't
happen.

I feel that most people on reddit are concerned because they are wondering if their favorite
language X is ever going to move to the top spot. I see a lot of discussion of Haskell, Scala,
Clojure, Factor, Lua and for the unadventurous Python or Ruby. And they are wondering if they are
wasting their time if the industry is mostly using C/C++/C#/Java.

No, they/we aren't wasting our time but Haskell won't shift into the number one spot, possibly ever.

    C is still popular for things C is still used for (Example: Linux Kernel)
    Java is still popular for enterprise like web application development and other general purpose tasks
    C++ see C and add in desktop GUI application development.
    C#, see Java but MS oriented.
    Python/Ruby web application development, not necessarily for Enterprise

They're not completely meaningless. They might not have effect on you now, but if you were
to start looking for work, or trying to decide which new language to pick up, you might make
your decision in part of what language is going to make it easier to find a job.


TIOBE's ratings are told by an idiot algorithm, full of sound and fury, signifying nothing.


Probably written in C.


COBOL

Why is C more popular than C++?


    some very large popular projects like PostgreSQL and Linux, etc use c
    c is very convenient for python and ruby extensions
    c# and java are arguably a better tool for the job for many kinds of software that want a
    c-like-object-oriented language


I'm guessing lots of embedded projects also help keeping it popular.

■_ The Downfall of Imperative Programming

ここでの「downfall」は「没落」辺りにしておくのがよいのかな The Downfall of Imperative Programming | FP Complete

The Downfall of Imperative Programming. Functional Programming and the Multicore Revolution : programming

The Downfall of Imperative Programming. Functional Programming and the Multicore Revolution (fpcomplete.com)


Splitting things up into threads is one thing, but how do functional languages help with memory locality?


That's a really good question. There's only some initial thought going into that area, as far
as I know (or maybe there's a fair amount of theoretical work, but very little in terms of actual
implementation). One nice thing is that if you have memory that you know won't mutate, then you
don't have to worry about clones of that data. Similarly, to the extent that communication between
threads is always explicit, then you know a great deal about which memory never needs to be
touched by more than a single thread. Building compilers and runtimes to make good use of this
information is very much an open project, however.


The last major paradigm shift was OOP. It took off because it was the price of admission to GUI toolkits.

Once upon a time, Lisp was the price of admission to AI. It faltered when strong AI didn't pan out.

Functional programming will take off if/when it becomes the price of admission to something really
valuable. Current multi-core hardware and current tasks that can benefit from parallelism aren't
enough motivation to switch - we're still getting benefits from the embarrassingly parallel portions
of current problems.


How can it be the downfall of imperative programming if the main Haskell compilers are 
written in C? The JVM is written in C.... UNIX, Mac OS X(UNIX), Windows, Android, all 
written in C....

Every few years you get stupid announcements such as this one. "The end of 
Java", "the end of C"...

I am in love with Haskell and I am tryign to improve my knowhow of it daily, BUT I 
won't be stupid enough to predict the "downfall" of a kind of language just 
because Haskell is great.

actually I think GHC is written in Haskell


    GHC is itself written in Haskell (in a technique known as bootstrapping), but the runtime
    system for Haskell, essential to run programs, is written in C and C--.

Wiki

So you're both kind of right. And TIL about C--.


    Imperative programs will always be vulnerable to data races because they contain mutable variables.

Do they nececarily have to? Rust seems to be immutable by default, but I haven't really looked into it deeper.


Rust does have immutability by default, but mutability is common and easy to achieve. The real
protection against data races is that you can only access shared memory via unique references.
It uses channels for inter-task communication.

■_

色々と色々

2012年04月11日

■_

健康診断。

■_ JDK8

マイルストーンとか

InfoQ: JDK 8 Milestone and Release Dates

JDK 8 Milestone and Release Dates

Posted by Bienvenido David III on Apr 10, 2012

Oracle has posted in the jdk8-dev mailing list the JDK 8 milestone and release dates for review
and feedback. Mathias Axelsson, Oracle's release manager for the JDK, has proposed the following
dates for the JDK 8 development milestones.

    M1: April 24, 2012
    M2: June 14, 2012
    M3: July 30, 2012
    M4: September 11, 2012
    M5: November 26, 2012
    M6: January 30, 2013 (FC)

These are high-level buckets that can be targeted for delivering features and enhancements.
Details for each milestone has not been specified, but will be posted as soon as it is
available to help the early testing process. M6 is expected to be feature complete (FC). This
is when all features and new test development would be completed. Axelsson recommends the JDK
8 target release date of September 2013. This is to give at least as much time to stabilize
JDK 8 as was needed in JDK 7.

    GA: September 2013

以下略

まだ先と言えば先?

■_

■_

熱はないんだけど、インフルエンザだったりして と思わなくもない症状。


一つ前へ 2012年4月(上旬)
一つ後へ 2012年4月(下旬)

ホームへ


リンクはご自由にどうぞ

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