1 of 54

Internship at Haxe

1

2 of 54

About me

Aurel [ow - el]

2

r

3 of 54

Internship

4-year MEng degree

Required industrial placement

3

4 of 54

4

5 of 54

📨

can I work remotely pls?

kind regards, Aurel

5

6 of 54

6

7 of 54

7

8 of 54

Intern work

noun (also internship)

1 work that does not affect the productivity of the core team.

2 (also wasted time)work “for the benefit of the community”.

ORIGIN early 16th cent. (as an adjective in the sense ‘internal’): from French interne (adjective), interner (verb), from Latin internus ‘inward, internal’. Current senses date from the 19th cent.

8

9 of 54

Manual

9

10 of 54

10

11 of 54

11

12 of 54

Stdlib and Compiler

Improvements

12

13 of 54

Map.clear()

var map = new Map<String, Int>();�// add keys...�map = []; // clear keys

final map = new Map<String, Int>();�// add keys...�map = []; // error!

13

→ Haxe 4.0

14 of 54

UTC-based Date methods

date.getUTCHours();�date.getUTCMinutes();�date.getUTCSeconds();�date.getUTCFullYear();�date.getUTCMonth();�date.getUTCDate();�date.getUTCDay();�date.getTimezoneOffset();

14

→ Haxe 4.0

15 of 54

15

16 of 54

16

17 of 54

17

18 of 54

18

19 of 54

hxb

Binary format for serialising modules, AST, and typed AST

Specification:

github.com/Aurel300/hxb

WIP compiler branch:

github.com/HaxeFoundation/haxe/tree/hxb

19

→ Haxe 4.1 ?

20 of 54

asys

asynchronous system APIs

20

21 of 54

Current system APIs

No asynchrony (have to create threads manually)

Lacking file system functionality (e.g. chmod)

Hard-to-use TCP/UDP sockets

Hard-to-use processes

No IPC sockets

21

22 of 54

Solutions?

How to design the API?

How to implement it consistently across many different sys targets?

How to represent asynchrony?

22

23 of 54

23

24 of 54

24

25 of 54

libuv

25

26 of 54

26

27 of 54

27

eval

28 of 54

28

29 of 54

29

30 of 54

30

31 of 54

31

32 of 54

And similarly on HL and Neko

32

33 of 54

demo

Asynchronous file reading

33

34 of 54

demo

Asynchronous DNS and IP address manipulation

34

35 of 54

demo

TCP echo server

35

36 of 54

demo

Process communication with ffmpeg

36

37 of 54

demo

UDP video stream

37

38 of 54

asys

File system operations

TCP/UDP/IPC sockets

DNS

Processes

Message passing (including open sockets) across Haxe processes

38

39 of 54

soon™

39

40 of 54

asys

Haxe API: feedback welcome! (PR #8832)

Targets mostly finished™:� HashLink (#306)� Eval (#8831)� Neko (#201)

40

→ Haxe 4.1 ?

*

* better name?

41 of 54

Side project

ammer

41

42 of 54

42

43 of 54

43

Eval

Neko

HashLink

44 of 54

44

Eval

Neko

HashLink

45 of 54

45

Eval

Neko

HashLink

46 of 54

ammer

46

47 of 54

ammer

Under the hood:� Types mapped to target-native analogues� Functions accessed via automatically generated FFI� A Makefile is generated that handles native compilation (hdll, ndll)

47

48 of 54

ammer

API features:� Functions� Header defines� Opaque types (abstract pointers)

More planned, of course, e.g.:� Callbacks� Structs

48

49 of 54

ammer

Targets supported:� Eval *� HashLink� Hxcpp

Targets planned:� All sys targets!

github.com/Aurel300/ammer

49

50 of 54

50

Haxe

HashLink

Hxcpp

Eval

Java

Lua

Haxe compiler

FFI

Externs

FFI

Native library

ammer

51 of 54

demo

ammer in action!

51

52 of 54

Lua!

SDL?

Libuv?

OpenAL?

Dear-imgui?

52

53 of 54

Future work

HashLink GC

53

54 of 54

Thank you.

54