Releases: dotnet-websharper/core
WebSharper 4.0 RC bugfix-2
WebSharper.4.0.191.103-rc
Fixes
- #777 Implicit call to default base constructor is added correctly in C#.
- #780
System.ValueType
methods translate, structs has structural equality on.Equals
. - #776
.ToJS
on aDateTime
correctly creates a JSDate
object. - #779 Type check against cases of erased union types translate in C#.
Enhancements
- #782 Added a
SetJS
extension method to all objects (whenWebSharper.JavaScript
namespace is opened) for setting a JavaScript property. - #781 There were two
JS
static classes previously, one defined inWebSharper.JavaScript.dll
(accessors for global JS objects) and one defined inWebSharper.Main.dll
(JS.Inline
helper). Name collisions are annoying from C#, so the latter single method have been also moved to be onWebSharper.JavaScript.JS
.
WebSharper 4.0 RC bugfix-1
WebSharper.4.0.190.100-rc
Fixes
- #760
CompareTo
andEquals
works on number types,Char
,String
,Guid
- #763 Additional methods working in translation for
System.Array
,System.Collections.Generic.List<T>
,System.Threading.Tasks.Task
andTask<T>
,System.String
,System.Guid
,System.Char
- #773 Fix translation failure when using
Inline
members of classes with a static constructor.
Enhancements
- #771 Updated to latest
FSharp.Compiler.Service
(14.0.2
) - #761 Type checks against interfaces translate to name checks. Default names of interface members contain the full type name, so that is guaranteed to be unique, can be shortened by using the
Name
attribute on the interface method definition, then it is recommended to name it something that is not used in the project for anything else. - #754 New feature for the
JavaScript
attribute:JavaScript "FileName/TypeName"
on assembly level can annotate a file or type from outside of that file (useful when sharing code files with non-WebSharper projects). File names should contain no path and are case sensitive, type name must be exactFullName
(for a nested generic type it can look likeMyNamespace.MyClass+MyNestedClass`2
). - #416 Enum comparison and equality translates to simple operators
- #769 Translation errors are caught for individual members, so that better errors can be reported if there is any failure in the translation layer, as now should report the name and usually the source position of the failing members.
- #764
EmbedAST
is a new helper that allows inlining WebSharper AST values inside F# quotations to return from a Generator. Full mixability of JS strings, WS.AST and F# quotations coming soon, to make metaprogramming/code generation as easy as possible.
WebSharper 4.0 RC
WebSharper.4.0.189.96-rc
See the release announcement.
No changes from Zafir.4.0.188.91-beta10
except package naming. Building WebSharper now relies on Paket
and FAKE
.
WebSharper 4 beta-10 bugfix-2
Zafir.4.0.188.91-beta10
Fixes
- #751 Tail recursive optimization correctly checks that every recursive call is indeed in tail position (previously, arguments of self-calls were not analyzed further)
- #753 Fix unused
static let
. Previously createdcctor
call but no code output, causing a JS runtime error - #756 Fix function argument with tupled input optimizer failing when it's not always used with a tuple in place. Now WebSharper does not compiles this to a multiple-argument JS function in this case.
Enhancements
- Optimized calls to static constructors using control flow analysis. Bodies of translated static constructors now set themselves to
ignore
as first step, eliminating the need for theRuntime.Cctor
wrapper. Results in shorter code output. - Added extra URL helper active patterns to
WebSharper.Sitelets.UrlHelpers
WebSharper 4 beta-10 bugfix-1
Zafir.4.0.187.90-beta10
Fixes
- #739 fix assembly resolution on Mono to read runtime Sitelet mertadata.
- #746 JavaScript named functions inside inlines are preserved properly
- #747
Stub
attribute behaves in compatibile way with WS3: if all members of a class have theStub
attribute, it is equivalent to the class having it (WS does not redefine the type, it is assumed to exist in outside JS), but having any non-Stub instance members causes WS to define the class. This is fixing issues in WebSharper.JQuery.
WebSharper 4 beta-10
Zafir.4.0.185.88-beta10
Fixes
- #734 Classes now have reference equality by default (you can override
Equals
as in .NET). Arrays, tuples, F# records and unions still use structural equality - #736
System.Char
is now translated to a 1-lengthString
in JavaScript. RPC handling and all methods dealing withChar
s have been updated. - #742 C# 7.1 features are working.
- #743
printf ""
compiles properly. - #741
Guid.Empty
is usable client-side. - #547 Numeric conversions in C# have the same semantics as F# helpers (parsing numbers, integral types truncate but no size checks).
- #549 You can use padding numbers in C# string interpolation syntax.
Enhancements
- #545 Nullable operators with correct semantics. In F#, you can use the
FSharp.Linq.Nullable
andFSharp.Linq.NullableOperators
modules on the client-side. C# operations on Nullables now follow .NET semantics properly: anull
value is propagated to the result. - #744 Static members can be proxied across multiple projects.
Breaking changes
- If you have relied on classes having automatic structural equality in the WebSharper translation, this is now incorrect. Implement an override for
Equals
. - Create an empty JavaScript plain object with
new JSObject()
/New []
. Previously this was equivalent tonew object()
/obj()
, but now the latter translates to an instance ofWebSharper.Obj
which defines its ownEquals
andGetHashCode
methods. - Default hash value of classes are now always
-1
. This should not be breaking, but if you use a class as keys or rely on hashing in any other way, be sure to overrideGetHashCode
on your class for performance. System.Decimal
support has been removed from WebSharper main libraries. It is now a part ofWebSharper.MathJS
and now has correct precision.
WebSharper 4 beta-9 bugfix-2
Zafir.4.0.181.82-beta9
Fixes
- #735 Client-side JSON serialization of a class with an option field.
- #737 Fixes around mutually tail recursive optimization. Translates correctly into a state machine switch cases do not fall over incorrectly, return is not missing for unit values, values are copied to temporary variable when needed at setting state for next iteration.
- #740
Seq.cached
no longer skips first value when iterating from cache
Improvements
- #738 All
.allPairs
functions now have proxies, can be used in client-side code.
WebSharper 4 beta-9 bugfix-1
WebSharper 4 beta-9
Zafir.4.0.177.78-beta9
Fixes
- #719
beta8
had a serious bug where it generated unsafe accesses to global object at the top of the scripts, this is now fixed, but not reverting the change to shorten outside addresses, see the note about breaking change below.
Improvements
- #722 Auto-hash WebSharper-generated output and files included as
WebResource
, use this hash on generating links to avoid browsers caching an outdated version. This is an automatic feature, no configuration currently. - #725 Client-side JSON can de/serialize custom classes. (
Serializable
attribute and default constructor are not required as on the server.) - #726 Not creating .js file for an assembly containing only inlined code
- #715 Client-side JSON module is visible as
WebSharper.TypedJson
from C# to avoid name conflict. - #723
JavaScript(false)
on an interface opts-out of default interface handling on client-side, allows for more divergence of client/server behavior when needed. - #724 optional analyzer for closures, helping to avoid some classes of memory leaks in JavaScript.
There is an inconvenient source of memory leaks in most JavaScript engines: captured variables are tied to a Context object and even functions that do not use some (or any) variables from a Context still retain the whole object. This is described well here: http://point.davidglasser.net/2013/06/27/surprising-javascript-memory-leak.html
Adding a
WebSharperAnalyzeClosures
project property gives warnings on these kinds of captures, helping to eliminate memory leaks.Usage:
<WebSharperAnalyzeClosures>True</WebSharperAnalyzeClosures>
or<WebSharperAnalyzeClosures>MoveToTop</WebSharperAnalyzeClosures>
. The latter additionally moves all non-capturing lambdas to top level automatically (experimental).
Breaking change
- Previously, having
[<Inline "myLibrary.doSomething()">]
and[<Inline "$global.myLibrary.doSomething()">]
was working equivalently. Now access to global scope without the$global
object is assumed to be initialized before the current script starts running (WebSharper itself takes care of this, if you use theRequire
attribute) and will not change, so it is safe to shorten. Whenever you want the exact call on the current global scope (window
object), be sure to use$global
.
WebSharper 4 beta-8
Zafir.4.0.171.72-beta8
Fixes and improvements
- #717 Fixed exponential compile time on chained method/property calls
- #716 C# helper for constructing a custom plain JavaScript object:
new JSObject() { { "background-color", "#666" } }
- #709 Remove unnecessary variables around inlines. Also stronger optimizations for conditionals, function
.apply
and array.concat
to reduce translated code size and make it more readable.