Skip to content

neimanpinchas/reflaxe_go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reflaxe/Golang

A compiler that compiles Haxe code into Golang using Reflaxe.

Alternative Name

  • Go-sharp: Once mature enough and easier to write than ancient Golang.

Why Target GoLang?

  • Great Performance vs. GC Balance
  • Excellent Solid Tooling
  • Faster Compilation than C++
  • Truly Cross-Platform (Windows, Linux, BSD, WASM, AVR, etc.)
  • Numerous Backend Libraries
  • Collaboration with go2hx
  • Static Binaries Easily Portable Between Distributions (Hardware Match Needed)
  • Go Routines (Supports Haxe's Sync Nature)
  • High-Speed Web Frameworks
  • Real Readable Output

How to Use

  1. Ensure go 1.20 is installed (1.18 for generics, 1.20 for random generator)
  2. Clone the repository using haxelib, or download locally and use with haxelib/lix dev.
  3. Add a reference to the library: -L reflaxe_go.
  4. Update the path to go_imports.exe in Generator.hx or define -D goimports in your HXML. (This is no longer required, it will install automatically, thanks to commit)
  5. Add -D go-output=haxe_out (or any subfolder you like).
    • Note: Currently, it will not generate a Go main function. You must create a main.go in your Haxe root directory and call the necessary main function.
  6. Add a matching -D pkg=haxe_out.
  7. Run haxe your.hxml.

Why Haxe+Golang > Golang

  • Real Generics (Array Methods)
  • String Interpolation
  • Everything is an Expression
  • Static Extensions
  • Real Dynamics (When Needed)
  • Pattern Matching
  • Familiarity with EcmaScript (through JavaScript)
  • Slim Client-Side Code Sharing (vs. Gopher/WASM)
  • Enums: ADT
  • Dynamic Methods
  • Struct Field Initializers

Derivations

  • Support Class Blacklist via Config File
  • Allow Explicit goimports via Meta
  • Json.parse is Generic, Not Dynamic (Type Inferences) Currently there is aseperate class haxe.Json2, you can use it as import haxe.Json2 as Json
  • Lang.go(()->{}) to call as go routine
  • Supporting Multi-Return Like Lua

Roadmap

Syntax support

Std

  • Implement enough for go_imports to work with go2hx (https://github.com/go2hx/go2hx)
  • Implement full non sys std
  • Implement full full sys.io.File and sys.FileSystem
  • Implement full sys.net
  • Implement full sys.db
  • Implement full sys

Correctness

  • Unit tests
  • Document usage
  • Document metas
  • Document defines

Beginner friendly

  • Automatic go_imports installation
  • Automatic main.go creation
  • Build a Beginner-Friendly Website for Golang Experts
  • go extern creator.
  • naive go class translator.

Minor Bugs

  • smartDCE Removes the Timer Class Even When Used

License

CC-BY-NC-ND

Creative Commons, Not commercial use, Must Attribute, ND

Why

Problem

Creating a successful compiler project is challenging due to the need for stability and widespread adoption. The complexity often leads to abandonment before reaching a usable state.

Solution

Offer early commercial users the ability to advance the roadmap by contributing code or donations. In exchange, feature their names and corporations prominently on the project front page for future generations. Provide binary exponential leverage to early contributors (e.g., the first milestone finishers' names in 64pt font, the next in 32pt, etc.). Developers receive a commercial non-distributing usage license. Proposals for new milestones can be voted on by all current developers, and resolving 10 issues counts as a milestone. Once complete, the work will be released under a common open-source license (MIT, GPL, or similar) based on a developer vote and legal options.

Credits

Contributors

We are grateful to the following people for their contributions:


Gold Contributors

Joey (PXShadow) https://github.com/PXshadow

Silver Contributors

[Your Name Here]

Bronze Contributors

[Your Name Here]

About

Compiler from haxe to go using reflaxe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published