Skip to content
kswoll edited this page Mar 28, 2014 · 8 revisions

The cross-compilation process is not perfect. Due to the nature of Javascript, there are certain C# features that have no natural fit and would be either very difficult or impossible to support.

  • All numeric types (including decimal, unfortunately), both nullable and not, are represented by the Javascript Number type. Except for decimal, this should generally not be noticable to you except when you try to interrogate the type of a number using is, as, or .GetType(), since all numbers are represented as a System.Number. If you cast a double to an int, for example, you can trust that the value stored in that int has no decimal portion. True support for decimal will come in the future, but will require implementing that type from scratch and to not use the native Javascript Number type.

  • Structs are not supported; they will compile, but they will behave exactly like classes. Thus you should avoid using structs in your own types. Structs you find in WootzJs.Runtime are structs because the compiler expects them to be.

  • Threading is not supported at all. Despite the concept of Web Workers in HTML5, they are completely inadequate to support threading in the sense that a C# developer expects. This is because Web Workers require all the code for the separate thread to not only live in a separate .js file, but communication between workers must happen via message passing -- there is no shared memory. While this is certainly a reasonable way to implement threading, as it requires no locking and thus is much safer to both reason about and program, it does nothing to mitigate the fact that this is not how threading works in C# and would be wholly incapable of the task.

  • The BCL is very deep in certain areas but is not anywhere near comprehensive. Adding to it is an ongoing process. Please file a bug if you identify a missing BCL class, method, etc. that you would like to see implemented (aside from the limitations outlined above).

Clone this wiki locally