I'm pretty sure people would ask me about this.
My personal experience covers:
- Ubuntu 12.04 LTS and newer releases since then
- ArchLinux (Antergos)
- Kubuntu
- Puppy
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).
// | |
// 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 | |
// | |
// |
package example; | |
import php7.Exception; | |
class TestSuper { | |
function new () {} | |
function superMethod () return [Std.random(2), Std.random(2)][Std.random(2)]; |
#!/usr/bin/env coffee | |
# Spoon code: | |
greet = name -> trace "Hello #{name}, how are you?" | |
greet "Person" | |
# Compiler result (fully working Haxe code): | |
# | |
# class Greet { | |
# static public function main() { |
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. |
from Sys import print | |
interface Greeter | |
function greet(name) | |
print "Hello #name" | |
end | |
end | |
class Person | |
include Greeter |
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 |
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) { |