This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _lambda_param(index, ARG) id ARG, | |
#define _lambda_last_param(arg) id arg | |
#define _lambda_1_(statement) ^id(){ return statement; } | |
#define _lambda_2_(arg, statement) ^id(id arg){ return statement; } | |
#define _lambda_gt2_(...) ^id( metamacro_foreach( \ | |
_lambda_param,,metamacro_take(metamacro_dec(metamacro_dec(metamacro_argcount(__VA_ARGS__))), __VA_ARGS__)) \ | |
_lambda_last_param(metamacro_at(metamacro_dec(metamacro_dec(metamacro_argcount(__VA_ARGS__))), __VA_ARGS__)) \ | |
){ return metamacro_at(metamacro_dec(metamacro_argcount(__VA_ARGS__)), __VA_ARGS__); } | |
#define lambda(...) \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
{ | |
} | |
class B extends A | |
{ | |
} | |
class HaxeTest | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HXML = ENV["hxml"] | |
module TextFileUtil | |
attr_accessor :file | |
def file_lines | |
File.open(@file).readlines | |
end | |
def file_dir | |
File.dirname @file | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.devboy.hxTask; | |
import neko.Lib; | |
import haxe.macro.Context; | |
import haxe.macro.Expr; | |
import haxe.macro.Type; | |
class ComponentMacro | |
{ | |
private static var idCount = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright (C) 2011 by Dominic Graefen / http://devboy.org | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doMath = function( x: Int, y: Int, operation: Int->Int->Int ) | |
{ | |
return operation( x, y); | |
} | |
Lib.println( doMath( 10, 20, Funk.d( _ * _ ) ) ); // 200 | |
//Lib.println( doMath( 10, 2, Funk.d( _ / _ ) ) ); // error because of int float issues | |
Lib.println( doMath( 10, 20, Funk.d( _ + _ ) ) ); // 30 | |
Lib.println( doMath( 10, 20, Funk.d( _ - _ ) ) ); // -10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var point: { x: Int, y: Int }; | |
var pointA3D: { x: Int, y: Int, z: Int } = { x:10, y:10, z:10 }; | |
var pointB3D = { x:10, y:10, z:10 }; | |
point = pointA3D; // this works fine, as the type is set | |
point = pointB3D; // error: { z : Int, y : Int, x : Int } has extra field z | |
point = { x:10, y:10, z:10 }; // { z : Int, y : Int, x : Int } has extra field z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var circle: { x: Int, y: Int, radius: Int } = { x: 10, y: 10, radius: 10 }; | |
var rect: { x: Int, y: Int, width: Int, height: Int } = { x: 20, y: 20, width: 100, height: 100 }; | |
function move( objectWithXAndY: { x: Int, y: Int } ) | |
{ | |
objectWithXAndY.x += 5; | |
objectWithXAndY.y += 5; | |
} | |
move( circle ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef Position = { x: Float, y: Float }; | |
var point: Position = new Point(10, 10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var point: { x: Float, y: Float } = new Point(10,10); |