►
Description
Rust Cologne User Group - Meetup September 2016
More on http://rust.cologne/2016/09/05/compile-to-js.html
Help us caption & translate this video!
http://amara.org/v/2Fib/
A
So
I
will
talk
to
you
about
how
to
compile
rest
to
the
browser
that
might
sound
a
bit
weird
now.
It
also
sounds
through
yet
later,
but
we
will
see
how
it
works
at
least
I'm.
First
warning
there
will
be
a
few
gifts,
I
hope,
you're,
all
don't
have
a
problem
with
that
level
also
be
tweets,
but
just
for
fun.
A
So
first,
there
was
only
HTML
for
displaying
websites
in
the
browser
right,
so
you
could
display
a
pretty
static
content
and
only
later
the
browsers
gains
the
possibility
to
have
some
dynamic
user
interaction
and
that
will
stand
through
using
javascript
a
language
that
was
implemented
in
just
a
few
days,
and
we
can
still
see
that
from
time
to
time
in
the
language.
But
that's
not
what
I'm
going
to
talk
about
and
more
gonna
focus
on
where
we
got
Cynthia
all
days.
A
But
later
we
got
some
really
high
performance,
JavaScript
engines
that
made
the
stuff
even
worse,
well
to
build
huge
applications
in,
and
today
we
have
applications
like
your
emails
are
probably
somewhere
in
the
browser
as
well
like
Gmail
or
whatever
mail
provider
you
use.
There
is
a
full
office
suite
in
the
browser.
You
can
build
the
presentations
in
your
browser.
You
can
do
music,
you
can
even
connect
to
bluetooth
devices.
You
can
basically
do
nearly
everything
with
JavaScript
by
now,
and
this
is
a
lot
to
do
with
how
the
engines
that
execute
your
JavaScript
got.
A
Optimized
and
one
thing
that
came
to
be
just
after
the
now
known
engines
were
released
in
about
2008
and
2009
M
scripting
was
started
or
just
basically
a
program
that
takes
whatever
comes
out
of
LLVM
and
ports.
The
or
translates
this
to
JavaScript,
and
this
allows
you
to,
for
example,
take
C
or
C++
and
run
that
on
the
web
at
near
full-time
speed
compared
to
if
you
compiled
it
natively
and
run
it
natively.
A
This
there's
a
whole
lot
of
code
in
this
project,
but
actually
the
smallest
part
of
it
is
the
compiler,
because
actually
transpiling
from
LLVM
to
something
else
seems
quite
easy,
but
the
optimizations
you
have
to
do
on
the
LLVM
or
in
the
generated
code.
It
is
what
takes
the
most
of
the
code.
So
now
you
might
ask
why
$1?
Why
do
we
want
to
do
this?
Well?
A
Compiling
to
the
web
actually
brings
a
few
advantages.
The
first
is
J.
Javascript
is
actually
a
standard
that
we
can
follow
and
that
is
implemented
nearly
everywhere
and
that
one's
everywhere
your
phone
wants
it.
The
laptop
runs
it
even
your
server
can
run
it
and
whatever
device
in
between
you
can
imagine,
it
can
probably
run
some
form
of
JavaScript.
There
are
even
Miku
controllers
out
there
that
one
new
JavaScript,
so
that's
actually
a
pretty
good
target
to
compile
for
because
we
can
run
it
everywhere.
A
I'm,
not
saying
that
it's
actually
good
language
to
run
everything
in,
but
we
have
to
deal
with
what
we
have
now
and
also
more
and
more
stuff
is
moving
to
the
web.
As
I
said
before,
we
have
the
big
applications
that
you're
already
used
in
your
browser,
and
all
this
is
actually
a
pretty
big
code.
And
often
there
are
applications
that
existed
before,
but
the
cost
of
porting
this
to
native
JavaScript
are
often
quite
high.
A
So
what
you
want
to
do
is
just
take
the
existing
project,
compile
it
to
JavaScript
and
just
run
it
in
the
browser,
and
the
third
thing
is
that
we
can
just
reuse
native
libraries,
especially
now
that
we
got
more
applications
in
the
browser.
We
probably
want
to
reuse
what
we
have
already,
for
example,
a
crypto
libraries
or
libraries
for
image,
processing
or
audio
processing
or
stuff.
A
That
was
already
there
in
the
world
where
we
have
natively
compiled
binaries,
so
M
scripting
all
provided
this
by
taking
your
seat,
kote,
pushing
it
through
LLVM
and
giving
you
some
javascript
code.
So
it
turns
out
the
JavaScript
code
that
M
script
and
outputs.
You
can't
really
read
it.
You
won't
understand
the
most
parts
of
it,
and
that
is
because
it's
using
a
pretty
low-level
subset
of
JavaScript
and
this
subset
actually
was
later
suspended
as
ice
or
at
least
specified
in
what's
now
called
a
SMGs.
A
Smgs
is
basically
a
subset
of
all
of
JavaScript,
which
gives
you
certain
guarantees
about
how
the
code
looks
and
how
it
behaves.
This
actually
now
allows
browsers
to
optimize
for
exactly
the
code
that
is
expected
and,
for
example,
Firefox
can
take
this
code
if
it's
annotated
correctly
and
compile
it
ahead
of
time.
So
you
don't
have
the
just-in-time,
compiler
uf
for
other
engines,
so.
A
As
M
code
is
very
simple
and
low
lever
and
therefore
it
should
be
easy
right.
Well,
it's
certainly
not.
That
has
a
lot
to
do
with
how
JavaScript
itself
works,
but
some
parts
of
it
are
actually
easy
to
understand.
For
example,
the
a
SMGs
makes
JavaScript
implicitly
typed,
so
basically
JavaScript
only
has
a
very
basic
amount
of
types
which
is,
it
has
doubled,
it
has
strings
and
it
has
some
objects,
but
from
apart
from
that,
there
is
no
real
type.
A
So
the
thing
is,
if
you
have
an
as
we
have
some
number
and
do
a
binary
or
operation
with
zero,
the
number
won't
change.
But
what
will
happen
here
is
that
the
engine
executing
the
JavaScript
it
will
understand
what
you're
doing
and
because
binaries
don't
binary
operations,
don't
make
sense
on
floats
or
doubles.
A
A
So
we
talked
a
lot
about
how
to
use
memory
before,
and
the
the
memory
model
in
C
or
in
LLVM
is
actually
pretty
simple.
We
have
some
big
large
memory,
we
can
point
to
and
take
or
assign
values
to,
and
we
can
have
pointers
somewhere
and
just
do
arithmetic
on
it
and
put
point
somewhere
else.
If
we
do
it
right,
we
will
just
land
in
the
right
parts
of
the
buffer
and
it
will
just
work.
A
If
we
just
do
a
calculation
off
by
one,
we
will
probably
break
our
code,
but
in
case
we're
doing
it
right,
we
will
get
some
pretty
efficient
code.
For
example,
this
is
an
primitive
implementation
of
the
string
length
function
in
C.
What
we
basically
need
to
do
is
we
get
a
pointer,
we
get
a
pointer
and
we
just
increase
the
pointer
until
we
reach
the
null
byte.
Not
strings
and
C
are
always
terminated
with
a
null
and
then
later
just
subtract.
A
What
a
SMGs
actually
does
it
emulates
the
heap
were
just
allocating
one
large
buffer
of
space,
and
the
pointers
are
now
just
integers,
pointing
into
this
array
and
from
there
we
can
do
the
same
calculations
on
pointers.
We
can
check
for
the
values
at
certain
points.
We
can
just
iterate
through
everything
until
we
reach
the
null
byte
and
then
calculate
the
difference
again,
apart
from
being
quite
similar
to
the
c
model
and
those
just
translating
the
c
model
of
memory
management
into
javascript.
A
We
have
another
advantage
here,
at
least
for
some
programs,
and
that
is
the
garbage.
Collector
has
nothing
to
do
this.
It
only
sees
one
large
array
which
it
won't
remove
because
there's
always
a
reference
to
it.
This
is
this
can
be
quite
wasteful
for
short
running
programs,
because
there's
always
one
large
buffer,
but
for
long-running
programs
that
actually
use
most
of
the
memory.
This
is
quite
efficient
because
we
don't
have
to
rely
on
an
additional
memory
management
on
top
of
what
our
original
application
does
anyway.
A
A
So
what
I
now
showed
you
is
the
a
SMGs
part
that
is
already
implemented
and
it
works
by
using
M
script.
There
are
other
implementation
that
also
can
translate.
Llvm
I,
don't
have
the
names
on
my
head
right
now,
but
they
follow
a
quite
similar
model,
just
different
implementation
of
the
back
ends,
but
that
works
right
now.
A
Which
now
brings
us
to
pep
assembly
represent,
is
actually
a
new
portable
size
and
low
time,
efficient
format
suitable
for
compilation
to
the
web.
Well,
that's
quite
a
bit,
let's
strip
that
down
first
rap
assembly
is
a
new
format
suitable
for
compilation
to
the
web.
That's
basically
what
what
their
sensor
is.
A
It's
a
new
format
that
we
can
compile
to
and
that
should
just
run
the
same
as
JavaScript
and
we
actually
had
similar
things
before
we
had
flesh.
We
had
Java
applets
and
we
had
other
plugins
that
were
integrated
into
the
browser
and
executed
some
code.
So
you
might
think
what
is
actually
better
this
time.
A
Well,
this
time
the
browser
renders
meat
first
and
talked
about
what
they
actually
want.
They
also
talked
about.
Can
we
just
implement
that
in
JavaScript?
Can
we
maybe
implement
that
in
SMGs?
Do
we
just
need
to
add
more
api's
to
JavaScript
and
the
Dom,
or
do
we
actually
need
a
new
format
to
make
this
happen
and
well
I
do
love
some
hypothetical
future
of
Epis
Emily.
A
The
working
group
working
on
rep
assembly
is
just
a
year
old,
but
they
have
pretty
strong
goals
to
move
achieved
and
they
already
reached
one
of
their
goals,
which
is
there
is
working,
represent
interpreters
in
both
Chrome
and
Firefox.
You
just
have
to
enable
them.
I
can
show
you
later
how
that
goes,
but
they
already
work
and
they
can
already
interpret
pep
assembly
in
the
way
they
want
it.
A
There
are
a
lot
of
features
missing,
but
the
basic
proof
of
concept
that
it
actually
works
and
brings
advantages,
is
there
I
just
had
to
include
that
I
want
to
define
the
slide
where
actually
fits,
but
I
did
so.
Let's
take
a
look
at
Beck
assembly
where
assembly
is
defined
as
an
abstract,
syntax
tree,
defining
modules
of
code.
Well,
you
actually
define
which
functions.
Do
you
export?
You
define
functions,
the
input,
types
and
the
output
type,
and
then
the
operations
they
actually
perform.
A
Well,
I
often
like
to
say:
well,
this
is
more
or
less
just
like
Lisp
again
right.
So
while
we
saw
the
we
saw
the
simple
text,
representation
of
that
that
doesn't
bring
much
improvement
from
having
JavaScript
in
the
first
place,
because
we
still
need
to
parse
it.
It
still
needs
to
make
sure
that
it
validates,
and
it
has
a
lot
of
overhead
that
we
don't
need.
A
A
So,
instead
of
writing
e
32.8,
we
have
just
one
byte
specifying
which
operation
that
is
this
makes
it
really
really
fast
to
parse,
because
we
can
just
go
through
it
check
that
the
operations
match
from
what
we
expect
and
we
don't
have
to
check
that
we
have
all
the
parents's
and
such
stuff
and
they
make
some
samples
some
benchmarks
on
how
much
faster
this
actually
is,
and
it
turns
out
compared
to
pure
JavaScript
parsing
parsing.
The
binary
format
is
at
least
or
it
is
20
times
faster
than
just
pausing.
A
The
JavaScript
so
from
the
parsing
side,
we
already
get
quite
an
improvement
there
and
what
they
also
wanted
to
have
is
that,
even
though
this
is
binary,
there
will
always
be
a
one-to-one
translation
to
the
text
format.
So
we
will
always
be
able
to
get
some
text
format,
however
unreadable,
but
that
should
give
you
at
least
the
basic
source
code
that
you
can
still
work
with,
like
it's
the
same
as
JavaScript,
a
lot
of
JavaScript
out,
there's
already
minified
or
somehow
somehow
else
obfuscated,
but
you
still
have
access
to
the
source.
A
You
could
modify
it
or
D
obfuscated,
even
if
I
it
and
work
from
that.
The
same
is
here
the
case
we
don't
want
to
have
a
pure
binary
format
that
one
can
ever
interact
was
apart
from
the
ones
that
actually
want
a
high
level
quote.
First,
and
as
mentioned,
there
is
no
native
support
in
Chrome
and
Firefox,
so
you
can't
actually
test
it
out.
A
A
Smgs
is
still
a
subset
of
JavaScript,
so
it
is
respected
to
the
syntax
that
is
there.
It
can't
introduce
anything
else
besides
applying
operation
and
saying
that
this
is
now
sort
of
a
certain
type,
and
it
also
is
quite
strict
in
how
we
can
apply
out
of
time
compilation
in
the
SMGs
case.
We
always
need
to
enter
Tait
code,
so
we
know
that
it
can
be
pre-compiled,
but
in
the
case
of
rep
assembly
we
have
one
spec
format.
We
know
we
can
always
free
compile
because
it
won't
change
at
one
time.
A
It
simply
does
not
have
the
functionality
and
what
they
also
wanted
to
do
is
they
want
to
end
threat
and,
as
I
am
the
support
to
the
crawler
language
or
as
features
of
grep
assembly
itself.
This
is
only
a
goal,
that's
probably
far
into
the
future,
and
only
reserved
for
a
stage
two
or
pep
assembly,
but
this
was
brought
forward
as
one
of
the
advantages
in
JavaScript.
A
So
this
is
what
we
have
right.
Now
is
mgs
and
dep
assembly
and
now
take
a
look.
Let's
take
a
look
at
what's
the
story
request?
Well,
the
service
trust.
Is
it
worked
once
for
some
pretty
pretty
old
version
of
rust?
There
were
script
surrounds
that
got
you
a
hacky
working
version
of
what
C,
with
support
for
M
scripting,
but
often
they
were
based
on
some
patches
that
were
definitely
breaking
once
you
upgrade
the
rust
or
the
LLVM
that
is
used.
A
It
often
also
hacked
together.
How
does
standard
library
you
got
compiled
and
when
you
use
this
one
compiler
you
it's
probably
not
possible
to
target
the
native
host,
so
you
can't
you
can
compile
through
em
script
into
JavaScript,
but
you
can't
compile
a
normal
binary
anymore
and,
as
I
said,
it
only
worked
for
some
pretty
pretty
old
versions,
and
this
was
one
major
thing
that
blocked
advancing
this
forward
and
that
is
M.
A
Scripting
uses
LOV
M,
but
it
uses
its
own
fork
that
was
forked
a
long
time
ago
and
it
only
back
ported
patches
from
LLVM
when
it
saw
them
fit
and
sometimes
upgraded
to
the
latest
LLVM,
but
very
slowly.
So
there
is
no
clear
base
that
you
can
just
take
the
m
scripting
patches
put
them
on
the
current
LLVM
and
you're
done.
They
are
working
on
that
right
now.
There
are
actually
at
the
base
of
LLVM
3.9
right
now,
so
we're
getting
there.
But
the
problem
there
was
rust,
only
supported
LLVM,
3.7
and
3.8.
A
So
then,
some
folks
from
the
rust
core
team-
and
me
we
sat
down
and
took
a
look
at
what's
actually
what's
actually
necessary
to
upgrade-
was
to
a
newer
LLVM
and
in
the
end
it
only
took
us
167
comments.
It
took
33
commits
it,
took
222
change
files
and
a
dozen
of
billboard
ones,
and
additionally,
five
failed
for
sweet
rice
from
the
pull
request
itself
to
actually
get
this
change
merged.
A
As
it
turns
out
the
LLVM
people
like
to
turn
around
the
api
from
release
to
release
and
that
now
they
not
only
changed
the
API
forward,
but
they
also
changed
it
back.
So
we
now
have
patches
that
actually
work
for
three
point:
seven
and
three
point
nine.
But
for
three
point:
eight,
you
call
another
API.
So
this
is
pretty
pretty
weird
and
we
have
to
deal
that
because
we
still
want
to
support
the
old
LLVM,
because
it
should
be
possible
to
compile
on
a
system
where
LLVM
is
already
existing.
A
So
how
close
are
you
really
well
from
there?
It
now
only
takes
10
to
15
more
steps
to
get
a
working
compiler
using
M
scripting.
This
is
better
than
before,
but
it's
not
really
good.
So
we
have
plans
on
being
better
on
that
as
well
and,
first
and
foremost,
we
need
to
make
sure
that
the
test
suit
of
rust
does
not
fail
when
compiled
was
unscripted
a
lot
of
the
tests
simply
test.
If
you
can
execute
threats
or
call
external
programs
or
call
into
dynamically
loaded
libraries
and
that's
simply
not
possible.
A
If
you
compile
to
M
scripting
and
run
that
through
not
yes,
so
we
first
need
to
disable
those
tests
and
lighter
fix
the
other
tests
that
are
still
failing.
We
then
need
to
make
sure
that
we
actually
get
the
LLVM
that
M
script
also
uses,
but
the
maintain
of
M
script
is
helping
us
out
there
and
he
clean
up
a
mess,
kiptyn's
LLVM
and
now
made
it
based
on
3.9,
and
we
have
3.9
entry
as
well.
A
So
this
is
where
we
are
right
now
and
if
you
want
to
have
out,
please
feel
free
to
go
to
Westland,
slash,
slash
issues,
/
3,
3,
2
or
5,
and
show
us
that
you
want
to
help.
We
would
appreciate
that,
but
in
the
meantime,
there's
actually
one
more
thing
we
can
do
and
that
is
compile
Russ
directly
to
assembly.
Do
you
all
remember
mere
the
intermediate
representation
of
rust?
A
Well,
it's
now
possible
to
take
that
don't
use
LLVM
at
all
and
instead
directly
provide
a
new
back-end
that
takes
the
mirror,
compiles
that
to
represent
Lee
and
put
outputs
into
the
file.
So
this
is
what
some
people
already
did.
It's
actually
a
new
back-end
for
rust.
You
wouldn't
need
LLVM
for
that
at
all.
A
It's
completely
in
parallel
to
the
other
efforts,
and
it's
called
mere
to
muzzle
it's
built
on
melee,
which
is
an
interpreter
for
the
mirror,
which
was
a
student
project
by
someone
which
probably
gets
up
streamed
as
the
compile
time
Const
in
rust
itself
at
some
point,
or
at
least
parts
of
it.
So
we
share
resources
there
as
well,
and
this
actually
works.
I
will
share
an
example
later,
but
first
look
what
it
actually
does.
So
this
is
some
pretty
simple
russ
code.
A
It
adds
two
integers
when
you
run
that
through
a
rusty
and
output,
the
mere
code
or
what
mere
thinks
it
should
look
like
it's
this,
it's
a
bit
bigger,
but
actually
you
can
see
still
see,
there's
a
addition
in
the
middle
and
from
there
on
it
just
returns
the
numbers,
it's
I,
don't
know
why
it
needs
so
many
temporary
variables,
but
it's
probably
has
some
good
reasons
for
that.
That's
actually
already
the
at
least
rust
optimized
code,
so
LLVM
will
throw
away
a
lot
of
that
as
well,
but
we
don't
use
LLVM.
A
We
use
mere
buzz
now.
So
if
we
put
that
through
that,
we
get
this
bus
code,
I'm,
not
100%
sure
why
it
does
the
store.
Const
Lord
comes
thing
there.
It's
also
the
optimized
build
I'm,
not
pretty
sure,
not
really
sure
what
it
does
for
this
example.
I'm,
actually
sure
it's
not
necessary,
but
for
some
bigger
example,
it
might
be
that
it
needs
to
load
something
from
the
memory.
A
A
Okay,
so
what
I
did
is
I
took
the
rust,
sha-1
crate
and
compiled
it
to
a
SMGs
with
inscription
and
basically
put
some
code
around
that
to
make
it
work
in
JavaScript,
and
he
didn't
you
type.
No,
you
say
it
calculates
the
sha-1
some
just
right
in
the
browser
and
if
you
take
a
look
there,
we
go
so
basically
we
load
this
huge
file
and
just
say:
well,
there's
a
function
in
there.
We
know
and
just
call
it
whenever
we
type
something,
and
what
you
will
now
see
is
what
am
scripting
outputs.
A
So
there
it's
calling
digits
at
once
and
well.
There's
is
so.
What
I
had
to
do
is
like
I
needed
to
try
to
provide
a
Beretta,
because
the
M
scripting
wrapper
part
expects
C
strings
as
well.
So
I
need
to
call
the
well
the
right
functions
to
get
C
strings
in
rust
and
translate
that
to
Springs
posit
onto
the
sha-1
library
and
turn
it
back
and
everything,
but
well
it
works.
So
that's
for
that.
A
Okay,
okay,
so
as
it
turns
out,
there
is
BAP
DL
support
in
most
browsers
now,
which
basically
gives
you
an
OpenGL
like
context
to
provide
graphics.
&Amp;
m's
people
already
translates
OpenGL
code
to
WebGL
code,
so
you
can
just
provide
an
GL
example,
at
least
if
you're,
not
using
any
fancy,
features,
compile
that
and
get
some
JavaScript
code
that
uses
WebGL.
And
now
it's
downloading
11
megabyte
of
JavaScript
and
chosen
moving
keyboard.
B
A
Actually
not
entirely
sure
what
it
is.
I
just
think
like
considering
that
I
don't
have
a
real
graphic
card.
It
might
be
brought
anyway.
So
this
already
works
I
know
at
least
some
wild
back
when
there
was
the
Hecky
version
of
Ross
C&M
script
ins,
and
there
was
like
minecraft
demo
example:
someone
compiled
that
and
executed
in
the
browser,
so
even
that
is
possible.
A
Okay
and
last
one
I
took
this
code
of
rust.
I
compiled
it
using
near
buzzing
this,
as
you
can
see,
not
that
hard,
and
if
you
don't
change
it,
you
get
the
factorial
of
12
and
one
funny
thing
as
well.
Well,
you
can't
do
20,
it's
too
big.
You
can
do
90
what
works
and
you
can
18
so
yeah
as
it
turns
out.
Well,
JavaScript
only
has
doubles,
so
you
can't
be
present
all
the
yeah,
all
the
integers
out
there.
So
at
some
point
it
will
work,
but
it's
probably
good
enough
at
this
point
yeah.
C
A
That
is
true,
a
lot
of
vm
just
a
lot
of
optimizations,
but
there
will
be
more
optimizations
on
Mir.
A
lot
of
optimizations
were
actually
blocked
by
not
having
mirrors,
so
we
will
get
better
optimize
Mir
and
what
mere
2000
is
using
is
binary
yen,
which
is
a
proof
of
concept
implementation
by
the
same
guy
as
I'm
scripting,
who
took
a
lot
of
the
optimizations
put
that
in
there
and
use
that
to
generate
pep
assembly.
A
So,
yes,
we
will
lose
a
lot
of
the
optimizations,
as
LLVM
probably
could
do,
but
we
will
use
other
optimizations
that
M
scripting
will
also
do
and
also
M
script.
Node,
so
does
the
same
of
M
scripting
uses
a
lot
of
the
optimizations
from
LLVM
itself,
which
then
outputs
JavaScript,
but
it
will
then
use
optimizer
on
this
generated
JavaScript
to
strip
it
down
again,
because
some
of
the
code
that
falls
out
from
the
first
step
is
working
JavaScript.
But
you
can,
especially
with
regards
to
garbage
collection.
A
You
can
optimize
it
quite
well
like
removing
additional
variables,
remove
all
the
temporaries
that
LLVM
couldn't
find,
try
to
split
up
functions
where
possible,
because
all
this
are
pretty
much
bound
to
how
the
actual
JavaScript
engines
work
so
yeah
for
mutualism.
We
will
benefit
a
bit
from
mirror
and
binary
gen
button
familiar.
A
Like
the
bindings
to
WebGL
are
pretty
easy
because
M
scripting
does
it.
There
is
a
great
called
bet
platform
which
provides
a
lot
of
wrappers
around
native
api's
in
rust.
This
is
pretty
Hecky
because
it
actually
relies
on
calling
engine
just
generating
some
JavaScript
code
at
compile
time,
and
you
think
that
otherwise,
we
don't
have
a
clear
way
to
access
the
Dom
at
the
moment.
Well,
there
are
thoughts
about
how
to
actually
do
this.
There
might
be
ways
to
actually
automatically
generate
bindings
at
some
level.
A
We
hope
that
the
several
people
will
also
give
us
some
utilities,
because
they're
already
doing
some
of
this
stuff
because
they
have
to
bind
to
the
Dom
as
well.
So
there
will
hopefully
be
some
joint
efforts
to
do
this,
but
I
can
probably,
as
it's
the
more
time
anyway,
we
can
take
a
look
at
platform.
I
can
show
you
the
code.
It
takes
to
actually
bind
stuff.
A
It
binds
by
having
some
form
of
JavaScript
in
there
that
actually
calls
into
some
M
scripting
api's,
so
it
just
gets
placed
as
JavaScript
in
the
compiled
output,
and
so
this
is
what
it
would
take
right
now,
it's
pretty
much
unsafe,
but
it
works,
but
it's
definitely
not
nice
and
only
for
the
limited
cases
we
implemented
or
that
were
implemented.
I
did
this
for
some
jQuery
functions.
D
I'm
just
wondering
what
limitations
am
stripping
currently
has
recurred
just
for
the
reference.
Just
a
few
years
ago,
we
went
to
compile
C
+
+
2
m
scripting,
and
this
was
something
like
you
were
not
allowed
to
use
exceptions
because
you
couldn't
use
that
certain
Cisco's
were
of
cotton.
Of
course
it
allowed
like
file
opening
was
a
thing
and
all
they
said
so.
So
what
do
we
have
to
look
for
when
you
write
code
that
you
want
to
transpire?
Oh
yeah.
A
Script,
everything
that
does
anything
dynamically
in
C
or
C++
like
loading.
Anything
external
will
definitely
fail.
There's
no
threading
support,
though
that
might
come
once
it's
available
in
rep
assembly
and
yeah,
like
everything
that
handles
files,
there's
no
translation
to
any
API
in
the
browser.
A
What
what
you
can
do,
though
one
thing
I
didn't
mention
is
so
right
now
the
memory
buffer
that
gets
allocated
is
somewhere
that
it
might
be
to
be
at
some
size,
but
you
can
provide
it
some
initial
memory,
so
you
just
give
it
a
memory
file
where
you
can
already
place
your
stuff
in
there.
So
you
basically
already
have
a
global
buffer
for
resources.
You
can
put
stuff
in
I.
Guess.
A
D
A
I'm,
actually,
not
quite
sure
so,
I
know
it
because
I
read
it.
The
mere
two
dozen
example
that
we
just
set
a
buffer
of
I
think
256,
just
because
we
don't
know
what
you
do,
I,
not
a
hundred
percent
sure
how
I'm
scripting
decides
it
at
the
moment,
but
it
at
least
gives
you
that.
Well,
if
you
go
over
the
memory
buffer,
it
will
give
you
an
undefined
value.
So
following
code
will
definitely
fail
at
some
point.
It
won't
give
you
nice
error
messages
but
yeah.
Well,
you
won't
crash
to
borrow.
E
A
Javascript
simply
specifies
that
all
numbers
in
the
program
are
doubles,
and
that
means
you
can
only
represent
integers
precisely
up
to
a
certain
limit,
and
that's
if
there's
no
way
to
do
this
anyway
else.
The
thing
is:
if
you
do
this
optimizations
with
the
binary
or
zero,
the
engine
will
actually
interpret
no
understand
that
you
have
using
an
integer
and
in
the
low-level
code
it
produces.
There
will
be
an
integer
used,
not
a
double.
E
A
Like
if
you
get
it
back
into
JavaScript,
it
will
be
a
double
again:
okay
and
that
will
break,
of
course,
for
big
numbers.
That
was
actually
a
problem
for
quite
some
applications
out
there,
like
Twitter,
using
integers
in
the
front-end
code
for
the
IDs
IDs
of
the
tweets,
which
at
some
point
broke
because,
of
course,
with
the
double
you
are
limited
in
how
large
your
IDs
can
be,
and
this
broke
once
they
reach
a
certain
number
of
tweets.
A
A
Well,
if
you're
doing
rust,
you
probably
know
the
playground
where
you
can
write
code,
compile
it
in
the
browser
and
execute
it
as
it
turns
out.
You
can
also
do
this
with
my
one,
you,
oh,
it's
cached,
wait
wait!
So
what
I
did
is
I
replaced
the
back
end
and
use
my
Ross
compiler
that
compiles
to
JavaScript
and
then
executes
that
send
it
back
to
the
browser
and
executed
there
and,
as
you
can
see
a
little
very
last
line.
You
get
a
hello
world
and
if
you
still
have
time
what.
A
Can
insert
this
part
of
the
code
so
what
you're
now
doing?
This
is
a
I'm
scripting
API,
which
actually
tells
you
just
input
this
kind
of
looking
JavaScript
into
the
code
and
execute
it
there.
We
call
it
was
just
a
string
of
alert.
So,
oh,
that's
so
cached,
okay,
great,
so
it
works.
It
executes
the
JavaScript,
but
now
to
make
it
show
you
what
the
problem
is.
So
this
is
new
code
and
actually
compiles
on
my
server
now
and
it
takes
about
I,
don't
know
one
to
two
minutes
so
why
this
is
working.
A
A
A
Input
written
now
waiting
what
actually
also
launched
this
is
a
docker
container
to
launch
rusty
and
mm-hmm.
It's
really
slow
I
actually
have
no
idea.
I
really
don't
know
what
M
script
is
doing
there,
because
it's
just
didn't
work,
I'm
still,
not
sure,
what's
so
slow
there,
because
in
theory
it
should
like
at
least
not
that
slow
I
mean
especially
for
this
small
code-
there's
not
a
lot.
It
has
to
do
like
it's
pretty
easy.
A
It
should
understand
how
to
do
that,
so
this
will
basically
be
the
next
step
of
actually
getting
once
we
get
the
bug
fixed
and
the
test
fix.
We
need
to
take
a
look
why
it's
so
slow.
Is
it
the
the
rust
part?
Is
the
Ella
the
impart
or
is
it
actually
the
M
scripting
part?
So
yeah
I
don't
know
it
could
be
that
the
actual
output
from
rust
is
a
bit
longer
than
just
this
function.
A
There's
a
lot
of
boilerplate
that
ultimately,
each
get
generated
inserted
from
the
standard
library
and
its
might
take
some
time
for
it
to
realize,
well
that
it
can
all
optimize
that
away,
because
never
called
so
yeah
I
mean
only
the
print
Ln
line
already
goes
with
the
formatter.
Then
it
needs
to
find
where
to
buy,
to
which
is
actually
replacement
and
now
writes
to
the
console.
So
there
are
a
lot
of
traits
and
limitations
in
the
standard
library
touched.
So
probably
this
optimization
okay,
we
got
here.
A
E
A
A
A
A
A
Okay,
so
if
you
want
to
try
that
out,
just
pull
that
container,
it
might
get
a
bit
smaller
next
thing
and
start
it.
I
can
also
give
you
an
USB
stick
if
you
trust
me
and
use
it
from
there
and
if
you
have
any
questions
left,
although
it
all
works
or
why
that
works
or
why
we
wanted.
No,
it's
the
time
to
ask.
A
So
actually,
how
I
got
started
was
that
I
was
invited
to
give
a
talk
about
a
random
topic
of
the
thing
I
wanted
to
do,
and
at
that
point,
I
looked
a
lot
into
using
rust
for
web
development,
but
just
represent
presenting
what
was
just
for
back-end
development
is
quite
an
interesting
because
yeah
are
we
getting
there?
We
have
a
lot
of
tools
and
such
and
so
I
looked
at
what
we
could
do
as
well,
and
then
there
was
several
which
does
the
rendering
of
everything,
but
there
was
still
something
missing.
A
So
I
took
a
look
at
how
to
actually
one
was
in
the
browser
and
now
I
have
a
full
stack
example
that
has
a
rust
application
all
the
way
from
the
back
to
the
front,
including
the
browser
better,
also
how
I
got
started
and
when
I
started
there
were
only
these
hex
around
that
built
you,
the
worst
C
was
M
scripting
and
yeah.
When
then
Brian
came
up
was
saying
we
want
that
upstream.
At
some
point,
I
was
like
okay.
A
I
will
do
that
and
actually
I
could
hooked
on
this,
because
I
could
contribute
to
the
was
compiler
without
breaking
it
too
much
I
saw
and
then
it
turned
out
well,
there's
so
much
born
in
the
LLVM
right
now.
Well,
it
took
33
commits
to
actually
make
it
happen,
yeah
all
right
anything
else.
Well,
thank
you.