Filesystem Library Design

Introduction
Requirements
Realities
Rationale
Abandoned_Designs
References

Introduction

Filesystem Library として始めることになった最初のきかっけは、Boost 管理ツールとしての失敗からであった。いくつものスクリプトは Python, Perl, Bash と Windows コマンド記述言語によって書かれていた。それらはただ 1 つのありふれたスクリプト言語でなかったため、全ての Boost 管理者たちに受け入れられた。すでに彼らは C++ プログラマとしてのスキルをもった人たちであったが、なぜ C++ はスクリプト言語として使われなかったのか?

The primary motivation for beginning work on the Filesystem Library was frustration with Boost administrative tools.  Scripts were written in Python, Perl, Bash, and Windows command languages.  There was no single scripting language familiar and acceptable to all Boost administrators. Yet they were all skilled C++ programmers - why couldn't C++ be used as the scripting language?

C++ の将来像はスクリプトのようなアプリケーションに不可欠であるディレクトリなどを含んだ移植性のあるファイルシステム操作ができることである。Filesystem Library は、それらをみたすものとして開発された。

The key feature C++ lacked for script-like applications was the ability to perform portable filesystem operations on directories and their contents. The Filesystem Library was developed to fill that void.

目的は伝統的なスクリプト言語に匹敵することではなかったが、C++ をいつも言語の選択肢としてあげる機会をもたらした。

The intent is not to compete with traditional scripting languages, but to provide a solution for situations where C++ is already the language of choice..

Requirements

Realities

Rationale

RequirementsRealities は、たくさんの C++ インターフェスデザイン上で進められた。特に、分かりやすいスクリプト系のコードが作る期待は大量のどうやら予期されていたような exists( "foo") のような単純な表現を確実にする効果を引き起こした。

The Requirements and Realities above drove much of the C++ interface design.  In particular, the desire to make script-like code straightforward caused a great deal of effort to go into ensuring that apparently simple expressions like exists( "foo" ) work as expected.

論理的基礎はたくさんデザインの議論の詳細の背景にあることを FAQ を参照せよ。

See the FAQ for the rationale behind many detailed design decisions.

洞察力キーのいくつかは path クラス設計の内部に進んでいた。

Several key insights went into the path class design:

エラー検査していることは特に別領域になってしまう。一つのキーの洞察力はファイルやディレクトリの名前と移植性のある一般的な事実ではないことと共にあった。多少、プログラマーはどんなオペレーティングシステムに移植性があることを望んでいるのかという質問について考え抜かなければならない。この質問に対するいくつかの答えを提供しているものとして、Filesystem Library は最初の任務を要求する必要性をプログラマーたちに警告を出している。

Error checking was a particularly difficult area. One key insight was that with file and directory names, portability isn't a universal truth.  Rather, the programmer must think out the question "What operating systems do I want this path to be portable to?"  By providing support for several answers to that question, the Filesystem Library alerts programmers of the need to ask it in the first place.

Abandoned Designs

operations.hpp

Dietmar Khl 氏の独自の dir_it デザインと実装はファイルやディレクトリ名にワイド文字をサポートした。それは Library Working グループのメンバーの中にあった広範囲な議論はシステム上でワイド文字名は自然にサポートされていないという移植の意味論を識別する上で失敗した前に放棄された。FAQ を参照せよ。

Dietmar Khl's original dir_it design and implementation supported wide-character file and directory names. It was abandoned after extensive discussions among Library Working Group members failed to identify portable semantics for wide-character names on systems not providing native support. See FAQ.

インターフェース設計の相互作用の前にコンパイル時間あるいは実行時間がないオプションによって多数の便利な操作を提供している。それらは使うのにとても混乱してインターフェースとしてはるかに大きい機能名と同数存在していた。どんな利点も現実であるというのではなく理論的に見えた。

Previous iterations of the interface design used explicitly named functions providing a large number of convenience operations, with no compile-time or run-time options. There were so many function names that they were very confusing to use, and the interface was much larger. Any benefits seemed theoretical rather than real.

