Implementing parts of stdlib in Haxe
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- cpp
- 領域
- backend, build-system
調査の方向性
まず、既存の Sys、File、FileSystem の実装、hxcpp ビルドツール、および例で使用されている marshalling extern types を確認します。プラットフォーム固有の shared objects をどのようにビルドしてキャッシュするか、また Haxe のバージョンと stdlib の実装間の互換性をどのように扱うかを判断します。この issue では完了の受け入れ基準は定義されていません。
索引モデルが issue の本文から書いたものです。
説明
I've been playing around with the Win32 API with the new marshalling extern types and have been quite pleased with how painless and "just works" it's been. This got me thinking that it would be quite nice if we could write the implementation of stuff like the Sys, File, and FileSystem class in Haxe.
E.g. Here's two functions for the file system class.
class FileSystem {
public static function exists(path:String):Bool {
final count = Utf16.getByteCount(path);
final buffer = Scratch.alloc(count.toInt() + 2);
if (count != Utf16.encode(path, buffer.view)) {
throw new Exception("Failed to encode string to UTF16");
}
return Shell.pathFileExists(buffer.view.reinterpret().ptr);
}
public static function isDirectory(path:String):Bool {
final count = Utf16.getByteCount(path);
final buffer = Scratch.alloc(count.toInt() + 2);
if (count != Utf16.encode(path, buffer.view)) {
throw new Exception("Failed to encode string to UTF16");
}
final result = FileApi.getFileAttributes(buffer.view.reinterpret().ptr);
if (result == FileApi.invalidFileAttributes) {
throw new Exception("Failed to get file attributes");
}
return (result & FileApi.fileAttributeDirectory) != 0;
}
}
and one for the sys class
class Sys {
public static function getEnv(v:String):String {
final nameCount = Utf16.getByteCount(v);
final nameBuffer = Scratch.alloc(nameCount.toInt() + 2);
if (nameCount != Utf16.encode(v, nameBuffer.view)) {
throw new Exception("Failed to encode string to UTF16");
}
final envCount = Win32.getEnvironmentVariable(nameBuffer.view.reinterpret().ptr, null, 0);
final envBuffer = Scratch.alloc(envCount * 2);
if (envCount != Win32.getEnvironmentVariable(nameBuffer.view.reinterpret().ptr, envBuffer.view.reinterpret().ptr, envCount)) {
throw new Exception("Return value was not the expected size");
}
return Utf16.decode(envBuffer.view);
}
}
Obviously this raises lots of questions, such as
- The hxcpp build tool would probably need to build and cache shared platform specific obs which are linked with user code (e.g. hxcpp-file-win32.obj, hxcpp-sys-unix.obj).
- Managing compatibility between haxe versions and std lib implementations in hxcpp could be tricky.
- Many other things.
I have given these no thoughts yet so don't have any answers, I'm not even sure if it's really worth it in the end. But in general I'm in favour of less C++ and I think the new marshalling types gives us a nice path to have that.
- 主要言語
- C++
- スター
- 330
- フォーク
- 232
- 平均マージ
- 3日 5時間
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
HaxeFoundation/hxcpp のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
HaxeFoundation/hxcpp#1217 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
HaxeFoundation/hxcpp#1432 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
HaxeFoundation/hxcpp#1431 ·
メンテナーはふだん 1 日以内に返信
-
Set up clang formatオープン
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
HaxeFoundation/hxcpp#1430 ·
メンテナーはふだん 1 日以内に返信
-
Null<UInt> compared with null gives wrong results (null is cast to 0 by UInt's == / != overloads)オープン
難易度 4/5 1〜2日 初心者へのやさしさ 57/100
HaxeFoundation/hxcpp#1427 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
HaxeFoundation/hxcpp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
notepad-plus-plus/notepad-plus-plus#18553 ·
メンテナーはふだん 1 日以内に返信
-
bug docs performance
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 3 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
good first issue neural P2
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100