-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.html
More file actions
88 lines (88 loc) · 18.4 KB
/
Copy pathIndex.html
File metadata and controls
88 lines (88 loc) · 18.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>go2hx</title>
<link rel="shortcut icon" href="logo.svg">
<meta property="og:title" content="go2hx"/>
<meta property="og:type" content="Website"/>
<meta property="og:url" content="https://go2hx.github.io"/>
<meta property="og:description" content="go2hx is a Go to Haxe compiler"/>
<meta property="og:image" content="logo.png"/>
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="512">
<meta property="og:image:height" content="512">
<meta property="og:image:alt" content="go2hx logo">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="go2hx">
<meta name="twitter:description" content="go2hx, The Go to Haxe compiler">
<meta name="twitter:image" content="logo.png">
<meta name="twitter:image:alt" content="go2hx logo">
<link href="prism.css" rel="stylesheet" />
<link rel="stylesheet" href="style.css" />
<style>
body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #0d1117;
}
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css">
<style>
.github-fork-ribbon:before {
background-color: #121612;
}
</style>
</head>
<body>
<script src="prism.js"></script>
<article class="markdown-body">
<img src="logo.svg" width="420" align="right"/><h1><font color="#357b99">go</font><font color="#cad0d8">2</font><font color="#e2ac3f">hx</font></h1>
<p><em>warning: experimental version.</em></p>
<p>Source-to-Source <font color="#357b99">Go</font> to <font color="#e2ac3f">Haxe</font> compiler.</p>
<p>Use <font color="#357b99">Go</font> libs with ease! <a href="./manual/getstarted.html"><strong>Get started!</strong></a></p>
<p><a href="https://haxe.org"><img alt="haxe" src="made-with-haxe.svg" /></a>
<a href="https://go.dev/"><img alt="go" src="https://forthebadge.com/images/badges/made-with-go.svg" /></a></p>
<p><a href="./manual/subset.html">What's supported?</a></p>
<p><a href="./manual/index.html">Manual</a></p><details><summary>Standard Library compatibility/api docs</summary><h1><a name="library-compilation-and-test-results">Library compilation and test results</a></h1><table><thead><th>module</th><th>compile</th><th>tests</th><th>cpp</th><th>hl</th><th>interp</th><th>jvm</th><th align="null"></th></thead><tbody><tr><td><a href="./stdgo/bufio/index.html">stdgo.bufio</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/bytes/index.html">stdgo.bytes</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/compress/zlib/index.html">stdgo.compress.zlib</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/crypto/internal/boring/index.html">stdgo.crypto.internal.boring</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/crypto/internal/boring/sig/index.html">stdgo.crypto.internal.boring.sig</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/crypto/internal/randutil/index.html">stdgo.crypto.internal.randutil</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/crypto/rand/index.html">stdgo.crypto.rand</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/crypto/sha1/index.html">stdgo.crypto.sha1</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/encoding/index.html">stdgo.encoding</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/encoding/base64/index.html">stdgo.encoding.base64</a></td><td>✅</td><td>yes</td><td></td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/encoding/binary/index.html">stdgo.encoding.binary</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/errors/index.html">stdgo.errors</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/flag/index.html">stdgo.flag</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/fmt/index.html">stdgo.fmt</a></td><td>✅</td><td>yes</td><td></td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/go/ast/index.html">stdgo.go.ast</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/constant/index.html">stdgo.go.constant</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/importer/index.html">stdgo.go.importer</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/internal/gccgoimporter/index.html">stdgo.go.internal.gccgoimporter</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/internal/gcimporter/index.html">stdgo.go.internal.gcimporter</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/internal/srcimporter/index.html">stdgo.go.internal.srcimporter</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/internal/typeparams/index.html">stdgo.go.internal.typeparams</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/printer/index.html">stdgo.go.printer</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/token/index.html">stdgo.go.token</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/go/types/index.html">stdgo.go.types</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/hash/index.html">stdgo.hash</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/index.html">stdgo.internal</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/abi/index.html">stdgo.internal.abi</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/buildcfg/index.html">stdgo.internal.buildcfg</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/bytealg/index.html">stdgo.internal.bytealg</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/cpu/index.html">stdgo.internal.cpu</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/diff/index.html">stdgo.internal.diff</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/fmtsort/index.html">stdgo.internal.fmtsort</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/fuzz/index.html">stdgo.internal.fuzz</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/goarch/index.html">stdgo.internal.goarch</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/goexperiment/index.html">stdgo.internal.goexperiment</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/goos/index.html">stdgo.internal.goos</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/oserror/index.html">stdgo.internal.oserror</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/pkgbits/index.html">stdgo.internal.pkgbits</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/poll/index.html">stdgo.internal.poll</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/reflect/index.html">stdgo.internal.reflect</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/reflectlite/index.html">stdgo.internal.reflectlite</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/syscall/unix/index.html">stdgo.internal.syscall.unix</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/testenv/index.html">stdgo.internal.testenv</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/internal/xcoff/index.html">stdgo.internal.xcoff</a></td><td>❌</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/io/index.html">stdgo.io</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/io/fs/index.html">stdgo.io.fs</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/log/index.html">stdgo.log</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/math/index.html">stdgo.math</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/math/bits/index.html">stdgo.math.bits</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/math/cmplx/index.html">stdgo.math.cmplx</a></td><td>✅</td><td>yes</td><td></td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/math/rand/index.html">stdgo.math.rand</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/os/index.html">stdgo.os</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/path/index.html">stdgo.path</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/reflect/index.html">stdgo.reflect</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/regexp/index.html">stdgo.regexp</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/regexp/syntax/index.html">stdgo.regexp.syntax</a></td><td>✅</td><td>yes</td><td></td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/runtime/index.html">stdgo.runtime</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/runtime/debug/index.html">stdgo.runtime.debug</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/sort/index.html">stdgo.sort</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/strconv/index.html">stdgo.strconv</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/strings/index.html">stdgo.strings</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/sync/index.html">stdgo.sync</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/sync/atomic/index.html">stdgo.sync.atomic</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/syscall/index.html">stdgo.syscall</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/syscall/js/index.html">stdgo.syscall.js</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/testing/index.html">stdgo.testing</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/testing/fstest/index.html">stdgo.testing.fstest</a></td><td>✅</td><td>yes</td><td></td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/testing/internal/testdeps/index.html">stdgo.testing.internal.testdeps</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/testing/iotest/index.html">stdgo.testing.iotest</a></td><td>✅</td><td>yes</td><td></td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/testing/quick/index.html">stdgo.testing.quick</a></td><td>✅</td><td>yes</td><td></td><td>❌</td><td>❌</td><td>❌</td></tr><tr><td><a href="./stdgo/time/index.html">stdgo.time</a></td><td>❌</td><td>yes</td><td></td><td></td><td></td><td></td></tr><tr><td><a href="./stdgo/unicode/index.html">stdgo.unicode</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/unicode/utf16/index.html">stdgo.unicode.utf16</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/unicode/utf8/index.html">stdgo.unicode.utf8</a></td><td>✅</td><td>yes</td><td></td><td>✅</td><td>✅</td><td>❌</td></tr><tr><td><a href="./stdgo/unsafe/index.html">stdgo.unsafe</a></td><td>✅</td><td>no</td><td></td><td></td><td></td><td></td></tr></tbody></table></details>
<details><summary>FAQ</summary>
<h2><a name="can-library-x-be-compiled?">Can library X be compiled?</a></h2>
<p>Maybe, to see if the library is supported at the moment <code>go get library_here</code> the library and then run:</p>
<pre><code class="prettyprint sh">go list -f '{{ .Imports }}' library here</code></pre>
<p>Then check to see if the standard libraries used are all passing with the compatibility table above.</p>
<h2><a name="does-the-compiler-support-go-as-a-haxe-target?">Does the compiler support <font color="#357b99">Go</font> as a <font color="#e2ac3f">Haxe</font> target?</a></h2>
<p>No and it's not within the scope of the project.</p>
<h2><a name="why-not-use-externs-instead-of-compiling-go-code-into-haxe?">Why not use externs instead of compiling <font color="#357b99">Go</font> code into Haxe?</a></h2>
<p>Because externs can target lock a code base and they require maintenance, abstraction code etc.</p>
<h2><a name="cgo-support?">Cgo support?</a></h2>
<p>Not available but planned and happily accepting contributions for it!</p>
<h2><a name="how-does-this-compare-to-gopherjs-or-go-wasm?">How does this compare to Gopherjs or <font color="#357b99">Go</font> wasm?</a></h2>
<p><font color="#357b99">go</font>2<font color="#e2ac3f">hx</font>'s design is built with <font color="#e2ac3f">Haxe</font> devs in mind, therefore the goals align with <font color="#e2ac3f">Haxe</font> dev advantages of the compiler, with that said go2hx does have some advantages already, smaller code generation, access to <font color="#e2ac3f">Haxe's</font> compiler tooling such as dce and optimizations, and <font color="#e2ac3f">Haxe</font> as a language being very portable, high level and statically typed.</p>
<h2><a name="what-internals-does-stdlib-use?">What internals does stdlib use?</a></h2>
<p><font color="#357b99">go</font>2<font color="#e2ac3f">hx</font>'s compiler, compiles the standard library packages for example <code>os</code>. After compilation a Patcher system switches out functions/variables/structs for a <font color="#e2ac3f">Haxe</font> equivalent, for example <code>os.Open</code> uses <code>sys.io.File.read</code> and <code>sys.io.File.write</code>.</p>
<p></details></p>
<h3><a name="contributing:">Contributing:</a></h3>
<p>The project is still at an experimental level, so expect undocumented problems to spring up.
<strong>The best way to contribute</strong> is to simply use the compiler on code you would like and inevitably run into errors. From there we can answer some questions to see:</p><details>
<summary>how to proceed!</summary>
<h2><a name="what-time-is-the-error-happening?:">What time is the error happening?:</a></h2><ul><li>go compiler time (<code>./export.go</code> named: go4hx)</li><li><font color="#e2ac3f">Haxe</font> compiler time (<code>src/Typer.hx</code> and <code>./stdgo/internal/reflect/Reflect.hx</code> etc)</li><li>compile time (<font color="#e2ac3f">Haxe</font> build tools example: <code>haxe build.hxml</code>)</li><li>runtime (Code running example: <code>hl build.hl</code> or <code>node build.js</code>).</li></ul>
<h2><a name="how-can-the-code-causing-the-error-be-reduced-to-a-simple-sample?">How can the code causing the error be reduced to a simple sample?</a></h2><ul><li>Use <code>./rnd/main.go</code> as a testbed and run it with: <code>haxe rnd.hxml</code></li><li>Modify the <font color="#357b99">go</font> code with debug prints or the <font color="#e2ac3f">Haxe</font> compiled code with traces and figure out where is the precise error point.</li><li>Copy over structs and interfaces if needed that are used by the erroring code sample.</li><li>Make usage of <font color="#357b99">go</font>2<font color="#e2ac3f">hx</font>'s reflection for example:</li></ul>
<pre><code class="language-go">println(reflect.TypeOf(value).String())</code></pre>
<h2><a name="does-the-code-throw-"not-implemented"-error?">Does the code throw "not implemented" error?</a></h2><ul><li>Look at the unimplemented function's <a href="https://pkg.go.dev/std">documentation</a></li><li>Implement the missing functionality into the Patcher <code>./src/Patch.hx</code> following the naming convention <code>path:FunctionName</code> or <code>path.Type:FunctionName</code> for <a href="./ast.html">recv functions</a>.</li></ul>
<h2><a name="is-the-type-casting-invalid?">Is the type casting invalid?</a></h2><ul><li>Look into <code>./src/Typer.hx</code> and search for <code>function checkType</code> for implicit type conversions and for casts <code>function castTranslate</code></li><li>A lot of helper type functions are called in <code>./stdgo/internal/reflect/Reflect</code> for example <code>getUnderlying</code> and the entire module is imported into <code>Typer.hx</code> so you won't see clear reference that the code is there.</li></ul>
<p></details></p>
<h4><a name="have-issues-and/or-want-to-contribute?">Have issues and/or want to contribute?</a></h4>
<p><a href="https://github.com/go2hx/go2hx"><img alt="github" src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white" /></a>
<a href="https://discord.gg/ewnMZAV"><img alt="discord" src="https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white" /></a></p>
</article>
</body>
</html>