設計はコンパイル時間(実行時間でなく)フラグとオプション選択 (via ポリシー, enum あるいは int テンプレート引数) を元にすることはとてもちょっとした時間と努力を発明している後にしばしば放棄されたといった複雑ものになってきている。名前空間やエイリアスを用いた属性やオプション名の必要性は、現実的なコードを書いている現実を完全に評価できないテンプレート引数に不格好なものとして使われている。

すでに便利な機能セット(例えば 許容的な 削除, 簡潔にする 不法奪回, 他の操作, 加えて述べる, そして可能な他のもの, 未来に広々に広がる ) は詳細が複雑で議論を起こしたものになったという理由から放棄された。

Designs based on compile time (rather than runtime) flag and option selection (via policy, enum, or int template parameters) became so complicated that they were abandoned, often after investing quite a bit of time and effort. The need to qualify attribute or option names with namespaces, even aliases, made use in template parameters ugly; that wasn't fully appreciated until actually writing real code.

Yet another set of convenience functions ( for example, remove with permissive, prune, recurse, and other options, plus predicate, and possibly other, filtering features) were abandoned because the details became both complex and contentious.

どちらのユーザからの低いレベルで操作するツールキットは左にあるどんなものでも便利な操作より複雑に創造することができる。加えて、正当に含まれているものとして十分十分役に立つ少数の便利な機能が見つかっている。

What is left is a toolkit of low-level operations from which the user can create more complex convenience operations, plus a very small number of convenience functions which were found to be useful enough to justify inclusion.

path.hpp

たくさんの破棄されたパス設計があったが、私は進路を失ってしまった。いくつかの風味の中でポリシーを元にしたクラステンプレートは、コンストラクタはランタイムポリシーを供給しており、ランタイムポリシー独自の操作系、それらは全て考慮されているが、まれに実装されたものや小さな利益に気がつくとはあまりにも複雑になったものとして結局破棄されている。

There were so many abandoned path designs, I've lost track. Policy-based class templates in several flavors, constructor supplied runtime policies, operation specific runtime policies, they were all considered, often implemented, and ultimately abandoned as far too complicated for any small benefits observed.

error checking

エラー検査機能のためデザインの数は実装による試みの前に破棄されてしまった。完全自動エラー検査は特に試みられた。しかし、自動エラー検査はさらに複雑となった全般的なライブラリ設計を作る傾向になっていったのである。

A number of designs for the error checking machinery were abandoned, some after experiments with implementations. Totally automatic error checking was attempted in particular. But automatic error checking tended to make the overall library design much more complicated.

いくつかのでデザインはパスを用いたエラー検査機構を結合させた。ポリシーを元にしたエラー検査テンプレート設計は部分的に実装され、日常のスクリプト系プログラムのためにますます複雑なものとなり破棄されていったのである。

Some designs associated error checking mechanisms with paths.  Some with operations functions.  A policy-based error checking template design was partially implemented, then abandoned as too complicated for everyday script-like programs.

最終的なデザインはより単純でまっすぐなものとしてエラー検査機能呼び出しを独自の上で部分的に依存している。プログラマー訓練の上でのさまざまな拡張に依存している。しかし彼らのプログラムは選ばれたターゲットシステム上で正確に動作する合理的に確かなことした移植性について気にかけているプログラマーは好まれるべきである。

The final design, which depends partially on explicit error checking function calls,  is much simpler and straightforward, although it does depend to some extent on programmer discipline.  But it should allow programmers who are concerned about portability to be reasonably sure that their programs will work correctly on their choice of target systems.

References

[IBM-01] IBM Corporation, z/OS V1R3.0 C/C++ Run-Time Library Reference, SA22-7821-02, 2001, http://www-1.ibm.com/servers/eserver/zseries/zos/bkserv/

[ISO-9660] International Standards Organization, 1988.

[POSIX-01] Open Group, IEEE Std 1003.1-2001 [AKA POSIX], 2001, http://www.opengroup.org/onlinepubs/007904975/toc.htm

[Wulf-Shaw-73] William Wulf, Mary Shaw, Global Variable Considered Harmful, ACM SIGPLAN Notices, 8, 2, 1973, pp. 23-34


© Copyright Beman Dawes, 2002

Revised 03 January, 2003