Haxe

Haxe
개발자Haxe 재단
발표일2005년(21년 전)(2005)
안정화 버전
4.3.7[1] 위키데이터에서 편집하기 / 2026년 5월 20일 (19일 전)
저장소
프로그래밍 언어OCaml
운영 체제안드로이드, iOS, 리눅스, macOS, 윈도우
플랫폼ARM; IA-32, x86-64
라이선스GPL 2.0, 라이브러리: MIT
웹사이트haxe.org

Haxe는 각기 다른 수많은 컴퓨팅 플랫폼을 대상으로 하나의 코드 기반으로 애플리케이션소스 코드를 생성할 수 있는, 고급 크로스 플랫폼 멀티 패러다임 프로그래밍 언어이자 컴파일러이다.[2][3][4][5] GNU GPL 버전 2로 배포되는 자유-오픈 소스 소프트웨어이며 표준 라이브러리의 경우 MIT 라이선스를 따른다.

언어

Haxe는 객체 지향 프로그래밍, 제네릭 프로그래밍, 다양한 함수형 프로그래밍 구조체를 지원하는 범용 목적의 언어이다. 반복, 예외 처리, 코드 반영 등의 기능들 또한 이 언어와 라이브러리의 내장 기능들이다.[6]

클래스

interface ICreature {
    public var birth:Date;
    public var name:String;

    public function age():Int;
}

class Fly implements ICreature {
    public var birth:Date;
    public var name:String;

    public function age():Int return Date.now().getFullYear() - birth.getFullYear();
}

열거형

enum Color {
    red;
    green;
    blue;
    rgb( r : Int, g : Int, b : Int );
}

class Colors {
    static function toInt ( c : Color ) : Int {
        return switch ( c ) {
            case red: 0xFF0000;
            case green: 0x00FF00;
            case blue: 0x0000FF;
            case rgb(r, g, b): (r << 16) | (g << 8) | b;
        }
    }
    static function validCalls() {
        var redint = toInt(Color.red);
        var rgbint = toInt(Color.rgb(100, 100, 100));
    }
}

익명(무명) 형식

typedef AliasForAnon = { a:Int, b:String, c:Float->Void };

함수형

typedef F = Int->String->Float;

typedef F2 = Int->String->F;
typedef F3 = Int->String->(Int->String->Float);

추상형

abstract Kilometer(Float) {
    public function new(v:Float) this = v;
}

abstract Mile(Float) {
    public function new(v:Float) this = v;
    @:to public inline function toKilometer():Kilometer return (new Kilometer(this / 0.62137));
}

class Test {
  static var km:Kilometer;
  static function main(){
    var one100Miles = new Mile(100);
    km = one100Miles;

    trace(km); // 160.935
  }
}

구조적 타이핑

class FooBar {

   public var foo:Int;
   public var bar:String;

   public function new(){ foo=1; bar="2";}

   function anyFooBar(v:{foo:Int,bar:String}) trace(v.foo);

   static function test(){
        var fb = new FooBar();
        fb.anyFooBar(fb);
        fb.anyFooBar({foo:123,bar:"456"});
   }
}

같이 보기

각주

  1. “Release 4.3.7”. 2025년 5월 9일. 2025년 5월 10일에 확인함. 
  2. “Nicolas' announcement of spelling change on Haxe official mail list”. 
  3. Ponticelli, Franco (2008년 2월 11일). 《Professional haXe and Neko》. Wiley. ISBN 0470122137. 
  4. Ivanov, Michael (2011년 5월 24일). 《Away3D 3.6 Cookbook》. Packt Publishing Ltd. ISBN 1849512817. 
  5. Doucet, Lars (2015년 6월 3일). “Haxe/OpenFL for home game consoles”. Gamasutra. 2015년 9월 8일에 원본 문서에서 보존된 문서. 2019년 7월 23일에 확인함. 
  6. “Haxe language reference”. 2012년 5월 2일에 원본 문서에서 보존된 문서. 

외부 링크

  • Haxe 위키데이터에서 편집하기 - 공식 웹사이트

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.