Implementing parts of stdlib in Haxe
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- cpp
- Ambito
- backend, build-system
Direzione di ricerca
Inizia esaminando le implementazioni esistenti di Sys, File e FileSystem, lo strumento di build hxcpp e i marshalling extern types utilizzati negli esempi. Determina come verrebbero compilati e memorizzati nella cache gli shared objects specifici della piattaforma e come verrebbe gestita la compatibilità tra le versioni di Haxe e le implementazioni di stdlib; l’issue non definisce criteri di accettazione per il completamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C++
- Stelle
- 330
- Fork
- 232
- Merge medio
- 3g 5h
- PR unite (30g)
- 3
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HaxeFoundation/hxcpp
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
HaxeFoundation/hxcpp#1217 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
HaxeFoundation/hxcpp#1432 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
HaxeFoundation/hxcpp#1431 ·
I maintainer di solito rispondono entro 1 giorno
-
Set up clang formatAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
HaxeFoundation/hxcpp#1430 ·
I maintainer di solito rispondono entro 1 giorno
-
Null<UInt> compared with null gives wrong results (null is cast to 0 by UInt's == / != overloads)Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 57/100
HaxeFoundation/hxcpp#1427 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di HaxeFoundation/hxcpp
Issue simili
-
[Bug] [Go] Ack returns nil when the server answers with a non-OK statusForse già presa @leizhiyuan l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
apache/rocketmq-clients#1465 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
KhronosGroup/Vulkan-Tutorial#534 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 2 giorni
-
bug IO
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MrNeRF/LichtFeld-Studio#3824 ·
I maintainer di solito rispondono entro 1 giorno
-
pnnx: manual tanh GELU fusion loses the approximation modeForse già presa @ktz03 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Tencent/ncnn#7175 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno