
Mono and WebAssembly – Updates on Static Compilation - benaadams
http://www.mono-project.com/news/2018/01/16/mono-static-webassembly-compilation/
======
kodablah
Awesome.

> This currently requires MacOS High Sierra to run.

Ha, feels strange to say it, but "waiting for a Windows version". Also for the
latest Mono preview targeting WebAssembly [0], I wanted a Windows
nightly...went and looked at the Mono site's nightly downloads...nope, Linux
and macOS only. Heh.

0 - [http://www.mono-project.com/docs/about-
mono/releases/5.8.0/](http://www.mono-project.com/docs/about-
mono/releases/5.8.0/)

~~~
josteink
> Ha, feels strange to say it, but "waiting for a Windows version".

I can _understand_ the lack of a Windows version.

What I can’t understand is why this won’t on Linux.

~~~
kevingadd
A significant portion of the main webassembly development teams at google &
apple (and probably mozilla, but I'm not sure) use macs, and I think that's
true for many mono developers also. The linux and windows (especially windows)
toolchains are neglected.

For a while the canonical webassembly tooling and test suite were unusable on
Windows due to the selection of software that didn't work there. It was a
bummer (that was corrected, at least!)

~~~
txdv
Yeah, mac-books are one of the favorite choices of unix focused devs. So quite
a few people at Xamarin are using that.

Also, they are a MacOS focused shop in some ways (Xamarin for iOS).

------
sirjaz
This awesome, I much prefer to code in C# as compared to js. It is a much
cleaner language.

~~~
eosrei
[https://github.com/appcypher/awesome-wasm-
langs](https://github.com/appcypher/awesome-wasm-langs) is the full list of
WebAssembly languages and their current status.

~~~
justin66
I wasn't sure if this list would be any good, but it says right at the top
that it's "curated." Imagine my relief!

~~~
skrebbel
Hahah :-)

Yeah it's a mess. GitHub is full of "Awesome XYZ" lists which are basically
just dumps of links. Awesome Elixir is a good example, it's worthless and full
of 2-year old unmaintained afternoon hacks.

------
Bizarro
I've always envied the JVM's class reloading abilities. Edit-n-continue in
Visual Studio has so many "it doesn't work if you do this" cases, that's it
next to useless.

I would love to be able to put the C# debugger into interpreter mode and be
able to change anything, anywhere while debugging and keep on trucking without
having to stop debugger, make changes, restart debugger, etc..

~~~
zbentley
Even the JVM has a fair number of issues if you use class reloading to do
Weird Stuff (tm), especially with advanced debugger tricks added into the mix.
That's one of the reasons some of the folks I know who use Scala switched in
the first place.

I think any hot-reloading solution for a big, complex,
introspective/reflective language is going to have some warts* and places
where it stops working in some scenarios. The trick is just to minimize those
to where they don't get on your nerves on a daily basis. C# will hopefully get
there soon.

* Unless, that is the language is designed from the ground up to support code reloading. Erlang/Elixir's runtime inspection/injection/behavior alteration capability is second to none, and largely replaces the role of a true/traditional debugger. And you can do other cool stuff with it like zero-downtime in-place deployments, though that doesn't exactly come for free.

~~~
_sdegutis
I ended up with a pretty sweet workflow that involved hot code reloading in a
Clojure web app where I rarely needed to restart the dev JVM. It involved
Emacs and CIDER and designing the app’s architecture in a certain way but I
felt it was really worth it. That said, if I was using a language with faster
start up time then I’d have just restarted after every major change and not
even worry about this, but this has some benefits that don’t exist in that
scenario.

------
Humphrey
How does this handle garage collection? I believe Webassembly doesn't yet
support GC so, is this manually compiling it's own GC into it?

~~~
testvox
Mono already supports embedding the runtime with the application. So they just
used that feature here. Also available is the mono interpreter which does it's
own garbage collection.

~~~
yodon
It’s more complex than that, as there’s tons of academic work essentially
proving it’s impossible to chain two independent garbage collectors and not
end up with stuck uncollectable memory (I apologize, this isn’t my field, I’ve
skimmed the work but not retained the citations, and I realize how counter-
intuitive that result is... nobody wants to think its true, so it keeps
getting more academics thrown at it, without changing the results).

My assumption is that at the moment they are just accepting that some
uncollectable memory will happen in the short term and eventually the
WebAssembly working group will expose the underlying garbage collector and
everything will get better. Early days kind of issue for now.

~~~
rodrigokumpera
Xamarin.Android begs to differ. It provides full integration and all we use
from Dalvik are gc handles and explicit GC control.

Full Disclosure: I work at MS and I am one of the original designers of it.

------
yodon
Does anyone know if there is work being done to add JSX syntax to C# (either
into the language directly or as part of a pre-processor)?

~~~
zastrowm
The CSharpLang github[1] repository would be where to look for this. I didn't
find anything that mentioned adding language support for it, and IIRC, in the
past they rejected the idea of inline XML or JSON support.

Going the other way of C# inside HTML, you have Razor[2] and Blazor[3], the
latter of which is a prototype of Razor running in the browser via web
assembly.

[1]:
[https://github.com/dotnet/csharplang](https://github.com/dotnet/csharplang)
[2]: [https://docs.microsoft.com/en-
us/aspnet/core/mvc/views/razor](https://docs.microsoft.com/en-
us/aspnet/core/mvc/views/razor) [3]:
[http://blog.stevensanderson.com/2017/11/05/blazor-on-
mono/](http://blog.stevensanderson.com/2017/11/05/blazor-on-mono/)

~~~
yodon
Blazor is pretty amazing, but my coder fantasies mostly revolve around a
React-JSX-in-C# vision - the syntax and approach just feel so natural and so
right. Your point about rejecting inline XML is probably a pretty good data
point that I shouldn’t expect what I’m hoping for to happen.

~~~
pjmlp
Well, if you would use VB.NET instead, it supports XML literals.

------
cm2187
Has anyone heard about Microsoft working on a similar project? The proof of
concept last summer seemed to have raised a lot of interest among Microsoft
people. I hope they take that route.

~~~
lrz
We are Microsoft employees :-)

~~~
sydd
Why are there currently 2 projects aiming to run C# code in WebAssembly? I
mean this one and coreRT?

~~~
kevingadd
Lots of people out there use mono, and if they want to run in the browser, it
wouldn't hurt for mono to have webassembly support would it? :)

