Skip to content

Instantly share code, notes, and snippets.

View PeyTy's full-sized avatar
🍵
Sipping my tea [:

Miraculous Ladybugreport PeyTy

🍵
Sipping my tea [:
View GitHub Profile

Hi! This is my idea about the feature I want to add into my own language Hexa* and especially Zig** (because it fits Zig very well!).

* not promoting Hexa here, really want Zig to fight Rust "monopoly" on safe memory management

** very unlikely that I will implement it myself, hopefully someone will be yakbaited

I was evaluating usage of Zig for my projects and never liked the absence of any assisted memory managemnt (defer is not really a solution to complex memory issues but it doesn't matter on the subject) (and Rust is too annoying to deal with).

@andrewrk
andrewrk / microsoft_craziness.h
Created September 1, 2018 14:35
jonathan blow's c++ code for finding msvc
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//
@RealyUniqueName
RealyUniqueName / Test.hx
Created August 13, 2016 03:17
New php generator for Haxe
package example;
import php7.Exception;
class TestSuper {
function new () {}
function superMethod () return [Std.random(2), Std.random(2)][Std.random(2)];
@rygorous
rygorous / gist:e0f055bfb74e3d5f0af20690759de5a7
Created May 8, 2016 06:54
A bit of background on compilers exploiting signed overflow
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those
mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but
I think it's useful to know what compiler writers are accomplishing by this.
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some
fairly common cases. The signed overflow UB exploitation is an attempt to work around this.
@deathbeam
deathbeam / Errors.md
Last active November 23, 2015 00:58
Here is compiler output for same error in 4 different supported output formats for my new language

Below is error output of compiler trying to compile this file (as I lexed the multiline comment, but I do not consumed it in parser).



###
aaa
###

Switching between different error outputs is simple as passing --error json when running from command-line.

# Pythonic module system
from Sys import print
# Annotations and generic types
\:generic
class MyValue<T>
# Fat arrow closures means no implicit return
new = (value : T) =>
@value = value
@nadako
nadako / Main.hx
Created June 24, 2015 19:36
Haxe + SDL = native love \o/
class Main {
static function main() {
Sdl.init(Sdl.INIT_EVERYTHING);
var win = Sdl.createWindow("Hello", 100, 100, 800, 600, Sdl.WINDOW_OPENGL);
var ren = Sdl.createRenderer(win, -1, Sdl.RENDERER_ACCELERATED);
var bmp = Sdl.loadBMP("test.bmp");
var tex = Sdl.createTextureFromSurface(ren, bmp);
Sdl.freeSurface(bmp);
for (i in 0...3) {
@ousado
ousado / Test.hx
Last active May 9, 2016 19:38
GADT typed Anons/Classes/
typedef DTag = Tag<Dynamic>; // kind of a defeat, but OK..
typedef Fruit = { tag: TagE<Fruit>, name: String, count: Int }
typedef Beverage = { tag: TagE<Beverage>, name: String, brand: String, liters: Float};
@:enum abstract TagE<T>(Int) {
var fruit: TagE<Fruit> = 1;
var beverage:TagE<Beverage> = 2;
}
typedef Tag<T> = { tag:TagE<T> };
anonymous
anonymous / dasda.hx
Created January 29, 2015 17:38
package;
import haxe.io.Bytes;
import haxe.io.BytesInput;
import haxe.io.BytesOutput;
import haxe.Resource;
import format.abc.Data;
using Main;
class Main {
@gamedevsam
gamedevsam / Config.hx
Last active September 11, 2016 03:51
Haxe Toml Configs
package ;
import flixel.FlxG;
import flixel.addons.nape.FlxNapeState;
import toml.TomlConfig;
/**
* ...
* @author Sam Batista
*/